summaryrefslogtreecommitdiff
path: root/src/chroot-tools
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-04-14 22:50:21 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-04-14 22:50:21 -0400
commitac02e8c43ff1fbaf1086d746a1a0a975c9218ef0 (patch)
treeefdc3c87acbc9e3db881c85b2a7d0c6d09465787 /src/chroot-tools
parenta68d0ebb827d3cf49a62694e5a62207900e6f3a4 (diff)
Print an error when trying to sync a copy with itself.
Fixes https://labs.parabola.nu/issues/920
Diffstat (limited to 'src/chroot-tools')
-rw-r--r--src/chroot-tools/makechrootpkg.sh.patch35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/chroot-tools/makechrootpkg.sh.patch b/src/chroot-tools/makechrootpkg.sh.patch
index dc37344..d5c6fca 100644
--- a/src/chroot-tools/makechrootpkg.sh.patch
+++ b/src/chroot-tools/makechrootpkg.sh.patch
@@ -1,5 +1,5 @@
---- makechrootpkg.sh.in 2015-06-06 21:29:29.470252931 -0400
-+++ makechrootpkg.sh.ugly 2016-02-04 22:30:13.682365085 -0500
+--- makechrootpkg.sh.in 2016-02-08 17:17:11.848386338 -0500
++++ makechrootpkg.sh.ugly 2016-04-14 22:01:05.923288181 -0400
@@ -1,4 +1,6 @@
#!/bin/bash
+# License: GNU GPLv2
@@ -27,7 +27,7 @@
usage() {
echo "Usage: ${0##*/} [options] -r <chrootdir> [--] [makepkg args]"
-@@ -68,28 +72,46 @@
+@@ -68,28 +72,51 @@
}
# {{{ functions
@@ -66,6 +66,11 @@
+ copydir="$chrootdir/$copy"
+ fi
+
++ if [[ "$chrootdir/root" -ef "$copydir" ]]; then
++ error 'Cannot sync copy with itself: %s' "$copydir"
++ return 1
++ fi
++
+ # Detect chrootdir filesystem type
+ local chroottype=$(stat -f -c %T "$chrootdir")
@@ -81,7 +86,7 @@
if [[ "$chroottype" == btrfs ]] && ! mountpoint -q "$copydir"; then
if [[ -d $copydir ]]; then
btrfs subvolume delete "$copydir" >/dev/null ||
-@@ -105,14 +127,18 @@
+@@ -105,14 +132,18 @@
# Drop the read lock again
lock_close 8
@@ -103,7 +108,7 @@
if [[ "$chroottype" == btrfs ]] && ! mountpoint -q "$copydir"; then
btrfs subvolume delete "$copydir" >/dev/null ||
die "Unable to delete subvolume %s" "$copydir"
-@@ -127,9 +153,14 @@
+@@ -127,9 +158,14 @@
stat_done
}
@@ -118,7 +123,7 @@
for install_pkg in "${install_pkgs[@]}"; do
pkgname="${install_pkg##*/}"
cp "$install_pkg" "$copydir/$pkgname"
-@@ -142,11 +173,19 @@
+@@ -142,11 +178,19 @@
rm "$copydir/$pkgname"
done
@@ -140,7 +145,7 @@
$repack || rm -rf "$copydir/build"
mkdir -p "$copydir/build"
-@@ -193,12 +232,12 @@
+@@ -193,12 +237,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}
@@ -155,7 +160,7 @@
sed -i '/^PACKAGER=/d' "$copydir/etc/makepkg.conf"
echo "PACKAGER='${PACKAGER}'" >> "$copydir/etc/makepkg.conf"
fi
-@@ -211,10 +250,25 @@
+@@ -211,10 +255,25 @@
chmod 440 "$copydir/etc/sudoers.d/builduser-pacman"
fi
@@ -181,7 +186,7 @@
declare -f _chrootbuild
printf '_chrootbuild "$@" || exit\n'
-@@ -231,13 +285,19 @@
+@@ -231,13 +290,19 @@
chmod +x "$copydir/chrootbuild"
}
@@ -203,7 +208,7 @@
makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o
else
( export SRCDEST BUILDDIR="$builddir"
-@@ -247,10 +307,10 @@
+@@ -247,10 +312,10 @@
(( $? != 0 )) && die "Could not download sources."
# Clean up garbage from verifysource
@@ -216,7 +221,7 @@
# This function isn't run in makechrootpkg,
# so no global variables
-@@ -259,6 +319,7 @@
+@@ -259,6 +324,7 @@
shopt -s nullglob
# XXX: Workaround makepkg disliking read-only dirs
@@ -224,7 +229,7 @@
ln -sft /srcdest /srcdest_host/*
ln -sft /startdir /startdir_host/*
-@@ -288,15 +349,42 @@
+@@ -288,15 +354,42 @@
exit 1
fi
@@ -268,7 +273,7 @@
for l in "$copydir"/logdest/*; do
[[ $l == */logpipe.* ]] && continue
chown "$src_owner" "$l"
-@@ -310,6 +398,9 @@
+@@ -310,6 +403,9 @@
}
# }}}
@@ -278,7 +283,7 @@
orig_argv=("$@")
while getopts 'hcur:I:l:nTD:d:' arg; do
-@@ -375,30 +466,45 @@
+@@ -375,30 +471,45 @@
[[ -d $SRCPKGDEST ]] || SRCPKGDEST=$PWD
[[ -d $LOGDEST ]] || LOGDEST=$PWD
@@ -330,7 +335,7 @@
if (( ret != 0 )); then
if $temp_chroot; then
-@@ -409,3 +515,4 @@
+@@ -409,3 +520,4 @@
else
true
fi