summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-10-29 20:37:28 +0200
committerPierre Schmitz <pierre@archlinux.de>2011-10-29 20:37:28 +0200
commit86045b965e0b8439bc94d7af7c8bd5d1e6ea3fe2 (patch)
treed6a5d2a375e47bfeb440c2a50521fbf454d449cf
parentbea69043fb9c32cf182a5fa22fdde90518e264f9 (diff)
makechrootpkg: Make host pubring.gpg available to check signed sources
-rw-r--r--makechrootpkg.in16
1 files changed, 13 insertions, 3 deletions
diff --git a/makechrootpkg.in b/makechrootpkg.in
index 645992e..d182c46 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -173,11 +173,18 @@ mkdir -p "$copydir/build"
# Remove anything in there UNLESS -R (repack) was passed to makepkg
$repack || rm -rf "$copydir"/build/*
-# Read .makepkg.conf even if called via sudo
+# Read .makepkg.conf and .gnupg/pubring.gpg even if called via sudo
if [[ -n $SUDO_USER ]]; then
- makepkg_conf="$(eval echo ~$SUDO_USER)/.makepkg.conf"
+ SUDO_HOME="$(eval echo ~$SUDO_USER)"
+ makepkg_conf="$SUDO_HOME/.makepkg.conf"
+ if [[ -r "$SUDO_HOME/.gnupg/pubring.gpg" ]]; then
+ install -D "$SUDO_HOME/.gnupg/pubring.gpg" "$copydir/build/.gnupg/pubring.gpg"
+ fi
else
makepkg_conf="$HOME/.makepkg.conf"
+ if [[ -r "$HOME/.gnupg/pubring.gpg" ]]; then
+ install -D "$HOME/.gnupg/pubring.gpg" "$copydir/build/.gnupg/pubring.gpg"
+ fi
fi
# Get SRC/PKGDEST from makepkg.conf
@@ -247,7 +254,10 @@ cp PKGBUILD "$copydir/build/"
chown -R nobody "$copydir"/{build,pkgdest,srcdest}
-echo 'nobody ALL = NOPASSWD: /usr/bin/pacman' > "$copydir/etc/sudoers.d/nobody-pacman"
+cat > "$copydir/etc/sudoers.d/nobody-pacman" <<EOF
+Defaults env_keep += "HOME"
+nobody ALL = NOPASSWD: /usr/bin/pacman
+EOF
chmod 440 "$copydir/etc/sudoers.d/nobody-pacman"
# Set this system wide as makepkg will source /etc/profile before calling build()