X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=index.cgi;h=c052787209d6d20c9444463041ed54334646cdf2;hp=a7edbb1186378b7584e1e23e6b39a8f0aa906b19;hb=c195881a2389862d4bfcd2fd55ca868f7a20b8e8;hpb=7f927856071799039923e9e1f00652819792987a diff --git a/index.cgi b/index.cgi index a7edbb1..c052787 100755 --- a/index.cgi +++ b/index.cgi @@ -15,19 +15,15 @@ debug() { #change to false to disable debugging # we will use the http root as object storage (data directory) and call sub # programs from the directory in which the real executable resides # therefore we need to identify the code and data directories _EXEC and _DATA -call=$0 -real=$call -while [ -L "$real" ]; do - real="$(stat -c %N "$real" |sed -r "s:..*. -> .(.*).$:\1:")" -done - +call="$0" +real="$(readlink -f $call)" _EXEC="$(dirname "$real")" #execution directory _DATA="$(dirname "$call")" #storage directory [ -w "$_DATA" ] && [ -d "$_DATA" ] || die "storage directory must be writable" # create directories for object storage -for each in "$_DATA"/{vcard,mappings,courses,cache,temp}; do +for each in "$_DATA"/{vcard,ical,cache,temp}; do [ ! -e "$each" ] && mkdir "$each" [ -w "$each" ] && [ -d "$each" ] || die "storage $each must be a writable directory" done