summaryrefslogtreecommitdiff
path: root/makechrootpkg.in
diff options
context:
space:
mode:
authorJan Alexander Steffens (heftig) <jan.steffens@gmail.com>2017-07-13 19:37:15 +0200
committerErich Eckner <git@eckner.net>2017-07-14 07:00:40 +0200
commit7d9a9d98b6551116ea07e16fe3ae27d8a8a43fcd (patch)
tree6bafe29e7fcc086d3604b1da589ebf3bb662edfd /makechrootpkg.in
parentd16705830dc11e2c04a92173e4993f3724d1dee5 (diff)
downloaddevtools-7d9a9d98b6551116ea07e16fe3ae27d8a8a43fcd.tar.xz
makechrootpkg: Move makepkg-as-root check to main()
download_sources(), while the first invocation of makepkg, is a rather odd place for this kind of guard.
Diffstat (limited to 'makechrootpkg.in')
-rw-r--r--makechrootpkg.in16
1 files changed, 8 insertions, 8 deletions
diff --git a/makechrootpkg.in b/makechrootpkg.in
index 5bcb82b..47caba3 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -272,14 +272,9 @@ download_sources() {
chmod 1777 "$builddir"
# Ensure sources are downloaded
- if [[ "$(id -u "$makepkg_user")" != 0 ]]; then
- sudo -u "$makepkg_user" env SRCDEST="$SRCDEST" BUILDDIR="$builddir" \
- makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o ||
- die "Could not download sources."
- else
- error "Running makepkg as root is not allowed."
- exit 1
- fi
+ sudo -u "$makepkg_user" env SRCDEST="$SRCDEST" BUILDDIR="$builddir" \
+ makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o ||
+ die "Could not download sources."
# Clean up garbage from verifysource
rm -rf "$builddir"
@@ -407,6 +402,11 @@ main() {
[[ -f PKGBUILD ]] || return $ret
fi
+ if [[ "$(id -u "$makepkg_user")" == 0 ]]; then
+ error "Running makepkg as root is not allowed."
+ exit 1
+ fi
+
download_sources "$copydir" "$makepkg_user"
prepare_chroot "$copydir" "$USER_HOME" "$repack"