index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | mkarchroot.in | 62 |
diff --git a/mkarchroot.in b/mkarchroot.in index cb95f8e..20de5e6 100644 --- a/mkarchroot.in +++ b/mkarchroot.in @@ -98,44 +98,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]}" @@ -167,19 +129,6 @@ trap_chroot_umount () { umount "${working_dir}/${cache_dir}" 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 } chroot_lock () { @@ -199,20 +148,11 @@ chroot_lock () { chroot_run() { local dir=$1 shift - if (( have_nspawn)); then - eval systemd-nspawn -D "${dir}" -- ${@} 2>/dev/null - else - eval unshare -mui -- chroot "${dir}" ${@} - fi + eval systemd-nspawn -D "${dir}" -- ${@} 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 {{{ |