aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-03-24 08:41:33 +0100
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-03-24 10:30:35 -0400
commit263118a2699543933536ad5172ff473fc4b7fd06 (patch)
treec19fa3db7642dc58717e94f72a0f8391c205f475
parente0881bd9e6329d8557df2f39238facac799fbde3 (diff)
downloadb4-263118a2699543933536ad5172ff473fc4b7fd06.tar.gz
b4: allow b4.sh to be symlinked to
Change b4.sh to handle being symlinked to in order to find out where it "lives". This allows me to have a symlink in my local ~/bin/ called b4 that links to the git repo's b4.sh and have everything work properly. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rwxr-xr-xb4.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/b4.sh b/b4.sh
index cafeee1..e1f6c4e 100755
--- a/b4.sh
+++ b/b4.sh
@@ -3,6 +3,7 @@
# Run b4 from a git checkout.
#
-SCRIPT_TOP="${SCRIPT_TOP:-$(cd "${BASH_SOURCE%/*}" && pwd)}"
+REAL_SCRIPT=$(realpath -e ${BASH_SOURCE[0]})
+SCRIPT_TOP="${SCRIPT_TOP:-$(dirname ${REAL_SCRIPT})}"
exec env PYTHONPATH="${SCRIPT_TOP}" python3 "${SCRIPT_TOP}/b4/command.py" "${@}"