From b57e1b9b40067117ad63e6684c698607a81e077a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 23 May 2016 23:28:26 -0400 Subject: librechroot: give a better error if an invalid -A flag is given --- src/chroot-tools/librechroot | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index 4cf1d98..cf564ed 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -306,6 +306,11 @@ main() { N) sysd_nspawn_flags+=(--private-network);; C|M) arch_nspawn_flags+=(-$opt "$OPTARG");; A) + if ! [[ -f "/usr/share/pacman/defaults/pacman.conf.$OPTARG" && -f "/usr/share/pacman/defaults/makepkg.conf.$OPTARG" ]]; then + error 'Unsupported architecture: %s' "$OPTARG" + plain 'See the files in %q for valid architectures.' /usr/share/pacman/defaults/ + return 1; + fi trap 'rm -f -- "$tmppacmanconf"' EXIT tmppacmanconf="$(mktemp --tmpdir librechroot-pacman.conf.XXXXXXXXXX)" < "/usr/share/pacman/defaults/pacman.conf.$OPTARG" sed -r "s|^#?\\s*Architecture.+|Architecture = ${OPTARG}|g" > "$tmppacmanconf" -- cgit v1.2.3-54-g00ecf