Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src/arch-nspawn.in
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch-nspawn.in')
-rw-r--r--src/arch-nspawn.in22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/arch-nspawn.in b/src/arch-nspawn.in
index 6fbed18..8fcdead 100644
--- a/src/arch-nspawn.in
+++ b/src/arch-nspawn.in
@@ -16,7 +16,6 @@ umask 0022
working_dir=''
files=()
-mount_args=()
usage() {
echo "Usage: ${0##*/} [options] working-dir [systemd-nspawn arguments]"
@@ -56,6 +55,16 @@ shift 1
[[ -z $working_dir ]] && die 'Please specify a working directory.'
+nspawn_args=(
+ --quiet
+ --directory="$working_dir"
+ --setenv="PATH=/usr/local/sbin:/usr/local/bin:/usr/bin"
+ --register=no
+ --slice="devtools-$(systemd-escape "${SUDO_USER:-$USER}")"
+ --machine="arch-nspawn-$$"
+ --as-pid2
+)
+
if (( ${#cache_dirs[@]} == 0 )); then
mapfile -t cache_dirs < <(pacman-conf --config "${pac_conf:-$working_dir/etc/pacman.conf}" CacheDir)
fi
@@ -83,10 +92,10 @@ while read -r line; do
done
done < <(pacman-conf --config "${pac_conf:-$working_dir/etc/pacman.conf}" --repo-list)
-mount_args+=("--bind=${cache_dirs[0]//:/\\:}")
+nspawn_args+=(--bind="${cache_dirs[0]//:/\\:}")
for cache_dir in "${cache_dirs[@]:1}"; do
- mount_args+=("--bind-ro=${cache_dir//:/\\:}")
+ nspawn_args+=(--bind-ro="${cache_dir//:/\\:}")
done
# {{{ functions
@@ -131,9 +140,4 @@ else
set_arch="${CARCH}"
fi
-exec ${CARCH:+setarch "$set_arch"} systemd-nspawn -q \
- -D "$working_dir" \
- -E "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin" \
- --register=no --keep-unit --as-pid2 \
- "${mount_args[@]}" \
- "$@"
+exec ${CARCH:+setarch "$set_arch"} systemd-nspawn "${nspawn_args[@]}" "$@"