diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | arch-nspawn.in | 3 | ||||
-rw-r--r-- | makechrootpkg.in | 42 |
3 files changed, 24 insertions, 23 deletions
@@ -1,4 +1,4 @@ -V=20170320 +V=20170911 PREFIX = /usr/local diff --git a/arch-nspawn.in b/arch-nspawn.in index 0d93b5d..a225c1a 100644 --- a/arch-nspawn.in +++ b/arch-nspawn.in @@ -117,6 +117,7 @@ esac exec ${CARCH:+setarch "$CARCH"} systemd-nspawn -q \ -D "$working_dir" \ - --register=no \ + -E "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin" \ + --register=no --keep-unit \ "${mount_args[@]}" \ "$@" diff --git a/makechrootpkg.in b/makechrootpkg.in index 83eb787..5511002 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -16,9 +16,9 @@ m4_include(lib/archroot.sh) shopt -s nullglob init_variables() { - default_makepkg_args=(-s --noconfirm -L --holdver) + default_makepkg_args=(--syncdeps --noconfirm --log --holdver --skipinteg) makepkg_args=("${default_makepkg_args[@]}") - repack=false + keepbuilddir=false update_first=false clean_first=false run_namcap=false @@ -178,17 +178,17 @@ install_packages() { return $ret } -# Usage: prepare_chroot $copydir $HOME $repack $run_namcap +# Usage: prepare_chroot $copydir $HOME $keepbuilddir $run_namcap # Globals: # - MAKEFLAGS # - PACKAGER prepare_chroot() { local copydir=$1 local USER_HOME=$2 - local repack=$3 + local keepbuilddir=$3 local run_namcap=$4 - $repack || rm -rf "$copydir/build" + $keepbuilddir || rm -rf "$copydir/build" local builduser_uid builduser_gid builduser_uid="${SUDO_UID:-$UID}" @@ -314,14 +314,9 @@ download_sources() { chmod 1777 "$builddir" # Ensure sources are downloaded - if [[ "$(id -u "$makepkg_user")" != 0 ]]; then - sudo -u "$makepkg_user" env SRCDEST="$SRCDEST" BUILDDIR="$builddir" \ - makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o || - die "Could not download sources." - else - error "Running makepkg as root is not allowed." - exit 1 - fi + sudo -u "$makepkg_user" env SRCDEST="$SRCDEST" BUILDDIR="$builddir" \ + makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o || + die "Could not download sources." # Clean up garbage from verifysource rm -rf "$builddir" @@ -377,7 +372,7 @@ main() { r) passeddir="$OPTARG" ;; I) install_pkgs+=("$OPTARG") ;; l) copy="$OPTARG" ;; - n) run_namcap=true; makepkg_args+=(-i) ;; + n) run_namcap=true; makepkg_args+=(--install) ;; T) temp_chroot=true; copy+="-$$" ;; U) makepkg_user="$OPTARG" ;; h|*) usage ;; @@ -404,13 +399,13 @@ main() { # Pass all arguments after -- right to makepkg makepkg_args+=("${@:$OPTIND}") - # See if -R was passed to makepkg - for arg in "${@:OPTIND}"; do + # See if -R or -e was passed to makepkg + for arg in "${makepkg_args[@]}"; do case ${arg%%=*} in - -*R*|--repackage) - repack=true - break 2 - ;; + --repackage|--noextract) keepbuilddir=true; break ;; + --repackage|--noextract) keepbuilddir=true; break ;; + --*) ;; + -*R*|-*e*) keepbuilddir=true; break ;; esac done @@ -449,9 +444,14 @@ main() { [[ -f PKGBUILD ]] || return $ret fi + if [[ "$(id -u "$makepkg_user")" == 0 ]]; then + error "Running makepkg as root is not allowed." + exit 1 + fi + download_sources "$copydir" "$makepkg_user" - prepare_chroot "$copydir" "$USER_HOME" "$repack" + prepare_chroot "$copydir" "$USER_HOME" "$keepbuilddir" if arch-nspawn "$copydir" \ --bind="$PWD:/startdir" \ |