summaryrefslogtreecommitdiff
path: root/src/chroot-tools/makechrootpkg.sh.patch
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2014-11-06 00:04:41 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2014-11-06 00:04:41 -0500
commit44253875821a8a27b6cfdf74e29adb93edbaf0da (patch)
tree291cb74669e434948f96c3e32fffeff468917a34 /src/chroot-tools/makechrootpkg.sh.patch
parentfd054ec1b9efe3496d567edb3b2fd36998fe60dd (diff)
Update to newer devtools
Diffstat (limited to 'src/chroot-tools/makechrootpkg.sh.patch')
-rw-r--r--src/chroot-tools/makechrootpkg.sh.patch68
1 files changed, 29 insertions, 39 deletions
diff --git a/src/chroot-tools/makechrootpkg.sh.patch b/src/chroot-tools/makechrootpkg.sh.patch
index 8180d89..da02636 100644
--- a/src/chroot-tools/makechrootpkg.sh.patch
+++ b/src/chroot-tools/makechrootpkg.sh.patch
@@ -1,5 +1,5 @@
---- makechrootpkg.sh.in 2014-05-10 22:03:27.956692573 -0400
-+++ makechrootpkg.sh.ugly 2014-05-10 22:09:15.376594518 -0400
+--- makechrootpkg.sh.in 2014-11-05 23:52:13.770870816 -0500
++++ makechrootpkg.sh.ugly 2014-11-06 00:04:08.999835771 -0500
@@ -1,4 +1,6 @@
#!/bin/bash
+# License: GNU GPLv2
@@ -32,10 +32,10 @@
}
+parse_options_init() {
+ orig_argv=("$@")
+
while getopts 'hcur:I:l:nTD:d:' arg; do
- case "$arg" in
- h) usage ;;
-@@ -91,9 +96,6 @@
+@@ -93,9 +98,6 @@
[[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '%s'" "$passeddir"
[[ ! -d $chrootdir/root ]] && die "Missing chroot dir root directory. Try using: mkarchroot %s/root base-devel" "$chrootdir"
@@ -45,13 +45,13 @@
if [[ ${copy:0:1} = / ]]; then
copydir=$copy
else
-@@ -113,30 +115,48 @@
+@@ -115,30 +117,48 @@
esac
done
-if [[ -n $SUDO_USER ]]; then
+if [[ -n ${SUDO_USER:-} ]]; then
- USER_HOME=$(eval echo ~$SUDO_USER)
+ eval "USER_HOME=~$SUDO_USER"
else
USER_HOME=$HOME
fi
@@ -100,7 +100,7 @@
# Get a read lock on the root chroot to make
# sure we don't clone a half-updated chroot
slock 8 "$chrootdir/root.lock" "Locking clean chroot"
-@@ -157,14 +177,19 @@
+@@ -159,14 +179,19 @@
# Drop the read lock again
lock_close 8
@@ -123,7 +123,7 @@
if [[ "$chroottype" == btrfs ]] && ! mountpoint -q "$copydir"; then
btrfs subvolume delete "$copydir" >/dev/null ||
die "Unable to delete subvolume %s" "$copydir"
-@@ -179,9 +204,14 @@
+@@ -181,9 +206,14 @@
stat_done
}
@@ -138,7 +138,7 @@
for install_pkg in "${install_pkgs[@]}"; do
pkgname="${install_pkg##*/}"
cp "$install_pkg" "$copydir/$pkgname"
-@@ -194,11 +224,19 @@
+@@ -196,11 +226,19 @@
rm "$copydir/$pkgname"
done
@@ -160,9 +160,9 @@
$repack || rm -rf "$copydir/build"
mkdir -p "$copydir/build"
-@@ -237,12 +275,12 @@
-
- chown -R nobody "$copydir"/{build,pkgdest,srcpkgdest,logdest,srcdest,startdir}
+@@ -245,12 +283,12 @@
+ printf 'builduser:x:%d:100:builduser:/:/usr/bin/nologin\n' "$builduser_uid" >>"$copydir/etc/passwd"
+ chown -R "$builduser_uid" "$copydir"/{build,pkgdest,srcpkgdest,logdest,srcdest,startdir}
- if [[ -n $MAKEFLAGS ]]; then
+ if [[ -n ${MAKEFLAGS:-} ]]; then
@@ -175,8 +175,8 @@
sed -i '/^PACKAGER=/d' "$copydir/etc/makepkg.conf"
echo "PACKAGER='${PACKAGER}'" >> "$copydir/etc/makepkg.conf"
fi
-@@ -255,20 +293,38 @@
- chmod 440 "$copydir/etc/sudoers.d/nobody-pacman"
+@@ -263,8 +301,20 @@
+ chmod 440 "$copydir/etc/sudoers.d/builduser-pacman"
fi
+ if ! grep -q '^\[repo\]' "$copydir/etc/pacman.conf"; then
@@ -193,8 +193,10 @@
+ printf $'#!/bin/bash\n%s\n_chrootprepare "$@"' "$(declare -f _chrootprepare)" \
+ > "$copydir/chrootprepare"
+ chmod +x "$copydir/chrootprepare"
- printf $'#!/bin/bash\n%s\n_chrootbuild %q "$@"' "$(declare -f _chrootbuild)" \
- "$run_namcap" >"$copydir/chrootbuild"
+ {
+ printf '#!/bin/bash\n'
+ declare -f _chrootbuild
+@@ -285,13 +335,19 @@
chmod +x "$copydir/chrootbuild"
}
@@ -216,7 +218,7 @@
makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o
else
( export SRCDEST BUILDDIR="$builddir"
-@@ -278,10 +334,10 @@
+@@ -301,10 +357,10 @@
(( $? != 0 )) && die "Could not download sources."
# Clean up garbage from verifysource
@@ -228,8 +230,8 @@
+_chrootprepare() {
# This function isn't run in makechrootpkg,
# so no global variables
- local run_namcap="$1"; shift
-@@ -292,6 +348,7 @@
+
+@@ -313,6 +369,7 @@
shopt -s nullglob
# XXX: Workaround makepkg disliking read-only dirs
@@ -237,26 +239,19 @@
ln -sft /srcdest /srcdest_host/*
ln -sft /startdir /startdir_host/*
-@@ -317,11 +374,29 @@
-
- # Safety check
- if [[ ! -w PKGBUILD ]]; then
-+ # XXX: internationalize this message
- echo "Can't write to PKGBUILD!"
+@@ -342,15 +399,42 @@
exit 1
fi
-- sudo -u nobody makepkg "${makepkg_args[@]}" || exit 1
+- sudo -u builduser makepkg "$@"
+ # Sync deps now, as networking may be disabled during _chrootbuild
+ cp /repo/repo.db /var/lib/pacman/sync/repo.db
-+ sudo -u nobody makepkg "${makepkg_args[@]}" -o
++ sudo -u builduser makepkg "$@" -o
+}
+
+_chrootbuild() {
+ # This function isn't run in makechrootpkg,
+ # so no global variables
-+ local run_namcap="$1"; shift
-+ local makepkg_args=("$@")
+
+ . /etc/profile
+ export HOME=/build
@@ -264,12 +259,7 @@
+
+ cd /startdir
+
-+ sudo -u nobody makepkg "${makepkg_args[@]}" -e || exit 1
-
- if $run_namcap; then
- pacman -S --needed --noconfirm namcap
-@@ -334,12 +409,24 @@
- exit 0
++ sudo -u builduser makepkg "$@" -e
}
+# Usage: move_products $copydir $owner
@@ -293,7 +283,7 @@
for l in "$copydir"/logdest/*; do
[[ $l == */logpipe.* ]] && continue
chown "$src_owner" "$l"
-@@ -353,6 +440,10 @@
+@@ -364,6 +448,10 @@
}
# }}}
@@ -304,7 +294,7 @@
umask 0022
load_vars "$USER_HOME/.makepkg.conf"
-@@ -364,30 +455,45 @@
+@@ -375,30 +463,45 @@
[[ -d $SRCPKGDEST ]] || SRCPKGDEST=$PWD
[[ -d $LOGDEST ]] || LOGDEST=$PWD
@@ -356,7 +346,7 @@
if (( ret != 0 )); then
if $temp_chroot; then
-@@ -398,3 +504,4 @@
+@@ -409,3 +512,4 @@
else
true
fi