From 39c2c4c19e4c94d07fe82b0fe301482bd6d6e6f5 Mon Sep 17 00:00:00 2001 From: anthraxx Date: Fri, 6 Feb 2015 23:48:47 +0100 Subject: [PATCH] including files from actual basedir this supports arbitrary symlinking of the scripts and retrives the actual dirname where the files are laying. --- lock | 2 +- shared | 5 +++-- unlock | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lock b/lock index a050e64..0b87ab0 100755 --- a/lock +++ b/lock @@ -1,5 +1,5 @@ #!/bin/sh -source shared +. $(dirname $(readlink "$0"))/shared echo "Initializing Space Systems..." echo "22" > /sys/class/gpio/unexport diff --git a/shared b/shared index 449bc67..4faa2f3 100755 --- a/shared +++ b/shared @@ -1,13 +1,14 @@ #!/bin/sh +basedir=$(dirname $(readlink "$0")) config="dooris.conf" # warn if local config file is missing -if [ ! -f "${config}" ]; then +if [ ! -f "${basedir}/${config}" ]; then echo "WARNING: ${config} is missing!" >&2 fi # get password config value in a safe way -password="$(grep password ${config} 2>/dev/null|cut -d= -f2|tr -d ' \t')" +password="$(grep password ${basedir}/${config} 2>/dev/null|cut -d= -f2|tr -d ' \t')" if [ -z "${password}" ]; then echo "WARNING: password in ${config} is missing!" >&2 fi diff --git a/unlock b/unlock index 19f1eae..b7048fb 100755 --- a/unlock +++ b/unlock @@ -1,5 +1,5 @@ #!/bin/sh -source shared +. $(dirname $(readlink "$0"))/shared echo "Initializing Space Systems..." echo "27" > /sys/class/gpio/unexport