From df3eee40d3ff0a6c8532a1d19bad25d057330cd2 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 15 Feb 2017 14:39:25 -0500 Subject: mkarchroot, arch-nspawn: Add an `-s` flag to inhibit `setarch`. This allows us to run an ARM chroot on an x86 box; as the binfmt runner will set the architecture for us, and the x86 `/usr/bin/setarch` program won't know about the ARM architecture string. --- arch-nspawn.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'arch-nspawn.in') diff --git a/arch-nspawn.in b/arch-nspawn.in index 19a1a89..ea6e5ea 100644 --- a/arch-nspawn.in +++ b/arch-nspawn.in @@ -27,18 +27,20 @@ usage() { echo ' -M Location of a makepkg config file' echo ' -c Set pacman cache' echo ' -f Copy file from the host to the chroot' + echo ' -s Do not run setarch' echo ' -h This message' exit 1 } orig_argv=("$@") -while getopts 'hC:M:c:f:' arg; do +while getopts 'hC:M:c:f:s' arg; do case "$arg" in C) pac_conf="$OPTARG" ;; M) makepkg_conf="$OPTARG" ;; c) cache_dir="$OPTARG" ;; f) files+=("$OPTARG") ;; + s) nosetarch=1 ;; h|?) usage ;; *) error "invalid argument '%s'" "$arg"; usage ;; esac @@ -111,6 +113,8 @@ case "$CARCH" in armv7h) CARCH=armv7l;; esac +[[ -z $nosetarch ]] || unset CARCH + exec ${CARCH:+setarch "$CARCH"} systemd-nspawn -q \ -D "$working_dir" \ --register=no \ -- cgit v1.2.3-70-g09d2