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.
This commit is contained in:
parent
82e6bfcd7a
commit
5b9c06d275
|
@ -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 \
|
||||
|
|
|
@ -24,16 +24,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
|
||||
|
@ -86,6 +88,7 @@ echo "$CHROOT_VERSION" > "$working_dir/.arch-chroot"
|
|||
systemd-machine-id-setup --root="$working_dir"
|
||||
|
||||
exec arch-nspawn \
|
||||
${nosetarch:+-s} \
|
||||
${pac_conf:+-C "$pac_conf"} \
|
||||
${makepkg_conf:+-M "$makepkg_conf"} \
|
||||
${cache_dir:+-c "$cache_dir"} \
|
||||
|
|
Loading…
Reference in New Issue