chiark / gitweb /
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 11963b53042164fcf533b2bfb00662e8a2d6b82b..0ec46b201181ad27837c9064d44d2679b88211f1 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 b6a86dfdaa2f6d99aac30fb2af291a7be0859b17..19808c6ca2bfc221bdd5e73af1f78186a46a5692 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 32301ef5ce5bd4477c4a92f04259336a7520d638..375832705801f009b267eb4ce540db2cb9e9dc2a 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 "$@"