From f5663f08d44091ca16c7f53c492c2594202ba7e5 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 5 Jan 2014 16:52:57 -0500 Subject: update to the new devtools --- src/chroot-tools/makechrootpkg.sh.patch | 95 ++++++++++++++++----------------- 1 file changed, 45 insertions(+), 50 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/makechrootpkg.sh.patch b/src/chroot-tools/makechrootpkg.sh.patch index 4dd1146..672da83 100644 --- a/src/chroot-tools/makechrootpkg.sh.patch +++ b/src/chroot-tools/makechrootpkg.sh.patch @@ -1,5 +1,5 @@ ---- makechrootpkg.sh.in 2013-10-26 14:53:57.000000000 -0400 -+++ makechrootpkg.sh.ugly 2013-11-16 15:14:04.000000000 -0500 +--- makechrootpkg.sh.in 2014-01-05 00:02:08.650446097 -0500 ++++ makechrootpkg.sh.ugly 2014-01-05 00:20:01.914448010 -0500 @@ -12,6 +12,7 @@ shopt -s nullglob @@ -38,9 +38,9 @@ if [[ ${copy:0:1} = / ]]; then copydir=$copy else -@@ -110,30 +110,47 @@ - repack=true - fi +@@ -115,30 +115,48 @@ + esac + done -if [[ -n $SUDO_USER ]]; then +if [[ -n ${SUDO_USER:-} ]]; then @@ -54,8 +54,9 @@ +# Usage: load_vars $makepkg_conf +# Globals: +# - SRCDEST -+# - LOGDEST ++# - SRCPKGDEST +# - PKGDEST ++# - LOGDEST +# - MAKEFLAGS +# - PACKAGER load_vars() { @@ -63,7 +64,7 @@ [[ -f $makepkg_conf ]] || return 1 - for var in {SRC,PKG,LOG}DEST MAKEFLAGS PACKAGER; do + for var in {SRC,SRCPKG,PKG,LOG}DEST MAKEFLAGS PACKAGER; do - [[ -z ${!var} ]] && eval $(grep "^${var}=" "$makepkg_conf") + [[ -z ${!var:-} ]] && eval $(grep "^${var}=" "$makepkg_conf") done @@ -92,7 +93,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" -@@ -154,11 +171,16 @@ +@@ -159,11 +177,16 @@ # Drop the read lock again lock_close 8 @@ -112,7 +113,7 @@ if [[ "$chroottype" == btrfs ]]; then btrfs subvolume delete "$copydir" >/dev/null || die "Unable to delete subvolume %s" "$copydir" -@@ -173,9 +195,14 @@ +@@ -178,9 +201,14 @@ stat_done } @@ -127,7 +128,7 @@ for install_pkg in "${install_pkgs[@]}"; do pkgname="${install_pkg##*/}" cp "$install_pkg" "$copydir/$pkgname" -@@ -188,11 +215,19 @@ +@@ -193,11 +221,19 @@ rm "$copydir/$pkgname" done @@ -149,9 +150,9 @@ $repack || rm -rf "$copydir/build" mkdir -p "$copydir/build" -@@ -226,12 +261,12 @@ +@@ -236,12 +272,12 @@ - chown -R nobody "$copydir"/{build,pkgdest,logdest,srcdest,startdir} + chown -R nobody "$copydir"/{build,pkgdest,srcpkgdest,logdest,srcdest,startdir} - if [[ -n $MAKEFLAGS ]]; then + if [[ -n ${MAKEFLAGS:-} ]]; then @@ -164,7 +165,7 @@ sed -i '/^PACKAGER=/d' "$copydir/etc/makepkg.conf" echo "PACKAGER='${PACKAGER}'" >> "$copydir/etc/makepkg.conf" fi -@@ -244,20 +279,38 @@ +@@ -254,20 +290,38 @@ chmod 440 "$copydir/etc/sudoers.d/nobody-pacman" fi @@ -179,11 +180,10 @@ + # This is a little gross, but this way the script is recreated every time in the # working copy -- printf $'#!/bin/bash\n%s\n_chrootbuild %q "$@"' "$(declare -f _chrootbuild)" \ -+ printf '#!/bin/bash\n%s\n_chrootprepare "$@"' "$(declare -f _chrootprepare)" \ ++ 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)" \ + printf $'#!/bin/bash\n%s\n_chrootbuild %q "$@"' "$(declare -f _chrootbuild)" \ "$run_namcap" >"$copydir/chrootbuild" chmod +x "$copydir/chrootbuild" } @@ -206,7 +206,7 @@ makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o else ( export SRCDEST BUILDDIR="$builddir" -@@ -267,20 +320,15 @@ +@@ -277,20 +331,18 @@ (( $? != 0 )) && die "Could not download sources." # Clean up garbage from verifysource @@ -221,28 +221,19 @@ - local run_namcap="$1"; shift - local makepkg_args=("$@") - -- . /etc/profile -- export HOME=/build -- shopt -s nullglob + . /etc/profile + export HOME=/build + shopt -s nullglob # XXX: Workaround makepkg disliking read-only dirs + rm -rf -- /srcdest/* /startdir/* ln -sft /srcdest /srcdest_host/* ln -sft /startdir /startdir_host/* -@@ -295,15 +343,27 @@ - done - done - -- cd /startdir -- - # XXX: Keep PKGBUILD writable for pkgver() -- rm PKGBUILD* -- cp /startdir_host/PKGBUILD* . -- chown nobody PKGBUILD* -+ rm /startdir/PKGBUILD* -+ cp /startdir_host/PKGBUILD* /startdir -+ chown nobody /startdir/PKGBUILD* +@@ -313,9 +365,23 @@ + rm PKGBUILD* + cp /startdir_host/PKGBUILD* . + chown nobody PKGBUILD* +} + +_chrootbuild() { @@ -263,7 +254,7 @@ echo "Can't write to PKGBUILD!" exit 1 fi -@@ -321,12 +381,24 @@ +@@ -333,12 +399,24 @@ exit 0 } @@ -286,9 +277,9 @@ + local l for l in "$copydir"/logdest/*; do + [[ $l == */logpipe.* ]] && continue chown "$src_owner" "$l" - mv "$l" "$LOGDEST" -@@ -334,6 +406,10 @@ +@@ -352,6 +430,10 @@ } # }}} @@ -299,25 +290,23 @@ umask 0022 load_vars /etc/makepkg.conf -@@ -344,17 +420,25 @@ - [[ -d $SRCDEST ]] || SRCDEST=$PWD - [[ -d $LOGDEST ]] || LOGDEST=$PWD +@@ -363,30 +445,45 @@ + [[ -d $SRCPKGDEST ]] || SRCPKGDEST=$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 --[[ -n ${install_pkgs[*]} ]] && install_packages -+$update_first && arch-nspawn "$copydir" pacman -Syu --noconfirm + $update_first && arch-nspawn "$copydir" \ + "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \ + pacman -Syu --noconfirm --prepare_chroot +-[[ -n ${install_pkgs[*]} ]] && install_packages +if [[ -n ${install_pkgs[*]:-} ]]; then + install_packages "$copydir" "${install_pkgs[@]}" + ret=$? @@ -325,15 +314,21 @@ + [[ -f PKGBUILD ]] || exit $ret +fi --download_sources +-prepare_chroot +prepare_chroot "$copydir" "$USER_HOME" "$repack" -+ + +-download_sources +download_sources "$copydir" "$src_owner" if arch-nspawn "$copydir" \ --bind-ro="$PWD:/startdir_host" \ -@@ -362,12 +446,12 @@ + --bind-ro="$SRCDEST:/srcdest_host" \ "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \ ++ /chrootprepare && ++ arch-nspawn "$copydir" \ ++ --bind-ro="$PWD:/startdir_host" \ ++ --bind-ro="$SRCDEST:/srcdest_host" \ ++ "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \ /chrootbuild "${makepkg_args[@]}" then - move_products @@ -347,7 +342,7 @@ if (( ret != 0 )); then if $temp_chroot; then -@@ -378,3 +462,4 @@ +@@ -397,3 +494,4 @@ else true fi -- cgit v1.2.3-2-g168b From 257a3fbfc839be9d056b38b6a1110a1550253d79 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 5 Jan 2014 18:53:16 -0500 Subject: chroot-tools: make patch not reject new bugfix in devtools-par --- src/chroot-tools/makechrootpkg.sh.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/makechrootpkg.sh.patch b/src/chroot-tools/makechrootpkg.sh.patch index 672da83..d6c96f9 100644 --- a/src/chroot-tools/makechrootpkg.sh.patch +++ b/src/chroot-tools/makechrootpkg.sh.patch @@ -1,5 +1,5 @@ ---- makechrootpkg.sh.in 2014-01-05 00:02:08.650446097 -0500 -+++ makechrootpkg.sh.ugly 2014-01-05 00:20:01.914448010 -0500 +--- makechrootpkg.sh.in 2014-01-05 18:51:41.463720929 -0500 ++++ makechrootpkg.sh.ugly 2014-01-05 18:52:41.624501065 -0500 @@ -12,6 +12,7 @@ shopt -s nullglob @@ -110,7 +110,7 @@ + local chroottype=$(stat -f -c %T "$copydir") + + stat_busy "Removing chroot copy [%s]" "$copy" - if [[ "$chroottype" == btrfs ]]; then + if [[ "$chroottype" == btrfs ]] && ! mountpoint -q "$copydir"; then btrfs subvolume delete "$copydir" >/dev/null || die "Unable to delete subvolume %s" "$copydir" @@ -178,9 +201,14 @@ -- cgit v1.2.3-2-g168b From f9da2708dc3611473f2ffd17b525dc282726b75a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 18 Jan 2014 12:46:26 -0500 Subject: I went comma-happy when writing librechroot:usage() --- src/chroot-tools/librechroot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index 5e16587..1c8ec4c 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -96,9 +96,9 @@ usage() { printf ' rootdir : %s\n' "${rootdir:-$(_ 'ERROR')}" printf ' copydir : %s\n' "${copydir:-$(_ 'ERROR')}" echo - prose 'If the chroot, or copy does not exist, it will be created + prose 'If the chroot or copy does not exist, it will be created automatically. A chroot by default contains the packages in the - group "base-devel", and any packages named in $CHROOTEXTRAPKG. + group "base-devel" and any packages named in $CHROOTEXTRAPKG. Unless the `-C` or `-M` flags are used, the configuration files that this program installs are the stock versions supplied in the packages, not the versions from your host system. Other tools -- cgit v1.2.3-2-g168b From 27274846fa112b3309a5cebe6afa2753d641a992 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 18 Jan 2014 12:47:18 -0500 Subject: librechroot: fix comment --- src/chroot-tools/librechroot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index 1c8ec4c..64c3a46 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -151,7 +151,7 @@ readonly commands=( run enter clean-repo help ) -# set $rootdir and $copydir; blank them on error +# Print code to set $rootdir and $copydir; blank them on error calculate_directories() { # Don't assume that CHROOTDIR or CHROOT are set, # but assume that COPY is set. -- cgit v1.2.3-2-g168b From 0fd1e7b1333b8793c1cc448c2a00cb085544cc8c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 18 Jan 2014 20:30:08 -0500 Subject: libremakepkg: support -r and -w flags, same as librechroot Feature request: https://labs.parabola.nu/issues/458 --- src/chroot-tools/libremakepkg | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg index fc6418c..dbeeb81 100755 --- a/src/chroot-tools/libremakepkg +++ b/src/chroot-tools/libremakepkg @@ -148,8 +148,12 @@ usage() { the documentation there.' echo print 'Options:' + print ' %s options:' librechroot flag "-n <$(_ CHROOT)>" 'Name of the chroot to use' flag "-l <$(_ COPY)>" 'Name of, or absolute path to, the chroot copy to use' + flag "-w <$(_ 'PATH[:PATH]')>" 'Bind mount a file or directory, read/write' + flag "-r <$(_ 'PATH[:PATH]')>" 'Bind mount a file or directory, read-only' + print ' %s options:' libremakepkg flag '-N' "Don't disable networking during build() and package(). PLEASE don't use this unless you have a special reason, its use is a violation @@ -173,10 +177,14 @@ main() { local chroot='' # Parse command line options ########################################### - while getopts 'n:l:NRh' flag ; do + while getopts 'n:l:wrNRh' flag ; do case "${flag}" in - n) if $INCHROOT; then err_chflag "$flag"; else chroot=$OPTARG; fi;; - l) if $INCHROOT; then err_chflag "$flag"; else copy=$OPTARG; fi;; + n) if $INCHROOT; then err_chflag "$flag"; else + chroot=$OPTARG; fi;; + l) if $INCHROOT; then err_chflag "$flag"; else + copy=$OPTARG; fi;; + w|r) if $INCHROOT; then err_chflag "$flag"; else + librechroot_flags+=(-$flag "$OPTARG"); fi;; N) NONET=false;; R) repack=true; makepkg_args+=(-R);; h) usage; return 0;; @@ -226,7 +234,7 @@ main() { MAKEFLAGS="$(get_var makepkg MAKEFLAGS '')" PACKAGER="$(get_var makepkg PACKAGER '')" - librechroot_flags=( + librechroot_flags+=( -r "$PWD:/startdir_host" -r "$SRCDEST:/srcdest_host" -n "$CHROOT" -- cgit v1.2.3-2-g168b From 83a55baf27a6e6f3fa3e6772a6f1b63f4c5138d7 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 19 Jan 2014 10:00:18 -0500 Subject: libremakepkg: actually support SRCPKGDEST, document LOGDEST support --- src/chroot-tools/libremakepkg | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg index dbeeb81..dcc495c 100755 --- a/src/chroot-tools/libremakepkg +++ b/src/chroot-tools/libremakepkg @@ -33,7 +33,7 @@ umask 0022 readonly _indent="$(librelib chroot/indent)" readonly INCHROOT=$([[ -f /.arch-chroot ]] && echo true || echo false) NONET=true # can be changed with the -N flag -# {SRC,LOG,PKG}DEST set at runtime by makepkg.conf +# {PKG,SRC,SRCPKG,LOG}DEST set at runtime by makepkg.conf # MAKEFLAGS, PACKAGER set at runtime by makepkg.conf # LIBREUSER, LIBREHOME are set by conf.sh librechroot_flags=() @@ -132,7 +132,7 @@ usage() { prose 'If run from outside of a chroot, command will make the following configuration changes in the chroot:' bullet 'whatever changes `librechroot` makes.' - bullet 'set `PKGDEST` and `SRCDEST` in `/etc/makepkg.conf`' + bullet 'set `{PKG,SRC,SRCPKG,LOG}DEST` in `/etc/makepkg.conf`' bullet 'set `PACKAGER` in `/etc/makepkg.conf` to reflect the value outside of the chroot.' bullet '(maybe) delete `/build/.makepkg.conf`' @@ -227,10 +227,11 @@ main() { # Load makepkg configuration ########################################### # Note that all of these are globals - SRCDEST="$(get_var makepkg SRCDEST "$PWD")" PKGDEST="$(get_var makepkg PKGDEST "$PWD")" + SRCDEST="$(get_var makepkg SRCDEST "$PWD")" + SRCPKGDEST="$(get_var makepkg SRCPKGDEST "$PWD")" LOGDEST="$(get_var makepkg LOGDEST "$PWD")" - mkdir -p "$SRCDEST" "$PKGDEST" "$LOGDEST" + mkdir -p -- "$PKGDEST" "$SRCDEST" "$SRCPKGDEST" "$LOGDEST" MAKEFLAGS="$(get_var makepkg MAKEFLAGS '')" PACKAGER="$(get_var makepkg PACKAGER '')" -- cgit v1.2.3-2-g168b From 897a0084bdd96b06198e699f9851ce0b89de409d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 19 Jan 2014 10:45:19 -0500 Subject: libremakepkg: fix getopts string (I'm a dummy) --- src/chroot-tools/libremakepkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg index dcc495c..f2dc537 100755 --- a/src/chroot-tools/libremakepkg +++ b/src/chroot-tools/libremakepkg @@ -177,7 +177,7 @@ main() { local chroot='' # Parse command line options ########################################### - while getopts 'n:l:wrNRh' flag ; do + while getopts 'n:l:w:r:NRh' flag ; do case "${flag}" in n) if $INCHROOT; then err_chflag "$flag"; else chroot=$OPTARG; fi;; -- cgit v1.2.3-2-g168b From 0315f5fce3353ffb86009578f58e21583a37a826 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 19 Jan 2014 10:58:42 -0500 Subject: distcc-tool: get rid of string interpolation in usage() --- src/chroot-tools/distcc-tool | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/distcc-tool b/src/chroot-tools/distcc-tool index 7633029..7524e15 100755 --- a/src/chroot-tools/distcc-tool +++ b/src/chroot-tools/distcc-tool @@ -50,7 +50,7 @@ print() { } usage() { - print "Usage: $0 COMMAND [COMMAND-ARGS]" + print "Usage: %s COMMAND [COMMAND-ARGS]" "$0" print "Tool for using distcc within a networkless chroot" echo print "Commands:" -- cgit v1.2.3-2-g168b From ec4ae3a3f632979f446366067ba5a9738644bdc0 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 19 Jan 2014 11:00:09 -0500 Subject: distcc-tool: Fix quoting when embeddint a value in a string --- src/chroot-tools/distcc-tool | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/distcc-tool b/src/chroot-tools/distcc-tool index 7524e15..5d21a0a 100755 --- a/src/chroot-tools/distcc-tool +++ b/src/chroot-tools/distcc-tool @@ -32,6 +32,8 @@ if ! type gettext &>/dev/null; then gettext() { echo "$@"; } fi +q0="$(printf '%q' "$0")" # quoted $0 + panic() { echo "$(gettext 'panic: malformed call to internal function')" >&2 exit 1 @@ -50,7 +52,7 @@ print() { } usage() { - print "Usage: %s COMMAND [COMMAND-ARGS]" "$0" + print "Usage: %s COMMAND [COMMAND-ARGS]" "$q0" print "Tool for using distcc within a networkless chroot" echo print "Commands:" @@ -135,7 +137,7 @@ parse_DISTCC_HOSTS() { ;; # ZEROCONF +zeroconf) - error "%s does not support the +zeroconf option" "$0" + error "%s does not support the +zeroconf option" "$q0" exit 1 ;; # TCP_HOST or OLDSTYLE_TCP_HOST @@ -159,7 +161,7 @@ parse_DISTCC_HOSTS() { # set up port forwaring if $forward_ports; then - socat TCP-LISTEN:${newport},fork SYSTEM:"$0 client $HOSTID ${PORT:-3632}" & + socat TCP-LISTEN:${newport},fork SYSTEM:"$q0 client $HOSTID ${PORT:-3632}" & pids+=($!) fi @@ -222,8 +224,8 @@ odaemon() { local chrootpath=$1 umask 111 - socat UNIX-LISTEN:"$chrootpath/socket",fork SYSTEM:"$0 server" & - trap "kill -- $!; rm -f '$chrootpath/socket'" EXIT + socat UNIX-LISTEN:"$chrootpath/socket",fork SYSTEM:"$q0 server" & + trap "kill -- $!; rm -f -- $(printf '%q' "$chrootpath/socket")" EXIT wait } -- cgit v1.2.3-2-g168b From 25f149bfbf340c63bdae2a3156214be67814ec7a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 19 Jan 2014 14:53:29 -0500 Subject: distcc-tool: fix a typo in a comment --- src/chroot-tools/distcc-tool | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/distcc-tool b/src/chroot-tools/distcc-tool index 5d21a0a..29f0128 100755 --- a/src/chroot-tools/distcc-tool +++ b/src/chroot-tools/distcc-tool @@ -127,7 +127,7 @@ parse_DISTCC_HOSTS() { *@*) # SSH_HOST doesn't allow custom port numbers, and even if it # did, ssh would complain about MITM. Instead, we'll count on - # ssh ProxyCommand being configured to used `client`. + # ssh ProxyCommand being configured to use `client`. newhosts+=("$HOSTSPEC") ;; # GLOBAL_OPTION -- cgit v1.2.3-2-g168b From 8692458d65fc9ce559ad7cd254d7ed3b606da76e Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 19 Jan 2014 14:13:40 -0500 Subject: libremakepkg: (minor) refactor things to places that make a bit more sense --- src/chroot-tools/libremakepkg | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg index f2dc537..1db9f08 100755 --- a/src/chroot-tools/libremakepkg +++ b/src/chroot-tools/libremakepkg @@ -212,6 +212,15 @@ main() { fi unset chroot + # Load makepkg configuration ########################################### + # Note that all of these are globals + PKGDEST="$(get_var makepkg PKGDEST "$PWD")" + SRCDEST="$(get_var makepkg SRCDEST "$PWD")" + SRCPKGDEST="$(get_var makepkg SRCPKGDEST "$PWD")" + LOGDEST="$(get_var makepkg LOGDEST "$PWD")" + MAKEFLAGS="$(get_var makepkg MAKEFLAGS '')" + PACKAGER="$(get_var makepkg PACKAGER '')" + # Quick sanity check ################################################### if (( EUID )); then @@ -225,22 +234,8 @@ main() { exit 1 fi - # Load makepkg configuration ########################################### - # Note that all of these are globals - PKGDEST="$(get_var makepkg PKGDEST "$PWD")" - SRCDEST="$(get_var makepkg SRCDEST "$PWD")" - SRCPKGDEST="$(get_var makepkg SRCPKGDEST "$PWD")" - LOGDEST="$(get_var makepkg LOGDEST "$PWD")" + # Make sure that the various *DEST directories exist mkdir -p -- "$PKGDEST" "$SRCDEST" "$SRCPKGDEST" "$LOGDEST" - MAKEFLAGS="$(get_var makepkg MAKEFLAGS '')" - PACKAGER="$(get_var makepkg PACKAGER '')" - - librechroot_flags+=( - -r "$PWD:/startdir_host" - -r "$SRCDEST:/srcdest_host" - -n "$CHROOT" - -l "$copy" - ) # OK, we are starting now ############################################## @@ -248,6 +243,13 @@ main() { lock 9 "/build/.lock" \ "Waiting for existing lock on build directory to be released" else + librechroot_flags+=( + -r "$PWD:/startdir_host" + -r "$SRCDEST:/srcdest_host" + -n "$CHROOT" + -l "$copy" + ) + # Obtain a lock on the chroot lock 9 "$copydir.lock" \ "Waiting for existing lock on chroot copy to be released: [%s]" "$copy" -- cgit v1.2.3-2-g168b From b6e66bce4dadd1a5b9f74a456de3ef5575e648fa Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 19 Jan 2014 17:19:04 -0500 Subject: libremakepkg: Check the permissions of the bind-mounted directories --- src/chroot-tools/libremakepkg | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg index 1db9f08..96f86ab 100755 --- a/src/chroot-tools/libremakepkg +++ b/src/chroot-tools/libremakepkg @@ -54,6 +54,21 @@ indent() { "$_indent" ' | ' } +# Usage: _check_perms_dir $directory +# Make sure that $directory is readable and executable (searchable) by 'nobody' +check_directory_permissions() ( + local dir=$1 + # `cd` to the directory, then test `.`; that way if parent + # directories aren't readable, we aren't testing for that. We + # only need the last element in `$dir`. + cd "$dir" + if ! sudo -u nobody test -r . -a -x .; then + error "Directory '%s' must be readable by user 'nobody'" "$dir" + return 1 + fi + return 0 +) + # Usage: exit_copy $copydir $src_owner # End immediately, but copy log files out exit_copy() { @@ -236,6 +251,15 @@ main() { # Make sure that the various *DEST directories exist mkdir -p -- "$PKGDEST" "$SRCDEST" "$SRCPKGDEST" "$LOGDEST" + # Check the permissions for $startdir and $SRCDEST + ( + declare -i ret=0 + check_directory_permissions "$PWD" || ret=1 + if ! [[ "$PWD" -ef "$SRCDEST" ]]; then + check_directory_permissions "$SRCDEST" || ret=1 + fi + exit $ret + ) # OK, we are starting now ############################################## -- cgit v1.2.3-2-g168b From b129824bfc9c5c85cadf98dfb724405d63dfc6c3 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 20 Jan 2014 00:59:48 -0500 Subject: normalize to use >&2 instead of /dev/stderr --- src/chroot-tools/librechroot | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index 64c3a46..0f0ed10 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -223,19 +223,19 @@ main() { C|M) arch_nspawn_flags+=(-$opt "$OPTARG");; w) sysd_nspawn_flags+=("--bind=$OPTARG");; r) sysd_nspawn_flags+=("--bind-ro=$OPTARG");; - *) usage >/dev/stderr; return 1;; + *) usage >&2; return 1;; esac done shift $(($OPTIND - 1)) if [[ $# -lt 1 ]]; then error "Must specify a command" - usage >/dev/stderr + usage >&2 return 1 fi mode=$1 if ! in_array "$mode" "${commands[@]}"; then error "Unrecognized command: %s" "$mode" - usage >/dev/stderr + usage >&2 return 1 fi shift @@ -243,14 +243,14 @@ main() { noop|make|sync|delete|update|enter|clean-pkgs|clean-repo) if [[ $# -gt 0 ]]; then error 'Command `%s` does not take any arguments: %s' "$mode" "$*" - usage >/dev/stderr + usage >&2 return 1 fi :;; install-file) if [[ $# -lt 1 ]]; then error 'Command `%s` requires at least one file' "$mode" - usage >/dev/stderr + usage >&2 return 1 else local missing=() @@ -269,14 +269,14 @@ main() { install-name) if [[ $# -lt 1 ]]; then error 'Command `%s` requires at least one package name' "$mode" - usage >/dev/stderr + usage >&2 return 1 fi :;; run) if [[ $# -lt 1 ]]; then error 'Command `%s` requires at least one argument' "$mode" - usage >/dev/stderr + usage >&2 return 1 fi :;; -- cgit v1.2.3-2-g168b From ea11eca851e1b54e36d310f4d69e099f169191e8 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 2 Feb 2014 00:05:22 -0500 Subject: I forgot to bump the copyright year on all the files I've touched this year --- src/chroot-tools/distcc-tool | 2 +- src/chroot-tools/librechroot | 2 +- src/chroot-tools/libremakepkg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/distcc-tool b/src/chroot-tools/distcc-tool index 29f0128..e114d11 100755 --- a/src/chroot-tools/distcc-tool +++ b/src/chroot-tools/distcc-tool @@ -2,7 +2,7 @@ # -*- tab-width: 4; sh-basic-offset: 4 -*- # distcc-tool -# Copyright 2013 Luke Shumaker +# Copyright 2013-2014 Luke Shumaker # # This file is part of Parabola. # diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index 0f0ed10..73fb6b7 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -4,7 +4,7 @@ set -euE # Copyright 2010 Nicolás Reynolds # Copyright 2011 Joshua Haase -# Copyright 2012-2013 Luke Shumaker +# Copyright 2012-2014 Luke Shumaker # # This file is part of Parabola. # diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg index 96f86ab..c838288 100755 --- a/src/chroot-tools/libremakepkg +++ b/src/chroot-tools/libremakepkg @@ -4,7 +4,7 @@ set -euE # Copyright 2010-2011 Nicolás Reynolds # Copyright 2011 Joshua Ismael Haase Hernández -# Copyright 2012-2013 Luke Shumaker +# Copyright 2012-2014 Luke Shumaker # # This file is part of Parabola. # -- cgit v1.2.3-2-g168b From c43f0808583070a22e904cd650e8ed17fe781806 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 2 Feb 2014 00:20:19 -0500 Subject: Normalize to use the string "Copyright (C)" --- src/chroot-tools/chcleanup | 2 +- src/chroot-tools/distcc-tool | 2 +- src/chroot-tools/librechroot | 6 +++--- src/chroot-tools/libremakepkg | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/chcleanup b/src/chroot-tools/chcleanup index 2ff45f9..9ad121e 100755 --- a/src/chroot-tools/chcleanup +++ b/src/chroot-tools/chcleanup @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eE -# (c) Nicolás Reynolds +# Copyright (C) Nicolás Reynolds # Released under GPLv3 # # Performs chroot cleanup smartly, it only removes the unneeded packages or diff --git a/src/chroot-tools/distcc-tool b/src/chroot-tools/distcc-tool index e114d11..9f78ead 100755 --- a/src/chroot-tools/distcc-tool +++ b/src/chroot-tools/distcc-tool @@ -2,7 +2,7 @@ # -*- tab-width: 4; sh-basic-offset: 4 -*- # distcc-tool -# Copyright 2013-2014 Luke Shumaker +# Copyright (C) 2013-2014 Luke Shumaker # # This file is part of Parabola. # diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index 73fb6b7..7b1e4a9 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -2,9 +2,9 @@ set -euE # librechroot -# Copyright 2010 Nicolás Reynolds -# Copyright 2011 Joshua Haase -# Copyright 2012-2014 Luke Shumaker +# Copyright (C) 2010 Nicolás Reynolds +# Copyright (C) 2011 Joshua Haase +# Copyright (C) 2012-2014 Luke Shumaker # # This file is part of Parabola. # diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg index c838288..d6db0fd 100755 --- a/src/chroot-tools/libremakepkg +++ b/src/chroot-tools/libremakepkg @@ -2,9 +2,9 @@ set -euE # libremakepkg -# Copyright 2010-2011 Nicolás Reynolds -# Copyright 2011 Joshua Ismael Haase Hernández -# Copyright 2012-2014 Luke Shumaker +# Copyright (C) 2010-2011 Nicolás Reynolds +# Copyright (C) 2011 Joshua Ismael Haase Hernández +# Copyright (C) 2012-2014 Luke Shumaker # # This file is part of Parabola. # -- cgit v1.2.3-2-g168b From 3f0dede97ee6c75c32cefd283eb65be782e4b84b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 2 Feb 2014 01:48:25 -0500 Subject: librechroot: fix setting CHROOTEXTRAPKG --- src/chroot-tools/librechroot | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index 7b1e4a9..fcabcff 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -342,10 +342,12 @@ main() { mkdir -p "$copydir/etc/libretools.d" { - if [[ -n ${CHROOTEXTRAPKG[*]:-} ]]; then - declare -p CHROOTEXTRAPKG | sed -r 's/declare( -.)* //' + if [[ ${#CHROOTEXTRAPKG[*]} -eq 0 ]]; then + echo 'CHROOTEXTRAPKG=()' else - printf 'CHROOTEXTRAPKG=()\n' + printf 'CHROOTEXTRAPKG=(' + printf '%q ' "${CHROOTEXTRAPKG[@]}" + printf ')\n' fi } > "$copydir"/etc/libretools.d/chroot.conf -- cgit v1.2.3-2-g168b From d7dcce53396d32c090e1e175c9c606a78f5cb3d6 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 2 Feb 2014 20:18:20 -0500 Subject: mkarchroot: don't let the environment affect pacstrap --- src/chroot-tools/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/Makefile b/src/chroot-tools/Makefile index d08775e..4ecff51 100644 --- a/src/chroot-tools/Makefile +++ b/src/chroot-tools/Makefile @@ -34,7 +34,7 @@ makechrootpkg.sh: %: %.ugly Makefile mkarchroot: mkarchroot.in Makefile @echo '< $< M4_EDIT | SED > $@' - @<'$<' $(edit) | sed 's|arch-nspawn|$$(librelib chroot/&)|' >'$@' || { rm -f -- '$@'; false; } + @<'$<' $(edit) | sed -e 's|arch-nspawn|$$(librelib chroot/&)|' -e 's/pacstrap/env -i &/' >'$@' || { rm -f -- '$@'; false; } @echo 'CHMOD $<'; chmod 755 "$@" || { rm -f -- '$@'; false; } archroot: %: %.in Makefile -- cgit v1.2.3-2-g168b From 804e5e1093c3aa8258bf9f8c97ff661cdf8407f1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 2 Feb 2014 20:22:24 -0500 Subject: Makefiles: use .DELETE_ON_ERROR: --- src/chroot-tools/Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/Makefile b/src/chroot-tools/Makefile index 4ecff51..97ca688 100644 --- a/src/chroot-tools/Makefile +++ b/src/chroot-tools/Makefile @@ -27,19 +27,19 @@ makechrootpkg.sh.in: %.sh.in: $(devtoolsdir)/%.in cp $< $@ makechrootpkg.sh.ugly: %.ugly: %.in %.patch Makefile cp $*.in $@ - @echo 'PATCH $@ $*.patch'; patch $@ $*.patch || { rm -f -- '$@'; false; } + @echo 'PATCH $@ $*.patch'; patch $@ $*.patch makechrootpkg.sh: %: %.ugly Makefile - @echo 'EDIT < $< > $@'; $(edit) <'$<' >'$@' || { rm -f -- '$@'; false; } - @echo 'INDENT $@'; $(call indent,$@) || { rm -f -- '$@'; false; } + @echo 'EDIT < $< > $@'; $(edit) <'$<' >'$@' + @echo 'INDENT $@'; $(call indent,$@) mkarchroot: mkarchroot.in Makefile @echo '< $< M4_EDIT | SED > $@' - @<'$<' $(edit) | sed -e 's|arch-nspawn|$$(librelib chroot/&)|' -e 's/pacstrap/env -i &/' >'$@' || { rm -f -- '$@'; false; } - @echo 'CHMOD $<'; chmod 755 "$@" || { rm -f -- '$@'; false; } + @<'$<' $(edit) | sed -e 's|arch-nspawn|$$(librelib chroot/&)|' -e 's/pacstrap/env -i &/' >'$@' + @echo 'CHMOD $<'; chmod 755 "$@" archroot: %: %.in Makefile @echo "GEN $@" - @$(edit) <"$<" >"$@" || { rm -f -- '$@'; false; } - @chmod 755 "$@" || { rm -f -- '$@'; false; } + @$(edit) <"$<" >"$@" + @chmod 755 "$@" distcc-tool.pot: xgettext-keywords-sh+=--keyword=errusage -- cgit v1.2.3-2-g168b From 9f28b8f1d7ecc211e4df9f4a16a04960ed1bd582 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 2 Feb 2014 22:34:00 -0500 Subject: libremakepkg: fix network handling --- src/chroot-tools/libremakepkg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg index d6db0fd..a459009 100755 --- a/src/chroot-tools/libremakepkg +++ b/src/chroot-tools/libremakepkg @@ -121,14 +121,14 @@ build() ( local copydir=$1; shift local repack=$1; shift - local netflag='' local run=() if $INCHROOT; then - ! $NONET || netflag='-N' run=(unshare) + if $NONET; then run+=('-n'); fi else - ! $NONET || netflag='-n' - run=(librechroot "${librechroot_flags[@]}" run) + run=(librechroot "${librechroot_flags[@]}") + if $NONET; then run+=('-N'); fi + run+=(run) fi prepare_chroot "$copydir" "$LIBREHOME" "$repack" false -- cgit v1.2.3-2-g168b From 965371ef3f70120555d957a0d0703016f8df8307 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 5 Feb 2014 16:01:51 -0500 Subject: librechroot update: correctly handle 'filesystem' upgrades --- src/chroot-tools/librechroot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index fcabcff..dcf8488 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -381,7 +381,7 @@ main() { arch-nspawn "$copydir" pacman -Sy "$@" ;; update) - arch-nspawn "$copydir" pacman -Syu --noconfirm + arch-nspawn "$copydir" bash -c 'pacman -Syw --noconfirm && umount /etc/resolv.conf && pacman -Su --noconfirm' ;; clean-pkgs) trap "rm -f '$copydir'/bin/chcleanup '$copydir'/chrootexec" EXIT -- cgit v1.2.3-2-g168b From c55053b00f34a90e27dff3d92ae6bbcdac0edaf4 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 5 Feb 2014 19:38:24 -0500 Subject: libremakepkg: fix installing dependencies that aren't in the paccache I can't figure out a reliable way to test this, as it depends on the host pacman cache. --- src/chroot-tools/libremakepkg | 17 +++++++++-------- src/chroot-tools/makechrootpkg.sh.patch | 27 +++++++++++++-------------- 2 files changed, 22 insertions(+), 22 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg index a459009..26080bc 100755 --- a/src/chroot-tools/libremakepkg +++ b/src/chroot-tools/libremakepkg @@ -121,21 +121,22 @@ build() ( local copydir=$1; shift local repack=$1; shift - local run=() + local run_ynet=() + local run_nnet=() if $INCHROOT; then - run=(unshare) - if $NONET; then run+=('-n'); fi + run_ynet=(unshare) + run_nnet=(unshare -n) else - run=(librechroot "${librechroot_flags[@]}") - if $NONET; then run+=('-N'); fi - run+=(run) + run_ynet=(librechroot "${librechroot_flags[@]}" run) + run_nnet=(librechroot "${librechroot_flags[@]}" -N run) fi + $NONET || run_nnet=("${run_ynet[@]}") prepare_chroot "$copydir" "$LIBREHOME" "$repack" false - "${run[@]}" /chrootprepare "$@" |& indent + "${run_ynet[@]}" /chrootprepare false "$@" |& indent run_hook pre_build "$copydir" trap "run_hook post_build '$copydir'" EXIT - "${run[@]}" /chrootbuild "$@" |& indent + "${run_nnet[@]}" /chrootbuild false "$@" |& indent ) # The main program ############################################################# diff --git a/src/chroot-tools/makechrootpkg.sh.patch b/src/chroot-tools/makechrootpkg.sh.patch index d6c96f9..817eaa5 100644 --- a/src/chroot-tools/makechrootpkg.sh.patch +++ b/src/chroot-tools/makechrootpkg.sh.patch @@ -1,5 +1,5 @@ --- makechrootpkg.sh.in 2014-01-05 18:51:41.463720929 -0500 -+++ makechrootpkg.sh.ugly 2014-01-05 18:52:41.624501065 -0500 ++++ makechrootpkg.sh.ugly 2014-02-05 19:01:17.583560384 -0500 @@ -12,6 +12,7 @@ shopt -s nullglob @@ -206,7 +206,7 @@ makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o else ( export SRCDEST BUILDDIR="$builddir" -@@ -277,20 +331,18 @@ +@@ -277,10 +331,10 @@ (( $? != 0 )) && die "Could not download sources." # Clean up garbage from verifysource @@ -218,11 +218,8 @@ +_chrootprepare() { # This function isn't run in makechrootpkg, # so no global variables -- local run_namcap="$1"; shift -- local makepkg_args=("$@") -- - . /etc/profile - export HOME=/build + local run_namcap="$1"; shift +@@ -291,6 +345,7 @@ shopt -s nullglob # XXX: Workaround makepkg disliking read-only dirs @@ -230,10 +227,12 @@ ln -sft /srcdest /srcdest_host/* ln -sft /startdir /startdir_host/* -@@ -313,9 +365,23 @@ - rm PKGBUILD* +@@ -314,8 +369,25 @@ cp /startdir_host/PKGBUILD* . chown nobody PKGBUILD* + ++ # Sync deps now, as networking may be disabled during _chrootbuild ++ sudo -u nobody makepkg "${makepkg_args[@]}" -eo +} + +_chrootbuild() { @@ -247,14 +246,14 @@ + shopt -s nullglob + + cd /startdir - ++ # Safety check if [[ ! -w PKGBUILD ]]; then + # XXX: internationalize this message echo "Can't write to PKGBUILD!" exit 1 fi -@@ -333,12 +399,24 @@ +@@ -333,12 +405,24 @@ exit 0 } @@ -279,7 +278,7 @@ for l in "$copydir"/logdest/*; do [[ $l == */logpipe.* ]] && continue chown "$src_owner" "$l" -@@ -352,6 +430,10 @@ +@@ -352,6 +436,10 @@ } # }}} @@ -290,7 +289,7 @@ umask 0022 load_vars /etc/makepkg.conf -@@ -363,30 +445,45 @@ +@@ -363,30 +451,45 @@ [[ -d $SRCPKGDEST ]] || SRCPKGDEST=$PWD [[ -d $LOGDEST ]] || LOGDEST=$PWD @@ -342,7 +341,7 @@ if (( ret != 0 )); then if $temp_chroot; then -@@ -397,3 +494,4 @@ +@@ -397,3 +500,4 @@ else true fi -- cgit v1.2.3-2-g168b From 93276b1059c6bce3aa6e400f70160b8b89cab007 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 5 Feb 2014 20:05:13 -0500 Subject: libremakepkg: make sure the local repository exists before syncing pkgs --- src/chroot-tools/makechrootpkg.sh.patch | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/makechrootpkg.sh.patch b/src/chroot-tools/makechrootpkg.sh.patch index 817eaa5..8c42089 100644 --- a/src/chroot-tools/makechrootpkg.sh.patch +++ b/src/chroot-tools/makechrootpkg.sh.patch @@ -1,5 +1,5 @@ --- makechrootpkg.sh.in 2014-01-05 18:51:41.463720929 -0500 -+++ makechrootpkg.sh.ugly 2014-02-05 19:01:17.583560384 -0500 ++++ makechrootpkg.sh.ugly 2014-02-05 19:59:10.991879605 -0500 @@ -12,6 +12,7 @@ shopt -s nullglob @@ -227,11 +227,12 @@ ln -sft /srcdest /srcdest_host/* ln -sft /startdir /startdir_host/* -@@ -314,8 +369,25 @@ +@@ -314,8 +369,26 @@ cp /startdir_host/PKGBUILD* . chown nobody PKGBUILD* + # 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[@]}" -eo +} + @@ -253,7 +254,7 @@ echo "Can't write to PKGBUILD!" exit 1 fi -@@ -333,12 +405,24 @@ +@@ -333,12 +406,24 @@ exit 0 } @@ -278,7 +279,7 @@ for l in "$copydir"/logdest/*; do [[ $l == */logpipe.* ]] && continue chown "$src_owner" "$l" -@@ -352,6 +436,10 @@ +@@ -352,6 +437,10 @@ } # }}} @@ -289,7 +290,7 @@ umask 0022 load_vars /etc/makepkg.conf -@@ -363,30 +451,45 @@ +@@ -363,30 +452,45 @@ [[ -d $SRCPKGDEST ]] || SRCPKGDEST=$PWD [[ -d $LOGDEST ]] || LOGDEST=$PWD @@ -341,7 +342,7 @@ if (( ret != 0 )); then if $temp_chroot; then -@@ -397,3 +500,4 @@ +@@ -397,3 +501,4 @@ else true fi -- cgit v1.2.3-2-g168b From dd8c9b738c811a03c5e9ccd57ec73beccc5c1eeb Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 9 Feb 2014 20:10:01 -0500 Subject: fix `librechroot update` --- src/chroot-tools/librechroot | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index dcf8488..051148d 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -381,7 +381,9 @@ main() { arch-nspawn "$copydir" pacman -Sy "$@" ;; update) - arch-nspawn "$copydir" bash -c 'pacman -Syw --noconfirm && umount /etc/resolv.conf && pacman -Su --noconfirm' + # umount resolv.conf so that it can be upgraded, if nescessary + # this disables DNS, so fetch everything first + arch-nspawn "$copydir" bash -c 'pacman -Syuw --noconfirm && umount /etc/resolv.conf && pacman -Su --noconfirm' ;; clean-pkgs) trap "rm -f '$copydir'/bin/chcleanup '$copydir'/chrootexec" EXIT -- cgit v1.2.3-2-g168b From 5065c3b8cda743decc6d1c8bf963640a7ed49018 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 9 Feb 2014 20:22:38 -0500 Subject: libremakepkg: extract the source (prepare()) while the network is still on --- src/chroot-tools/makechrootpkg.sh.patch | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/makechrootpkg.sh.patch b/src/chroot-tools/makechrootpkg.sh.patch index 8c42089..540e6ba 100644 --- a/src/chroot-tools/makechrootpkg.sh.patch +++ b/src/chroot-tools/makechrootpkg.sh.patch @@ -1,5 +1,5 @@ --- makechrootpkg.sh.in 2014-01-05 18:51:41.463720929 -0500 -+++ makechrootpkg.sh.ugly 2014-02-05 19:59:10.991879605 -0500 ++++ makechrootpkg.sh.ugly 2014-02-09 20:20:25.021630727 -0500 @@ -12,6 +12,7 @@ shopt -s nullglob @@ -227,13 +227,19 @@ ln -sft /srcdest /srcdest_host/* ln -sft /startdir /startdir_host/* -@@ -314,8 +369,26 @@ - cp /startdir_host/PKGBUILD* . - chown nobody PKGBUILD* +@@ -316,11 +371,29 @@ + # Safety check + if [[ ! -w PKGBUILD ]]; then ++ # XXX: internationalize this message + echo "Can't write to PKGBUILD!" + exit 1 + fi + +- sudo -u nobody makepkg "${makepkg_args[@]}" || exit 1 + # 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[@]}" -eo ++ sudo -u nobody makepkg "${makepkg_args[@]}" -o +} + +_chrootbuild() { @@ -248,12 +254,10 @@ + + cd /startdir + - # Safety check - if [[ ! -w PKGBUILD ]]; then -+ # XXX: internationalize this message - echo "Can't write to PKGBUILD!" - exit 1 - fi ++ sudo -u nobody makepkg "${makepkg_args[@]}" -e || exit 1 + + if $run_namcap; then + pacman -S --needed --noconfirm namcap @@ -333,12 +406,24 @@ exit 0 } -- cgit v1.2.3-2-g168b From 8cbd5fc2e616785d97e84f7e17b845b74a6ccfd1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 6 Mar 2014 12:16:33 -0500 Subject: Update for the new version of systemd --- src/chroot-tools/indent | 4 +--- src/chroot-tools/librechroot | 22 ++-------------------- 2 files changed, 3 insertions(+), 23 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/indent b/src/chroot-tools/indent index 0e2d0e0..5a7f654 100755 --- a/src/chroot-tools/indent +++ b/src/chroot-tools/indent @@ -19,9 +19,7 @@ while (1) { $c = substr($buffer, $_, 1); if ($c eq "\n") { syswrite(STDOUT, $indent) if ($print_indent); - # XXX: SYSTEMD-STDOUT HACK - #syswrite(STDOUT, $c, 1); - syswrite(STDOUT, "\r\n", 2); + syswrite(STDOUT, $c, 1); $print_indent = 1; } elsif ($c eq "\r") { syswrite(STDOUT, $c, 1); diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index 051148d..f449f0d 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -186,23 +186,7 @@ arch_nspawn_flags=() sysd_nspawn_flags=() arch-nspawn() { local copydir=$1; shift - # XXX: SYSTEMD-STDOUT HACK - if [[ -t 1 ]]; then - cmd=("$@") - else - # This perl script is similar to `sed 's|\n|\r\n|g'`, (or, more - # correctly, `sed 's|$|\r|'`) but it does't line-buffer. - local perlcmd=' -my $size; -my $buffer; -while(1) { - $size=sysread(STDIN, $buffer, 40); - last if ($size < 1); - $buffer =~ s/\n/\r\n/g; - syswrite(STDOUT, $buffer); -}' - cmd=(bash --noprofile --norc -c "set -o pipefail; $(printf '%q ' "$@") |& perl -e $(printf '%q' "$perlcmd")") - fi + local cmd=("$@") set +u # if an array is empty, it counts as unbound "$_arch_nspawn" "${arch_nspawn_flags[@]}" "$copydir" "${sysd_nspawn_flags[@]}" -- "${cmd[@]}" @@ -381,9 +365,7 @@ main() { arch-nspawn "$copydir" pacman -Sy "$@" ;; update) - # umount resolv.conf so that it can be upgraded, if nescessary - # this disables DNS, so fetch everything first - arch-nspawn "$copydir" bash -c 'pacman -Syuw --noconfirm && umount /etc/resolv.conf && pacman -Su --noconfirm' + arch-nspawn "$copydir" bash -c 'pacman -Syu --noconfirm' ;; clean-pkgs) trap "rm -f '$copydir'/bin/chcleanup '$copydir'/chrootexec" EXIT -- cgit v1.2.3-2-g168b From 089c60a05e95bee1ab3c506069f8e0e75eb43657 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 20 Mar 2014 16:27:41 -0400 Subject: Generalize the patching mechanism in the build system. --- src/chroot-tools/.gitignore | 3 +-- src/chroot-tools/Makefile | 24 +----------------------- 2 files changed, 2 insertions(+), 25 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/.gitignore b/src/chroot-tools/.gitignore index 80e1000..3f46ed2 100644 --- a/src/chroot-tools/.gitignore +++ b/src/chroot-tools/.gitignore @@ -1,5 +1,4 @@ makechrootpkg.sh* -!makechrootpkg.sh.patch - arch-nspawn* mkarchroot* +!*.patch diff --git a/src/chroot-tools/Makefile b/src/chroot-tools/Makefile index 97ca688..c49c4ac 100644 --- a/src/chroot-tools/Makefile +++ b/src/chroot-tools/Makefile @@ -9,37 +9,15 @@ libs = makechrootpkg.sh $(wildcard hooks-*.sh) pots = $(libexecs) $(libs) pkglibexecdir = $(libexecdir)/libretools/chroot -clean_files = makechrootpkg.sh.ugly* *~ include ../../common.mk -# Usage: $(call indent,FILENAME) -# Command to auto-indent a file. -indent = emacs --batch $1 \ - --eval '(setq sh-basic-offset 8)' \ - --eval '(indent-region (point-min) (point-max) nil)' \ - -f save-buffer &>/dev/null - -# makechrootpkg.sh is special, we patch it and do fancy stuff -# The flow is: -# $(devtoolsdir)/*.in -> *.sh.in + *.sh.patch -> *.sh.ugly -> *.sh - +# makechrootpkg.sh is created from a command, not a library makechrootpkg.sh.in: %.sh.in: $(devtoolsdir)/%.in cp $< $@ -makechrootpkg.sh.ugly: %.ugly: %.in %.patch Makefile - cp $*.in $@ - @echo 'PATCH $@ $*.patch'; patch $@ $*.patch -makechrootpkg.sh: %: %.ugly Makefile - @echo 'EDIT < $< > $@'; $(edit) <'$<' >'$@' - @echo 'INDENT $@'; $(call indent,$@) mkarchroot: mkarchroot.in Makefile @echo '< $< M4_EDIT | SED > $@' @<'$<' $(edit) | sed -e 's|arch-nspawn|$$(librelib chroot/&)|' -e 's/pacstrap/env -i &/' >'$@' @echo 'CHMOD $<'; chmod 755 "$@" -archroot: %: %.in Makefile - @echo "GEN $@" - @$(edit) <"$<" >"$@" - @chmod 755 "$@" - distcc-tool.pot: xgettext-keywords-sh+=--keyword=errusage -- cgit v1.2.3-2-g168b From d17d1d82349f7f4cb60574f7d9c2f786eec3cc93 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 20 Mar 2014 17:16:36 -0400 Subject: Fix issue #487; obey proxy settings when creating a chroot. https://labs.parabola.nu/issues/487 --- src/chroot-tools/Makefile | 5 ----- src/chroot-tools/mkarchroot.patch | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 src/chroot-tools/mkarchroot.patch (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/Makefile b/src/chroot-tools/Makefile index c49c4ac..e44ad5f 100644 --- a/src/chroot-tools/Makefile +++ b/src/chroot-tools/Makefile @@ -15,9 +15,4 @@ include ../../common.mk makechrootpkg.sh.in: %.sh.in: $(devtoolsdir)/%.in cp $< $@ -mkarchroot: mkarchroot.in Makefile - @echo '< $< M4_EDIT | SED > $@' - @<'$<' $(edit) | sed -e 's|arch-nspawn|$$(librelib chroot/&)|' -e 's/pacstrap/env -i &/' >'$@' - @echo 'CHMOD $<'; chmod 755 "$@" - distcc-tool.pot: xgettext-keywords-sh+=--keyword=errusage diff --git a/src/chroot-tools/mkarchroot.patch b/src/chroot-tools/mkarchroot.patch new file mode 100644 index 0000000..a0ea0f0 --- /dev/null +++ b/src/chroot-tools/mkarchroot.patch @@ -0,0 +1,23 @@ +--- mkarchroot.in 2014-01-05 18:51:15.231500986 -0500 ++++ mkarchroot 2014-03-20 15:05:06.885086610 -0400 +@@ -65,6 +65,11 @@ + chmod 0755 "$working_dir" + fi + ++_env=() ++while read -r varname; do ++ _env+=("$varname=${!varname}") ++done < { declare -x | sed -r 's/^declare -x ([^=]*)=.*/\1/' | grep -i '_proxy$'; } ++env -i "${_env[@]}" \ + pacstrap -GMcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \ + "${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages' + +@@ -72,7 +77,7 @@ + echo 'LANG=C' > "$working_dir/etc/locale.conf" + echo "$CHROOT_VERSION" > "$working_dir/.arch-chroot" + +-exec arch-nspawn \ ++exec $(librelib chroot/arch-nspawn) \ + ${pac_conf:+-C "$pac_conf"} \ + ${makepkg_conf:+-M "$makepkg_conf"} \ + ${cache_dir:+-c "$cache_dir"} \ -- cgit v1.2.3-2-g168b From d25f30f25ce61367c81133c9cd01fe3169d8f6c0 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 21 Mar 2014 14:39:06 -0400 Subject: Do an audit of copyright and license claims --- src/chroot-tools/arch-nspawn.patch | 9 +++++++ src/chroot-tools/chcleanup | 18 +++++++++++-- src/chroot-tools/distcc-tool | 4 ++- src/chroot-tools/hooks-distcc.sh | 19 ++++++++++++++ src/chroot-tools/indent | 19 ++++++++++++++ src/chroot-tools/librechroot | 8 +++--- src/chroot-tools/libremakepkg | 8 +++--- src/chroot-tools/makechrootpkg.sh.patch | 45 +++++++++++++++++++-------------- src/chroot-tools/mkarchroot.patch | 15 ++++++++--- 9 files changed, 113 insertions(+), 32 deletions(-) create mode 100644 src/chroot-tools/arch-nspawn.patch (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/arch-nspawn.patch b/src/chroot-tools/arch-nspawn.patch new file mode 100644 index 0000000..afdf51a --- /dev/null +++ b/src/chroot-tools/arch-nspawn.patch @@ -0,0 +1,9 @@ +--- arch-nspawn.in 2014-03-21 13:59:31.812992892 -0400 ++++ arch-nspawn 2014-03-21 14:24:23.520619552 -0400 +@@ -1,4 +1,6 @@ + #!/bin/bash ++# License: GNU GPLv2 ++# + # 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. diff --git a/src/chroot-tools/chcleanup b/src/chroot-tools/chcleanup index 9ad121e..e766117 100755 --- a/src/chroot-tools/chcleanup +++ b/src/chroot-tools/chcleanup @@ -1,13 +1,27 @@ #!/usr/bin/env bash -set -eE # Copyright (C) Nicolás Reynolds -# Released under GPLv3 # +# License: GNU GPLv3 +# +# 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 3 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + # Performs chroot cleanup smartly, it only removes the unneeded packages or # leaves you with a cleansystem # # See: HOOKPREBUILD +set -eE + DRYRUN=${DRYRUN:-false} ################################################################################ diff --git a/src/chroot-tools/distcc-tool b/src/chroot-tools/distcc-tool index 9f78ead..f2e43dd 100755 --- a/src/chroot-tools/distcc-tool +++ b/src/chroot-tools/distcc-tool @@ -2,7 +2,9 @@ # -*- tab-width: 4; sh-basic-offset: 4 -*- # distcc-tool -# Copyright (C) 2013-2014 Luke Shumaker +# Copyright (C) 2013-2014 Luke Shumaker +# +# License: GNU GPLv3+ # # This file is part of Parabola. # diff --git a/src/chroot-tools/hooks-distcc.sh b/src/chroot-tools/hooks-distcc.sh index d8d708a..445810b 100644 --- a/src/chroot-tools/hooks-distcc.sh +++ b/src/chroot-tools/hooks-distcc.sh @@ -1,4 +1,23 @@ #!/usr/bin/env bash +# Copyright (C) 2013 Luke Shumaker +# +# License: GNU GPLv3+ +# +# This file is part of Parabola. +# +# Parabola 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, either version 3 of the License, or +# (at your option) any later version. +# +# Parabola is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Parabola. If not, see . + set -euE hook_pre_build+=("distcc_start") diff --git a/src/chroot-tools/indent b/src/chroot-tools/indent index 5a7f654..ffec4d5 100755 --- a/src/chroot-tools/indent +++ b/src/chroot-tools/indent @@ -1,4 +1,23 @@ #!/usr/bin/env perl +# Copyright (C) 2013 Luke Shumaker +# +# License: GNU GPLv3+ +# +# This file is part of Parabola. +# +# Parabola 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, either version 3 of the License, or +# (at your option) any later version. +# +# Parabola is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Parabola. If not, see . + use warnings; use strict; use constant BUFFER_SIZE => 40; diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index f449f0d..ca29cbb 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -2,9 +2,11 @@ set -euE # librechroot -# Copyright (C) 2010 Nicolás Reynolds -# Copyright (C) 2011 Joshua Haase -# Copyright (C) 2012-2014 Luke Shumaker +# Copyright (C) 2010 Nicolás Reynolds +# Copyright (C) 2011 Joshua Ismael Haase Hernández (xihh) +# Copyright (C) 2012-2014 Luke Shumaker +# +# License: GNU GPLv3+ # # This file is part of Parabola. # diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg index 26080bc..6050174 100755 --- a/src/chroot-tools/libremakepkg +++ b/src/chroot-tools/libremakepkg @@ -2,9 +2,11 @@ set -euE # libremakepkg -# Copyright (C) 2010-2011 Nicolás Reynolds -# Copyright (C) 2011 Joshua Ismael Haase Hernández -# Copyright (C) 2012-2014 Luke Shumaker +# Copyright (C) 2010-2011 Nicolás Reynolds +# Copyright (C) 2011 Joshua Ismael Haase Hernández (xihh) +# Copyright (C) 2012-2014 Luke Shumaker +# +# License: GNU GPLv3+ # # This file is part of Parabola. # diff --git a/src/chroot-tools/makechrootpkg.sh.patch b/src/chroot-tools/makechrootpkg.sh.patch index 540e6ba..de57aeb 100644 --- a/src/chroot-tools/makechrootpkg.sh.patch +++ b/src/chroot-tools/makechrootpkg.sh.patch @@ -1,6 +1,13 @@ ---- makechrootpkg.sh.in 2014-01-05 18:51:41.463720929 -0500 -+++ makechrootpkg.sh.ugly 2014-02-09 20:20:25.021630727 -0500 -@@ -12,6 +12,7 @@ +--- makechrootpkg.sh.in 2014-03-21 13:59:31.239683366 -0400 ++++ makechrootpkg.sh.ugly 2014-03-21 14:19:20.747789508 -0400 +@@ -1,4 +1,6 @@ + #!/bin/bash ++# License: GNU GPLv2 ++# + # 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. +@@ -12,6 +14,7 @@ shopt -s nullglob @@ -8,7 +15,7 @@ _makepkg_args=(-s --noconfirm -L --holdver) makepkg_args=("${_makepkg_args[@]}") repack=false -@@ -29,9 +30,10 @@ +@@ -29,9 +32,10 @@ bindmounts_rw=() copy=$USER @@ -20,7 +27,7 @@ usage() { echo "Usage: ${0##*/} [options] -r [--] [makepkg args]" -@@ -67,6 +69,7 @@ +@@ -67,6 +71,7 @@ exit 1 } @@ -28,7 +35,7 @@ while getopts 'hcur:I:l:nTD:d:' arg; do case "$arg" in h) usage ;; -@@ -93,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" @@ -38,7 +45,7 @@ if [[ ${copy:0:1} = / ]]; then copydir=$copy else -@@ -115,30 +115,48 @@ +@@ -115,30 +117,48 @@ esac done @@ -93,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" -@@ -159,11 +177,16 @@ +@@ -159,11 +179,16 @@ # Drop the read lock again lock_close 8 @@ -113,7 +120,7 @@ if [[ "$chroottype" == btrfs ]] && ! mountpoint -q "$copydir"; then btrfs subvolume delete "$copydir" >/dev/null || die "Unable to delete subvolume %s" "$copydir" -@@ -178,9 +201,14 @@ +@@ -178,9 +203,14 @@ stat_done } @@ -128,7 +135,7 @@ for install_pkg in "${install_pkgs[@]}"; do pkgname="${install_pkg##*/}" cp "$install_pkg" "$copydir/$pkgname" -@@ -193,11 +221,19 @@ +@@ -193,11 +223,19 @@ rm "$copydir/$pkgname" done @@ -150,7 +157,7 @@ $repack || rm -rf "$copydir/build" mkdir -p "$copydir/build" -@@ -236,12 +272,12 @@ +@@ -236,12 +274,12 @@ chown -R nobody "$copydir"/{build,pkgdest,srcpkgdest,logdest,srcdest,startdir} @@ -165,7 +172,7 @@ sed -i '/^PACKAGER=/d' "$copydir/etc/makepkg.conf" echo "PACKAGER='${PACKAGER}'" >> "$copydir/etc/makepkg.conf" fi -@@ -254,20 +290,38 @@ +@@ -254,20 +292,38 @@ chmod 440 "$copydir/etc/sudoers.d/nobody-pacman" fi @@ -206,7 +213,7 @@ makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o else ( export SRCDEST BUILDDIR="$builddir" -@@ -277,10 +331,10 @@ +@@ -277,10 +333,10 @@ (( $? != 0 )) && die "Could not download sources." # Clean up garbage from verifysource @@ -219,7 +226,7 @@ # This function isn't run in makechrootpkg, # so no global variables local run_namcap="$1"; shift -@@ -291,6 +345,7 @@ +@@ -291,6 +347,7 @@ shopt -s nullglob # XXX: Workaround makepkg disliking read-only dirs @@ -227,7 +234,7 @@ ln -sft /srcdest /srcdest_host/* ln -sft /startdir /startdir_host/* -@@ -316,11 +371,29 @@ +@@ -316,11 +373,29 @@ # Safety check if [[ ! -w PKGBUILD ]]; then @@ -258,7 +265,7 @@ if $run_namcap; then pacman -S --needed --noconfirm namcap -@@ -333,12 +406,24 @@ +@@ -333,12 +408,24 @@ exit 0 } @@ -283,7 +290,7 @@ for l in "$copydir"/logdest/*; do [[ $l == */logpipe.* ]] && continue chown "$src_owner" "$l" -@@ -352,6 +437,10 @@ +@@ -352,6 +439,10 @@ } # }}} @@ -294,7 +301,7 @@ umask 0022 load_vars /etc/makepkg.conf -@@ -363,30 +452,45 @@ +@@ -363,30 +454,45 @@ [[ -d $SRCPKGDEST ]] || SRCPKGDEST=$PWD [[ -d $LOGDEST ]] || LOGDEST=$PWD @@ -346,7 +353,7 @@ if (( ret != 0 )); then if $temp_chroot; then -@@ -397,3 +501,4 @@ +@@ -397,3 +503,4 @@ else true fi diff --git a/src/chroot-tools/mkarchroot.patch b/src/chroot-tools/mkarchroot.patch index a0ea0f0..171b38a 100644 --- a/src/chroot-tools/mkarchroot.patch +++ b/src/chroot-tools/mkarchroot.patch @@ -1,6 +1,13 @@ ---- mkarchroot.in 2014-01-05 18:51:15.231500986 -0500 -+++ mkarchroot 2014-03-20 15:05:06.885086610 -0400 -@@ -65,6 +65,11 @@ +--- mkarchroot.in 2014-03-21 13:59:31.593002027 -0400 ++++ mkarchroot.ugly 2014-03-21 14:23:12.027238102 -0400 +@@ -1,4 +1,6 @@ + #!/bin/bash ++# License: GNU GPLv2 ++# + # 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. +@@ -65,6 +67,11 @@ chmod 0755 "$working_dir" fi @@ -12,7 +19,7 @@ pacstrap -GMcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \ "${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages' -@@ -72,7 +77,7 @@ +@@ -72,7 +79,7 @@ echo 'LANG=C' > "$working_dir/etc/locale.conf" echo "$CHROOT_VERSION" > "$working_dir/.arch-chroot" -- cgit v1.2.3-2-g168b From 4c08929538733d5a76a663f2d48a980103b2223c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 22 Mar 2014 18:14:25 -0400 Subject: Update libremakepkg to work with Bash 4.3 (and still work with 4.2) --- src/chroot-tools/makechrootpkg.sh.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/makechrootpkg.sh.patch b/src/chroot-tools/makechrootpkg.sh.patch index de57aeb..5cea39a 100644 --- a/src/chroot-tools/makechrootpkg.sh.patch +++ b/src/chroot-tools/makechrootpkg.sh.patch @@ -182,7 +182,7 @@ +SigLevel = Optional TrustAll +Server = file:///repo +' -+ sed -i "${line}i${ins//$'\n'/\n}" "$copydir/etc/pacman.conf" ++ sed -i "${line}i${ins//$'\n'/\\n}" "$copydir/etc/pacman.conf" + fi + # This is a little gross, but this way the script is recreated every time in the -- cgit v1.2.3-2-g168b From c48ac8c89e596e160505bd5678db2b193607493f Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 22 Mar 2014 22:00:44 -0400 Subject: Audit the authors and copyright years of files against git logs --- src/chroot-tools/chcleanup | 3 ++- src/chroot-tools/hooks-chcleanup.sh | 17 +++++++++++++++++ src/chroot-tools/hooks-check.sh | 17 +++++++++++++++++ src/chroot-tools/librechroot | 5 +++-- src/chroot-tools/libremakepkg | 5 +++-- 5 files changed, 42 insertions(+), 5 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/chcleanup b/src/chroot-tools/chcleanup index e766117..60a4e22 100755 --- a/src/chroot-tools/chcleanup +++ b/src/chroot-tools/chcleanup @@ -1,5 +1,6 @@ #!/usr/bin/env bash -# Copyright (C) Nicolás Reynolds +# Copyright (C) 2011-2012 Nicolás Reynolds +# Copyright (C) 2012-2013 Luke Shumaker # # License: GNU GPLv3 # diff --git a/src/chroot-tools/hooks-chcleanup.sh b/src/chroot-tools/hooks-chcleanup.sh index 86c872c..0fd0f72 100644 --- a/src/chroot-tools/hooks-chcleanup.sh +++ b/src/chroot-tools/hooks-chcleanup.sh @@ -1,4 +1,21 @@ #!/usr/bin/env bash +# Copyright (C) 2013 Luke Shumaker +# +# License: GNU GPLv2+ +# +# 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, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + set -euE hook_pre_build+=("clean_chroot") diff --git a/src/chroot-tools/hooks-check.sh b/src/chroot-tools/hooks-check.sh index 2702f95..850516b 100644 --- a/src/chroot-tools/hooks-check.sh +++ b/src/chroot-tools/hooks-check.sh @@ -1,4 +1,21 @@ #!/usr/bin/env bash +# Copyright (C) 2013 Luke Shumaker +# +# License: GNU GPLv2+ +# +# 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, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + set -euE hook_check_pkgbuild+=("check_pkgbuild_nonfree") diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index ca29cbb..bb82bd2 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -2,8 +2,9 @@ set -euE # librechroot -# Copyright (C) 2010 Nicolás Reynolds -# Copyright (C) 2011 Joshua Ismael Haase Hernández (xihh) +# Copyright (C) 2010-2012 Nicolás Reynolds +# Copyright (C) 2011-2012 Joshua Ismael Haase Hernández (xihh) +# Copyright (C) 2012 Michał Masłowski # Copyright (C) 2012-2014 Luke Shumaker # # License: GNU GPLv3+ diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg index 6050174..1ed4eaf 100755 --- a/src/chroot-tools/libremakepkg +++ b/src/chroot-tools/libremakepkg @@ -2,8 +2,9 @@ set -euE # libremakepkg -# Copyright (C) 2010-2011 Nicolás Reynolds -# Copyright (C) 2011 Joshua Ismael Haase Hernández (xihh) +# Copyright (C) 2010-2012 Nicolás Reynolds +# Copyright (C) 2010-2012 Joshua Ismael Haase Hernández (xihh) +# Copyright (C) 2012 Michał Masłowski # Copyright (C) 2012-2014 Luke Shumaker # # License: GNU GPLv3+ -- cgit v1.2.3-2-g168b From cb2a663ff60eacf14f38fa4a67aabe35600c0ecb Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 22 Mar 2014 22:13:04 -0400 Subject: Relicense some files from GPLv3+ GPLv2+ (that I'm the sole copyright holder of) --- src/chroot-tools/hooks-distcc.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/hooks-distcc.sh b/src/chroot-tools/hooks-distcc.sh index 445810b..37c82dc 100644 --- a/src/chroot-tools/hooks-distcc.sh +++ b/src/chroot-tools/hooks-distcc.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash # Copyright (C) 2013 Luke Shumaker # -# License: GNU GPLv3+ +# License: GNU GPLv2+ # # This file is part of Parabola. # # Parabola 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, either version 3 of the License, or +# the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # Parabola is distributed in the hope that it will be useful, -- cgit v1.2.3-2-g168b From 222856031fbbf314e8e47db414225756a9c6fba2 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 23 Mar 2014 18:09:13 -0400 Subject: Most of my desired re-licensings were authorized on the dev list --- src/chroot-tools/chcleanup | 5 +++-- src/chroot-tools/librechroot | 4 ++-- src/chroot-tools/libremakepkg | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/chcleanup b/src/chroot-tools/chcleanup index 60a4e22..a72f951 100755 --- a/src/chroot-tools/chcleanup +++ b/src/chroot-tools/chcleanup @@ -2,11 +2,12 @@ # Copyright (C) 2011-2012 Nicolás Reynolds # Copyright (C) 2012-2013 Luke Shumaker # -# License: GNU GPLv3 +# License: GNU GPLv3+ # # 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 3 of the License. +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index bb82bd2..d8e76ac 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -7,13 +7,13 @@ set -euE # Copyright (C) 2012 Michał Masłowski # Copyright (C) 2012-2014 Luke Shumaker # -# License: GNU GPLv3+ +# License: GNU GPLv2+ # # This file is part of Parabola. # # Parabola 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, either version 3 of the License, or +# the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # Parabola is distributed in the hope that it will be useful, diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg index 1ed4eaf..aad4217 100755 --- a/src/chroot-tools/libremakepkg +++ b/src/chroot-tools/libremakepkg @@ -7,13 +7,13 @@ set -euE # Copyright (C) 2012 Michał Masłowski # Copyright (C) 2012-2014 Luke Shumaker # -# License: GNU GPLv3+ +# License: GNU GPLv2+ # # This file is part of Parabola. # # Parabola 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, either version 3 of the License, or +# the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # Parabola is distributed in the hope that it will be useful, -- cgit v1.2.3-2-g168b From cffbaf45b0882a5c6d63d2b798e848d5b21e800b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 25 Mar 2014 21:39:59 -0400 Subject: chcleanup: remove the no-longer-used warning() function --- src/chroot-tools/chcleanup | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/chcleanup b/src/chroot-tools/chcleanup index a72f951..9084736 100755 --- a/src/chroot-tools/chcleanup +++ b/src/chroot-tools/chcleanup @@ -50,11 +50,6 @@ msg2() { printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 } -warning() { - local mesg="$(_ "$1")"; shift - printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 -} - error() { local mesg="$(_ "$1")"; shift printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 -- cgit v1.2.3-2-g168b From ae871fca2853bc3e5bf14587caecfa0436ba03a3 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 25 Mar 2014 21:40:39 -0400 Subject: chcleanup: used ##*/ instead of basename --- src/chroot-tools/chcleanup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/chcleanup b/src/chroot-tools/chcleanup index 9084736..6432d5b 100755 --- a/src/chroot-tools/chcleanup +++ b/src/chroot-tools/chcleanup @@ -78,7 +78,7 @@ msg "Cleaning chroot..." cp /repo/repo.db /var/lib/pacman/sync/repo.db # Setup the temporary directory -TEMPDIR="$(mktemp --tmpdir -d $(basename $0).XXXXX)" +TEMPDIR="$(mktemp --tmpdir -d ${0##*/}.XXXXXXXXXX)" trap "rm -rf '$TEMPDIR'" EXIT cp -a /var/lib/pacman/sync "${TEMPDIR}/" -- cgit v1.2.3-2-g168b From 8831cc585ae8e9071f8c022bdfaf75e42029d7e4 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 25 Mar 2014 21:44:14 -0400 Subject: Fix quoting/escaping with 'rm' in traps. --- src/chroot-tools/chcleanup | 2 +- src/chroot-tools/librechroot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/chcleanup b/src/chroot-tools/chcleanup index 6432d5b..bfb65ce 100755 --- a/src/chroot-tools/chcleanup +++ b/src/chroot-tools/chcleanup @@ -79,7 +79,7 @@ cp /repo/repo.db /var/lib/pacman/sync/repo.db # Setup the temporary directory TEMPDIR="$(mktemp --tmpdir -d ${0##*/}.XXXXXXXXXX)" -trap "rm -rf '$TEMPDIR'" EXIT +trap "rm -rf -- $(printf '%q' "$TEMPDIR")" EXIT cp -a /var/lib/pacman/sync "${TEMPDIR}/" pkglist="${TEMPDIR}"/pkglist.txt diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index d8e76ac..6be9f09 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -371,7 +371,7 @@ main() { arch-nspawn "$copydir" bash -c 'pacman -Syu --noconfirm' ;; clean-pkgs) - trap "rm -f '$copydir'/bin/chcleanup '$copydir'/chrootexec" EXIT + trap "rm -f -- $(printf '%q ' "$copydir"/{bin/chcleanup,chrootexec})" EXIT install -m755 "$(librelib chroot/chcleanup)" "$copydir/bin/chcleanup" printf '%s\n' \ '#!/bin/bash' \ -- cgit v1.2.3-2-g168b From 7233318d44860fb3e2e4596a3352b4c9d783a1da Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 10 May 2014 22:13:03 -0400 Subject: Update to new devtools. --- src/chroot-tools/makechrootpkg.sh.patch | 41 ++++++++++++++++++--------------- src/chroot-tools/mkarchroot.patch | 8 +++---- 2 files changed, 26 insertions(+), 23 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/makechrootpkg.sh.patch b/src/chroot-tools/makechrootpkg.sh.patch index 5cea39a..8180d89 100644 --- a/src/chroot-tools/makechrootpkg.sh.patch +++ b/src/chroot-tools/makechrootpkg.sh.patch @@ -1,5 +1,5 @@ ---- makechrootpkg.sh.in 2014-03-21 13:59:31.239683366 -0400 -+++ makechrootpkg.sh.ugly 2014-03-21 14:19:20.747789508 -0400 +--- makechrootpkg.sh.in 2014-05-10 22:03:27.956692573 -0400 ++++ makechrootpkg.sh.ugly 2014-05-10 22:09:15.376594518 -0400 @@ -1,4 +1,6 @@ #!/bin/bash +# License: GNU GPLv2 @@ -12,8 +12,8 @@ shopt -s nullglob +init_variables() { - _makepkg_args=(-s --noconfirm -L --holdver) - makepkg_args=("${_makepkg_args[@]}") + default_makepkg_args=(-s --noconfirm -L --holdver) + makepkg_args=("${default_makepkg_args[@]}") repack=false @@ -29,9 +32,10 @@ bindmounts_rw=() @@ -35,7 +35,7 @@ while getopts 'hcur:I:l:nTD:d:' arg; do case "$arg" in h) usage ;; -@@ -93,9 +98,6 @@ +@@ -91,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" @@ -45,7 +45,7 @@ if [[ ${copy:0:1} = / ]]; then copydir=$copy else -@@ -115,30 +117,48 @@ +@@ -113,30 +115,48 @@ esac done @@ -100,11 +100,14 @@ # 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" -@@ -159,11 +179,16 @@ +@@ -157,14 +177,19 @@ # Drop the read lock again lock_close 8 - fi + + # Update mtime + touch "$copydir" } -clean_temporary() { @@ -120,7 +123,7 @@ if [[ "$chroottype" == btrfs ]] && ! mountpoint -q "$copydir"; then btrfs subvolume delete "$copydir" >/dev/null || die "Unable to delete subvolume %s" "$copydir" -@@ -178,9 +203,14 @@ +@@ -179,9 +204,14 @@ stat_done } @@ -135,7 +138,7 @@ for install_pkg in "${install_pkgs[@]}"; do pkgname="${install_pkg##*/}" cp "$install_pkg" "$copydir/$pkgname" -@@ -193,11 +223,19 @@ +@@ -194,11 +224,19 @@ rm "$copydir/$pkgname" done @@ -157,7 +160,7 @@ $repack || rm -rf "$copydir/build" mkdir -p "$copydir/build" -@@ -236,12 +274,12 @@ +@@ -237,12 +275,12 @@ chown -R nobody "$copydir"/{build,pkgdest,srcpkgdest,logdest,srcdest,startdir} @@ -172,7 +175,7 @@ sed -i '/^PACKAGER=/d' "$copydir/etc/makepkg.conf" echo "PACKAGER='${PACKAGER}'" >> "$copydir/etc/makepkg.conf" fi -@@ -254,20 +292,38 @@ +@@ -255,20 +293,38 @@ chmod 440 "$copydir/etc/sudoers.d/nobody-pacman" fi @@ -213,7 +216,7 @@ makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o else ( export SRCDEST BUILDDIR="$builddir" -@@ -277,10 +333,10 @@ +@@ -278,10 +334,10 @@ (( $? != 0 )) && die "Could not download sources." # Clean up garbage from verifysource @@ -226,7 +229,7 @@ # This function isn't run in makechrootpkg, # so no global variables local run_namcap="$1"; shift -@@ -291,6 +347,7 @@ +@@ -292,6 +348,7 @@ shopt -s nullglob # XXX: Workaround makepkg disliking read-only dirs @@ -234,7 +237,7 @@ ln -sft /srcdest /srcdest_host/* ln -sft /startdir /startdir_host/* -@@ -316,11 +373,29 @@ +@@ -317,11 +374,29 @@ # Safety check if [[ ! -w PKGBUILD ]]; then @@ -265,7 +268,7 @@ if $run_namcap; then pacman -S --needed --noconfirm namcap -@@ -333,12 +408,24 @@ +@@ -334,12 +409,24 @@ exit 0 } @@ -290,7 +293,7 @@ for l in "$copydir"/logdest/*; do [[ $l == */logpipe.* ]] && continue chown "$src_owner" "$l" -@@ -352,6 +439,10 @@ +@@ -353,6 +440,10 @@ } # }}} @@ -300,8 +303,8 @@ + umask 0022 - load_vars /etc/makepkg.conf -@@ -363,30 +454,45 @@ + load_vars "$USER_HOME/.makepkg.conf" +@@ -364,30 +455,45 @@ [[ -d $SRCPKGDEST ]] || SRCPKGDEST=$PWD [[ -d $LOGDEST ]] || LOGDEST=$PWD @@ -353,7 +356,7 @@ if (( ret != 0 )); then if $temp_chroot; then -@@ -397,3 +503,4 @@ +@@ -398,3 +504,4 @@ else true fi diff --git a/src/chroot-tools/mkarchroot.patch b/src/chroot-tools/mkarchroot.patch index 171b38a..d6f83f1 100644 --- a/src/chroot-tools/mkarchroot.patch +++ b/src/chroot-tools/mkarchroot.patch @@ -1,5 +1,5 @@ ---- mkarchroot.in 2014-03-21 13:59:31.593002027 -0400 -+++ mkarchroot.ugly 2014-03-21 14:23:12.027238102 -0400 +--- mkarchroot.in 2014-05-10 22:10:54.871326879 -0400 ++++ mkarchroot.ugly 2014-05-10 22:10:54.887993222 -0400 @@ -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. -@@ -65,6 +67,11 @@ +@@ -66,6 +68,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' -@@ -72,7 +79,7 @@ +@@ -73,7 +80,7 @@ echo 'LANG=C' > "$working_dir/etc/locale.conf" echo "$CHROOT_VERSION" > "$working_dir/.arch-chroot" -- cgit v1.2.3-2-g168b From 7d74f7ccef61ccb120e920287f6929c12c48d895 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 10 May 2014 22:40:16 -0400 Subject: mkarchroot: creating chroots wasn't working. I later noticed that alfplayer filed a bug report about it: https://labs.parabola.nu/issues/518 --- src/chroot-tools/mkarchroot.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/mkarchroot.patch b/src/chroot-tools/mkarchroot.patch index d6f83f1..9366d92 100644 --- a/src/chroot-tools/mkarchroot.patch +++ b/src/chroot-tools/mkarchroot.patch @@ -14,7 +14,7 @@ +_env=() +while read -r varname; do + _env+=("$varname=${!varname}") -+done < { declare -x | sed -r 's/^declare -x ([^=]*)=.*/\1/' | grep -i '_proxy$'; } ++done < <(declare -x | sed -r 's/^declare -x ([^=]*)=.*/\1/' | grep -i '_proxy$') +env -i "${_env[@]}" \ pacstrap -GMcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \ "${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages' -- cgit v1.2.3-2-g168b From b31425edf4c1b292280e5d14016611f238372a18 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 11 May 2014 22:45:42 -0400 Subject: Create CHROOTARCH in chroot.conf for when $CARCH != $(uname -m) This is the case on mips, where CARCH is misp64el, but uname -m is mips64. --- src/chroot-tools/arch-nspawn.patch | 14 ++++++++++++-- src/chroot-tools/librechroot | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/arch-nspawn.patch b/src/chroot-tools/arch-nspawn.patch index afdf51a..5e0f10b 100644 --- a/src/chroot-tools/arch-nspawn.patch +++ b/src/chroot-tools/arch-nspawn.patch @@ -1,5 +1,5 @@ ---- arch-nspawn.in 2014-03-21 13:59:31.812992892 -0400 -+++ arch-nspawn 2014-03-21 14:24:23.520619552 -0400 +--- arch-nspawn.in 2014-05-11 00:58:42.030932904 -0400 ++++ arch-nspawn.ugly 2014-05-11 22:33:47.186717386 -0400 @@ -1,4 +1,6 @@ #!/bin/bash +# License: GNU GPLv2 @@ -7,3 +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 + +-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" \ + "${mount_args[@]}" \ diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index d8e76ac..9e74a62 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -336,6 +336,8 @@ main() { printf '%q ' "${CHROOTEXTRAPKG[@]}" printf ')\n' fi + # TODO: only set CHROOTARCH if $CARCH != $(uname -m) + printf 'CHROOTARCH=%q\n' "$(uname -m)" } > "$copydir"/etc/libretools.d/chroot.conf if [[ $mode != delete ]]; then -- cgit v1.2.3-2-g168b