summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/chroot-tools/makechrootpkg.sh.patch56
1 files changed, 30 insertions, 26 deletions
diff --git a/src/chroot-tools/makechrootpkg.sh.patch b/src/chroot-tools/makechrootpkg.sh.patch
index 275b88a..fb2f2d0 100644
--- a/src/chroot-tools/makechrootpkg.sh.patch
+++ b/src/chroot-tools/makechrootpkg.sh.patch
@@ -1,5 +1,5 @@
---- makechrootpkg.sh.in 2013-09-12 10:02:36.000000000 -0400
-+++ makechrootpkg.sh.ugly 2013-09-14 13:51:51.000000000 -0400
+--- makechrootpkg.sh.in 2013-09-26 23:35:59.000000000 -0400
++++ makechrootpkg.sh.ugly 2013-09-26 23:33:45.000000000 -0400
@@ -12,6 +12,7 @@
shopt -s nullglob
@@ -8,8 +8,8 @@
_makepkg_args=(-s --noconfirm -L --holdver)
makepkg_args=("${_makepkg_args[@]}")
repack=false
-@@ -26,9 +27,10 @@
- declare -i ret=0
+@@ -29,9 +30,10 @@
+ bindmounts_rw=()
copy=$USER
-[[ -n $SUDO_USER ]] && copy=$SUDO_USER
@@ -20,15 +20,15 @@
usage() {
echo "Usage: ${0##*/} [options] -r <chrootdir> [--] [makepkg args]"
-@@ -62,6 +64,7 @@
+@@ -67,6 +69,7 @@
exit 1
}
+parse_options_init() {
- while getopts 'hcur:I:l:nT' arg; do
+ while getopts 'hcur:I:l:nTD:d:' arg; do
case "$arg" in
h) usage ;;
-@@ -86,9 +89,6 @@
+@@ -93,9 +96,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"
@@ -38,7 +38,7 @@
if [[ ${copy:0:1} = / ]]; then
copydir=$copy
else
-@@ -103,30 +103,47 @@
+@@ -110,30 +110,47 @@
repack=true
fi
@@ -92,7 +92,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"
-@@ -147,10 +164,15 @@
+@@ -154,10 +171,15 @@
# Drop the read lock again
lock_close 8
@@ -110,7 +110,7 @@
stat_busy "Removing temporary copy [%s]" "$copy"
if [[ "$chroottype" == btrfs ]]; then
btrfs subvolume delete "$copydir" >/dev/null ||
-@@ -166,9 +188,14 @@
+@@ -173,9 +195,14 @@
stat_done
}
@@ -125,7 +125,7 @@
for install_pkg in "${install_pkgs[@]}"; do
pkgname="${install_pkg##*/}"
cp "$install_pkg" "$copydir/$pkgname"
-@@ -179,11 +206,19 @@
+@@ -188,11 +215,19 @@
rm "$copydir/$pkgname"
done
@@ -147,7 +147,7 @@
$repack || rm -rf "$copydir/build"
mkdir -p "$copydir/build"
-@@ -217,12 +252,12 @@
+@@ -226,12 +261,12 @@
chown -R nobody "$copydir"/{build,pkgdest,logdest,srcdest,startdir}
@@ -162,7 +162,7 @@
sed -i '/^PACKAGER=/d' "$copydir/etc/makepkg.conf"
echo "PACKAGER='${PACKAGER}'" >> "$copydir/etc/makepkg.conf"
fi
-@@ -235,20 +270,37 @@
+@@ -244,20 +279,37 @@
chmod 440 "$copydir/etc/sudoers.d/nobody-pacman"
fi
@@ -203,7 +203,7 @@
makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o
else
( export SRCDEST BUILDDIR="$builddir"
-@@ -258,20 +310,15 @@
+@@ -267,20 +319,15 @@
(( $? != 0 )) && die "Could not download sources."
# Clean up garbage from verifysource
@@ -227,7 +227,7 @@
ln -sft /srcdest /srcdest_host/*
ln -sft /startdir /startdir_host/*
-@@ -286,15 +333,27 @@
+@@ -295,15 +342,27 @@
done
done
@@ -260,7 +260,7 @@
echo "Can't write to PKGBUILD!"
exit 1
fi
-@@ -312,12 +371,24 @@
+@@ -321,12 +380,24 @@
exit 0
}
@@ -285,7 +285,7 @@
for l in "$copydir"/logdest/*; do
chown "$src_owner" "$l"
mv "$l" "$LOGDEST"
-@@ -325,6 +396,10 @@
+@@ -334,6 +405,10 @@
}
# }}}
@@ -296,21 +296,25 @@
umask 0022
load_vars /etc/makepkg.conf
-@@ -335,27 +410,37 @@
+@@ -344,17 +419,25 @@
[[ -d $SRCDEST ]] || SRCDEST=$PWD
[[ -d $LOGDEST ]] || LOGDEST=$PWD
-create_chroot
+# Lock the chroot we want to use. We'll keep this lock until we exit.
+lock 9 "$copydir.lock" "Locking chroot copy [%s]" "$copy"
-+
+
+-$update_first && arch-nspawn "$copydir" \
+- "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
+- pacman -Syu --noconfirm
+if [[ ! -d $copydir ]] || $clean_first; then
+ sync_chroot "$chrootdir" "$copy"
+fi
- $update_first && arch-nspawn "$copydir" pacman -Syu --noconfirm
-
-[[ -n ${install_pkgs[*]} ]] && install_packages
++$update_first && arch-nspawn "$copydir" pacman -Syu --noconfirm
+
+-prepare_chroot
+if [[ -n ${install_pkgs[*]:-} ]]; then
+ install_packages "$copydir" "${install_pkgs[@]}"
+ ret=$?
@@ -318,15 +322,15 @@
+ [[ -f PKGBUILD ]] || exit $ret
+fi
--prepare_chroot
-+prepare_chroot "$copydir" "$USER_HOME" "$repack"
-
-download_sources
++prepare_chroot "$copydir" "$USER_HOME" "$repack"
++
+download_sources "$copydir" "$src_owner"
if arch-nspawn "$copydir" \
--bind-ro="$PWD:/startdir_host" \
- --bind-ro="$SRCDEST:/srcdest_host" \
+@@ -362,12 +445,12 @@
+ "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
/chrootbuild "${makepkg_args[@]}"
then
- move_products
@@ -340,7 +344,7 @@
if (( ret != 0 )); then
if $temp_chroot; then
-@@ -366,3 +451,4 @@
+@@ -378,3 +461,4 @@
else
true
fi