bin/: Fix preamble to handle invocation through a symlink.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 23 Feb 2016 10:10:35 +0000 (10:10 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 23 Feb 2016 10:10:35 +0000 (10:10 +0000)
This depends on GNU coreutils readlink(1), but I think we can live
with that.

bin/le
bin/make-cert
bin/reissue

diff --git a/bin/le b/bin/le
index 11963b5..0ec46b2 100755 (executable)
--- a/bin/le
+++ b/bin/le
@@ -1,7 +1,8 @@
 #! /bin/sh
 set -e
-. "${0%/*}/../config.sh"
-. $home/lib/lib.sh
+prog=$(readlink -e "$0")
+. "${prog%/*}/../config.sh"
+. "$home/lib/lib.sh"
 
 run_as_user "$@"
 prepare_tmp le-user
index b6a86df..19808c6 100755 (executable)
@@ -1,7 +1,8 @@
 #! /bin/sh
 set -e
 usage=" TAG"
-. "${0%/*}/../config.sh"
+prog=$(readlink -e "$0")
+. "${prog%/*}/../config.sh"
 . "$home/lib/lib.sh"
 
 run_as_user "$@"
index 32301ef..3758327 100755 (executable)
@@ -1,7 +1,8 @@
 #! /bin/sh
 set -e
 usage=""
-. "${0%/*}/../config.sh"
+prog=$(readlink -e "$0")
+. "${prog%/*}/../config.sh"
 . "$home/lib/lib.sh"
 
 run_as_user "$@"