summaryrefslogtreecommitdiffstats
path: root/rebuildpkgs.in
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2019-02-13 07:32:03 +0100
committerLevente Polyak <anthraxx@archlinux.org>2019-08-09 19:41:51 +0200
commit8f5a02b23ddb2491c13553cb71276bdd088f63ac (patch)
tree08188546eade249b9ff8d0ff2c1dcb99240afe45 /rebuildpkgs.in
parente76d56047719c88351492ace896c5899a6786e14 (diff)
downloaddevtools-8f5a02b23ddb2491c13553cb71276bdd088f63ac.tar.gz
devtools-8f5a02b23ddb2491c13553cb71276bdd088f63ac.tar.xz
Don't rely on $0 to determine script names.
Programs can freely define the value of argv0 and thus it means nothing. Instead, use the bash-specific variable explicitly designed to safely and accurately reference the name of the currently sourced file. This also fixes the case where simple debugging mechanisms like using "bash -x foo" tried to treat "foo" as the unqualified $0 and therefore broke horribly due to lack of pathnames. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
Diffstat (limited to 'rebuildpkgs.in')
-rw-r--r--rebuildpkgs.in6
1 files changed, 3 insertions, 3 deletions
diff --git a/rebuildpkgs.in b/rebuildpkgs.in
index 4f4f98b..704563c 100644
--- a/rebuildpkgs.in
+++ b/rebuildpkgs.in
@@ -3,7 +3,7 @@
#
# This script rebuilds a list of packages in order
# and reports anything that fails
-#
+#
# Due to sudo usage, it is recommended to allow makechrootpkg
# to be run with NOPASSWD in your sudoers file
#
@@ -14,8 +14,8 @@
m4_include(lib/common.sh)
if (( $# < 1 )); then
- printf 'Usage: %s <chrootdir> <packages to rebuild>\n' "$(basename "$0")"
- printf ' example: %s ~/chroot readline bash foo bar baz\n' "$(basename "$0")"
+ printf 'Usage: %s <chrootdir> <packages to rebuild>\n' "$(basename "${BASH_SOURCE[0]}")"
+ printf ' example: %s ~/chroot readline bash foo bar baz\n' "$(basename "${BASH_SOURCE[0]}")"
exit 1
fi