Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mkarchroot.in72
1 files changed, 4 insertions, 68 deletions
diff --git a/mkarchroot.in b/mkarchroot.in
index cb2135d..4d49be3 100644
--- a/mkarchroot.in
+++ b/mkarchroot.in
@@ -136,44 +136,6 @@ bind_mount() {
chroot_mount() {
trap 'trap_chroot_umount' EXIT INT QUIT TERM HUP
- if (( ! have_nspawn )); then
- bind_mount /sys ro
-
- [[ -e "${working_dir}/proc" ]] || mkdir "${working_dir}/proc"
- mount -t proc proc -o nosuid,noexec,nodev "${working_dir}/proc"
- bind_mount /proc/sys ro
-
- [[ -e "${working_dir}/dev" ]] || mkdir "${working_dir}/dev"
- mount -t tmpfs dev "${working_dir}/dev" -o mode=0755,size=10M,nosuid,strictatime
- mknod -m 666 "${working_dir}/dev/null" c 1 3
- mknod -m 666 "${working_dir}/dev/zero" c 1 5
- mknod -m 600 "${working_dir}/dev/console" c 5 1
- mknod -m 644 "${working_dir}/dev/random" c 1 8
- mknod -m 644 "${working_dir}/dev/urandom" c 1 9
- mknod -m 666 "${working_dir}/dev/tty" c 5 0
- mknod -m 666 "${working_dir}/dev/ptmx" c 5 2
- mknod -m 666 "${working_dir}/dev/tty0" c 4 0
- mknod -m 666 "${working_dir}/dev/full" c 1 7
- mknod -m 666 "${working_dir}/dev/rtc0" c 254 0
- ln -s /proc/kcore "${working_dir}/dev/core"
- ln -s /proc/self/fd "${working_dir}/dev/fd"
- ln -s /proc/self/fd/0 "${working_dir}/dev/stdin"
- ln -s /proc/self/fd/1 "${working_dir}/dev/stdout"
- ln -s /proc/self/fd/2 "${working_dir}/dev/stderr"
-
- [[ -e "${working_dir}/dev/shm" ]] || mkdir "${working_dir}/dev/shm"
- mount -t tmpfs shm "${working_dir}/dev/shm" -o nodev,nosuid,size=128M
-
- bind_mount /dev/pts
-
- [[ -e "${working_dir}/run" ]] || mkdir "${working_dir}/run"
- mount -t tmpfs tmpfs "${working_dir}/run" -o mode=0755,nodev,nosuid,strictatime,size=64M
-
- for host_config in resolv.conf localtime; do
- bind_mount /etc/$host_config ro
- done
- fi
-
[[ -n $host_mirror_path ]] && bind_mount "$host_mirror_path" ro
bind_mount "${cache_dirs[0]}"
@@ -209,19 +171,6 @@ trap_chroot_umount () {
done
[[ -n $host_mirror_path ]] && umount "${working_dir}/${host_mirror_path}"
- if (( ! have_nspawn )); then
- for host_config in resolv.conf localtime; do
- umount "${working_dir}/etc/${host_config}"
- done
- umount "${working_dir}/proc/sys"
- umount "${working_dir}/proc"
- umount "${working_dir}/sys"
- umount "${working_dir}/dev/pts"
- umount "${working_dir}/dev/shm"
- umount "${working_dir}/dev"
- umount "${working_dir}/run"
- fi
-
trap 'trap_abort' INT QUIT TERM HUP
trap 'trap_exit' EXIT
}
@@ -233,28 +182,15 @@ chroot_lock () {
chroot_run() {
local dir=$1
shift
- if (( have_nspawn)); then
- local nspawn_args=(-D "$dir")
- if [[ $NONETWORK = y ]]; then
- nspawn_args+=(--private-network)
- fi
- eval systemd-nspawn "${nspawn_args[@]}" -- "${@}" 2>/dev/null
- else
- local unshare_args=(-mui)
- if [[ $NONETWORK = y ]]; then
- unshare_args+=(-n)
- fi
- eval unshare "${unshare_args[@]}" -- chroot "${dir}" "${@}"
+ local nspawn_args=(-D "$dir")
+ if [[ $NONETWORK = y ]]; then
+ nspawn_args+=(--private-network)
fi
+ eval systemd-nspawn "${nspawn_args[@]}" -- "${@}" 2>/dev/null
}
# }}}
-# use systemd-nspawn if we have it available and systemd is running
-if type -P systemd-nspawn >/dev/null && mountpoint -q /sys/fs/cgroup/systemd; then
- have_nspawn=1
-fi
-
umask 0022
if [[ -n $RUN ]]; then
# run chroot {{{