summaryrefslogtreecommitdiffstats
path: root/bin/comics/zits
diff options
context:
space:
mode:
authorAlexander Sulfrian <alex@spline.inf.fu-berlin.de>2012-07-27 14:37:51 +0200
committerwww-data <www-data@vm-staticweb.spline.inf.fu-berlin.de>2012-07-27 14:37:51 +0200
commit676e7ac3abb5eb9d956a702adec2a21b97cb4ed6 (patch)
treea79dec9a9b78a743054b8a277a0668891ed65756 /bin/comics/zits
parent0783f3e5a0b48bb61e436aa3b0c418f7506ba296 (diff)
downloadcomics-676e7ac3abb5eb9d956a702adec2a21b97cb4ed6.tar.gz
comics-676e7ac3abb5eb9d956a702adec2a21b97cb4ed6.tar.bz2
comics-676e7ac3abb5eb9d956a702adec2a21b97cb4ed6.zip
bin: supply top directory to fetch scripts
If calling get-commics with absolute pathe the fetching scripts got something like /var/www/comics.spline.de//var/www/comics.spline.de/ as absolute path. This fixes this issue by changing the working directory to the top level directory and getting the path with $(pwd) one time and supply the top directory to the fetching scripts as first argument.
Diffstat (limited to 'bin/comics/zits')
-rwxr-xr-xbin/comics/zits12
1 files changed, 10 insertions, 2 deletions
diff --git a/bin/comics/zits b/bin/comics/zits
index 8724116..579e745 100755
--- a/bin/comics/zits
+++ b/bin/comics/zits
@@ -1,7 +1,15 @@
#!/bin/bash
-source $(pwd)/$(dirname $0)/../../etc/settings.sh
-tmp=$(mktemp -d)
+if [ -z "$1" -o ! -d "$1" ]; then
+ echo "Usage: $0 <top-directory> [<days ago>]" 1>&2
+ exit 1
+fi
+
+top="${1}"
+shift
+
+source "${top}/etc/settings.sh"
+tmp="$(mktemp -d)"
cd "${tmp}"
newn="${day}.gif"