summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2018-01-03 00:35:39 +0100
committerJonas Smedegaard <dr@jones.dk>2018-01-03 00:35:39 +0100
commitbea587720cb611f246f947e06698c34941413195 (patch)
treebfdb67089cb71f70deff1631d95a61e9e4fa07c4
parent026568483c5574baacdf2e0b86555abbdba622f7 (diff)
Tighten to use -- and variables VDIRSYNCER VDIRSYNCER_CONFIG.
-rwxr-xr-xbin/vdirsyncer16
1 files changed, 10 insertions, 6 deletions
diff --git a/bin/vdirsyncer b/bin/vdirsyncer
index 00b7b07..5724e3c 100755
--- a/bin/vdirsyncer
+++ b/bin/vdirsyncer
@@ -4,16 +4,20 @@ set -eu
SCRIPT=$(readlink --canonicalize-missing -- "$(which -- "$0")") #"
BASEDIR=$(dirname -- "$(dirname -- "$SCRIPT")") #"
-SUBDIR=$(realpath --no-symlinks --relative-to="$HOME" --relative-base="$HOME" "$BASEDIR")
+
+VDIRSYNCER=/usr/bin/vdirsyncer
+VDIRSYNCER_CONFIG="$BASEDIR/config"
+
+SUBDIR=$(realpath --no-symlinks --relative-to="$HOME" --relative-base="$HOME" -- "$BASEDIR")
[ "$HOME/$SUBDIR" != "$BASEDIR" ] || BASEDIR="~/$SUBDIR"
ACTION=${1:-sync}
-export VDIRSYNCER_CONFIG="$BASEDIR/config"
+export VDIRSYNCER_CONFIG
-if [ ! -e "$BASEDIR/config" ]; then
- sed -e "s,@@BASEDIR@@,$BASEDIR,g" "$BASEDIR/config.in" > "$BASEDIR/config"
- /usr/bin/vdirsyncer discover
+if [ ! -e "$VDIRSYNCER_CONFIG" ]; then
+ sed -e "s,@@BASEDIR@@,$BASEDIR,g" -- "$VDIRSYNCER_CONFIG.in" > "$VDIRSYNCER_CONFIG"
+ $VDIRSYNCER discover
fi
-/usr/bin/vdirsyncer "$ACTION"
+$VDIRSYNCER "$ACTION"