diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-23 23:28:26 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-23 23:28:26 -0400 |
commit | b57e1b9b40067117ad63e6684c698607a81e077a (patch) | |
tree | 8eafe3361ba668a0909fe868fe76194a2dd12888 /src/chroot-tools/librechroot | |
parent | 3c22e8bcfedf2c86880f0165b38093afacc52901 (diff) |
librechroot: give a better error if an invalid -A flag is given
Diffstat (limited to 'src/chroot-tools/librechroot')
-rwxr-xr-x | src/chroot-tools/librechroot | 5 |
1 files changed, 5 insertions, 0 deletions
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" |