summaryrefslogtreecommitdiff
path: root/arch-nspawn.in
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2017-04-05 15:36:01 -0400
committerJan Alexander Steffens (heftig) <jan.steffens@gmail.com>2017-04-05 22:17:51 +0200
commit5b9c06d275dd1a2dca09514e39f853bd9c57be3a (patch)
treec92f1222bdcc3520c24d74d71780c64014e165a6 /arch-nspawn.in
parent82e6bfcd7ae9a0dc2e9ef3c48d5477aa615bef9e (diff)
downloaddevtools-5b9c06d275dd1a2dca09514e39f853bd9c57be3a.tar.xz
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.
Diffstat (limited to 'arch-nspawn.in')
-rw-r--r--arch-nspawn.in6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch-nspawn.in b/arch-nspawn.in
index dceb3ed..08ed2fa 100644
--- a/arch-nspawn.in
+++ b/arch-nspawn.in
@@ -26,16 +26,18 @@ usage() {
echo ' -M <file> Location of a makepkg config file'
echo ' -c <dir> Set pacman cache'
echo ' -f <file> Copy file from the host to the chroot'
+ echo ' -s Do not run setarch'
echo ' -h This message'
exit 1
}
-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
@@ -105,6 +107,8 @@ copy_hostconf
eval $(grep '^CARCH=' "$working_dir/etc/makepkg.conf")
+[[ -z $nosetarch ]] || unset CARCH
+
exec ${CARCH:+setarch "$CARCH"} systemd-nspawn -q \
-D "$working_dir" \
--register=no \