summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch-nspawn.in2
-rw-r--r--src/archbuild.in2
-rw-r--r--src/lib/archroot.sh5
-rw-r--r--src/makechrootpkg.in2
-rw-r--r--src/makerepropkg.in2
-rw-r--r--src/mkarchroot.in2
6 files changed, 8 insertions, 7 deletions
diff --git a/src/arch-nspawn.in b/src/arch-nspawn.in
index 77a27ad..b692817 100644
--- a/src/arch-nspawn.in
+++ b/src/arch-nspawn.in
@@ -46,7 +46,7 @@ done
shift $((OPTIND - 1))
(( $# < 1 )) && die 'You must specify a directory.'
-check_root
+check_root "" "${BASH_SOURCE[0]}" "$@"
working_dir=$(readlink -f "$1")
shift 1
diff --git a/src/archbuild.in b/src/archbuild.in
index a7e4231..2f3faf9 100644
--- a/src/archbuild.in
+++ b/src/archbuild.in
@@ -74,7 +74,7 @@ while getopts 'hcr:' arg; do
esac
done
-check_root SOURCE_DATE_EPOCH,SRCDEST,SRCPKGDEST,PKGDEST,LOGDEST,MAKEFLAGS,PACKAGER,GNUPGHOME
+check_root SOURCE_DATE_EPOCH,SRCDEST,SRCPKGDEST,PKGDEST,LOGDEST,MAKEFLAGS,PACKAGER,GNUPGHOME "${BASH_SOURCE[0]}" "$@"
# Pass all arguments after -- right to makepkg
makechrootpkg_args+=("${@:$OPTIND}")
diff --git a/src/lib/archroot.sh b/src/lib/archroot.sh
index d7917da..3f48dc1 100644
--- a/src/lib/archroot.sh
+++ b/src/lib/archroot.sh
@@ -9,13 +9,14 @@ CHROOT_VERSION='v4'
##
# usage : check_root $keepenv
##
-orig_argv=("${BASH_SOURCE[0]}" "$@")
check_root() {
local keepenv=$1
+ shift
+ local orig_argv=("$@")
(( EUID == 0 )) && return
if type -P sudo >/dev/null; then
- exec sudo --preserve-env=$keepenv -- "${orig_argv[@]}"
+ exec sudo --preserve-env="${keepenv}" -- "${orig_argv[@]}"
else
exec su root -c "$(printf ' %q' "${orig_argv[@]}")"
fi
diff --git a/src/makechrootpkg.in b/src/makechrootpkg.in
index 8d3d093..2cfd849 100644
--- a/src/makechrootpkg.in
+++ b/src/makechrootpkg.in
@@ -301,7 +301,7 @@ done
[[ -n $makepkg_user && -z $(id -u "$makepkg_user") ]] && die 'Invalid makepkg user.'
makepkg_user=${makepkg_user:-${SUDO_USER:-$USER}}
-check_root SOURCE_DATE_EPOCH,BUILDTOOL,BUILDTOOLVER,GNUPGHOME,SRCDEST,SRCPKGDEST,PKGDEST,LOGDEST,MAKEFLAGS,PACKAGER
+check_root SOURCE_DATE_EPOCH,BUILDTOOL,BUILDTOOLVER,GNUPGHOME,SRCDEST,SRCPKGDEST,PKGDEST,LOGDEST,MAKEFLAGS,PACKAGER "${BASH_SOURCE[0]}" "$@"
# Canonicalize chrootdir, getting rid of trailing /
chrootdir=$(readlink -e "$passeddir")
diff --git a/src/makerepropkg.in b/src/makerepropkg.in
index f310c69..61ee9db 100644
--- a/src/makerepropkg.in
+++ b/src/makerepropkg.in
@@ -137,7 +137,7 @@ while getopts 'dM:c:l:h' arg; do
done
shift $((OPTIND - 1))
-check_root
+check_root "" "${BASH_SOURCE[0]}" "$@"
[[ -f PKGBUILD ]] || { error "No PKGBUILD in current directory."; exit 1; }
diff --git a/src/mkarchroot.in b/src/mkarchroot.in
index 6c8d8a2..610de16 100644
--- a/src/mkarchroot.in
+++ b/src/mkarchroot.in
@@ -52,7 +52,7 @@ shift $((OPTIND - 1))
(( $# < 2 )) && die 'You must specify a directory and one or more packages.'
-check_root
+check_root "" "${BASH_SOURCE[0]}" "$@"
working_dir="$(readlink -f "$1")"
shift 1