diff options
Diffstat (limited to 'src/chroot-tools')
-rw-r--r-- | src/chroot-tools/arch-nspawn.patch | 12 | ||||
-rw-r--r-- | src/chroot-tools/makechrootpkg.sh.patch | 68 | ||||
-rw-r--r-- | src/chroot-tools/mkarchroot.patch | 8 |
3 files changed, 39 insertions, 49 deletions
diff --git a/src/chroot-tools/arch-nspawn.patch b/src/chroot-tools/arch-nspawn.patch index 792b99f..3a48cdd 100644 --- a/src/chroot-tools/arch-nspawn.patch +++ b/src/chroot-tools/arch-nspawn.patch @@ -1,5 +1,5 @@ ---- arch-nspawn.in 2014-05-11 00:58:42.030932904 -0400 -+++ arch-nspawn.ugly 2014-05-11 22:33:47.186717386 -0400 +--- arch-nspawn.in 2014-11-05 18:57:12.495990013 -0500 ++++ arch-nspawn.ugly 2014-11-05 18:57:12.535989271 -0500 @@ -1,4 +1,6 @@ #!/bin/bash +# License: GNU GPLv2 @@ -7,13 +7,13 @@ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. -@@ -103,7 +105,8 @@ - machine_name="${machine_name#-}" - fi +@@ -96,7 +98,8 @@ + + eval $(grep '^CARCH=' "$working_dir/etc/makepkg.conf") -exec ${CARCH:+setarch "$CARCH"} systemd-nspawn -q \ +CHROOTARCH="$(. "$(librelib conf)"; get_var chroot CHROOTARCH "$CARCH")" +exec ${CHROOTARCH:+setarch "$CHROOTARCH"} systemd-nspawn -q \ -D "$working_dir" \ - --machine "$machine_name" \ + --register=no \ "${mount_args[@]}" \ 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 diff --git a/src/chroot-tools/mkarchroot.patch b/src/chroot-tools/mkarchroot.patch index 3c8137c..cb1acc2 100644 --- a/src/chroot-tools/mkarchroot.patch +++ b/src/chroot-tools/mkarchroot.patch @@ -1,5 +1,5 @@ ---- mkarchroot.in 2014-05-10 22:10:54.871326879 -0400 -+++ mkarchroot.ugly 2014-05-10 22:10:54.887993222 -0400 +--- mkarchroot.in 2014-11-05 18:57:12.175995949 -0500 ++++ mkarchroot.ugly 2014-11-05 18:57:12.209328664 -0500 @@ -1,4 +1,6 @@ #!/bin/bash +# License: GNU GPLv2 @@ -7,7 +7,7 @@ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. -@@ -66,6 +68,11 @@ +@@ -68,6 +70,11 @@ chmod 0755 "$working_dir" fi @@ -19,7 +19,7 @@ pacstrap -GMcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \ "${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages' -@@ -73,7 +80,7 @@ +@@ -75,7 +82,7 @@ echo 'LANG=C' > "$working_dir/etc/locale.conf" echo "$CHROOT_VERSION" > "$working_dir/.arch-chroot" |