Die if --log, --pid, or --dest aren't accessible. Also die if po dir isn't accessible.

This commit is contained in:
Daniel Nichter
2012-01-17 13:12:08 -07:00
parent b2bac5c765
commit 6e2b670af6
5 changed files with 76 additions and 10 deletions

View File

@@ -57,6 +57,9 @@ make_pid_file() {
# PID file doesn't exist, or it does but its pid is stale.
echo "$pid" > "$file"
if [ $? -ne 0 ]; then
die "Cannot create or write PID file $file"
fi
}
remove_pid_file() {

View File

@@ -111,8 +111,20 @@ parse_options() {
# default=foo
# That's the spec for --string-opt2. Each line is a key:value pair
# from the option's POD line like "type: string; default: foo".
mkdir "$TMPDIR/po/" 2>/dev/null
if [ ! -d "$TMPDIR/po/" ]; then
mkdir "$TMPDIR/po/"
if [ $? -ne 0 ]; then
echo "Cannot mkdir $TMPDIR/po/" >&2
exit 1
fi
fi
rm -rf "$TMPDIR"/po/*
if [ $? -ne 0 ]; then
echo "Cannot rm -rf $TMPDIR/po/*" >&2
exit 1
fi
(
export PO_DIR="$TMPDIR/po"
cat "$file" | perl -ne '