From a68d0ebb827d3cf49a62694e5a62207900e6f3a4 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 14 Apr 2016 19:46:39 -0400 Subject: librechroot: add -A flag to set the architecture. Takes advantage of pacman 5.0.1-2.parabola4 shipping the default config files for all architectures. --- src/chroot-tools/librechroot | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index ee3ffb8..52a5e12 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -186,6 +186,10 @@ usage() { by the by `CARCH` variable in the `/etc/makepkg.conf` file inside of the chroot.' echo + prose 'In line with this, The `-A CARCH` flag is simply an alias for' + printf ' -C "/usr/share/pacman/defaults/pacman.conf.$CARCH" \\\n' + printf ' -M "/usr/share/pacman/defaults/makepkg.conf.$CARCH"\n' + echo prose 'Creating a copy, deleting a copy, or syncing a copy can be fairly slow; but are very fast if $CHROOTDIR is on a btrfs partition.' echo @@ -195,6 +199,8 @@ usage() { flag '-N' 'Disable networking in the chroot' flag "-C <$(_ FILE)>" 'Copy this file to `$copydir/etc/pacman.conf`' flag "-M <$(_ FILE)>" 'Copy this file to `$copydir/etc/makepkg.conf`' + flag "-A <$(_ CARCH)>" 'Set the architecture of the copy; simply an + alias for the `-C` and `-M` flags, see above.' flag "-w <$(_ 'PATH[:PATH]')>" 'Bind mount a file or directory, read/write' flag "-r <$(_ 'PATH[:PATH]')>" 'Bind mount a file or directory, read-only' echo @@ -230,12 +236,16 @@ main() { [[ $COPY != root ]] || COPY=copy local mode=enter - while getopts 'n:l:NC:M:w:r:' opt; do + while getopts 'n:l:NC:M:A:w:r:' opt; do case $opt in n) CHROOT=$OPTARG;; l) COPY=$OPTARG;; N) sysd_nspawn_flags+=(--private-network);; C|M) arch_nspawn_flags+=(-$opt "$OPTARG");; + A) arch_nspawn_flags+=( + -C "/usr/share/pacman/defaults/pacman.conf.$OPTARG" + -M "/usr/share/pacman/defaults/makepkg.conf.$OPTARG" + );; w) sysd_nspawn_flags+=("--bind=$OPTARG");; r) sysd_nspawn_flags+=("--bind-ro=$OPTARG");; *) usage >&2; return 1;; -- cgit v1.2.3