diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-04-24 11:03:04 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-04-24 11:03:04 -0400 |
commit | 7358ca574bf6fd133a5d883f2da6e359335ac830 (patch) | |
tree | efcb526cbd9a0e1e0d059a35e8a46bcc75dd1725 /mkarchroot.in | |
parent | a2346ecb02de3d30c4d2bbb53f7e661854aa4df6 (diff) | |
parent | 828143751b6fed6d02b2857e9273f19b38ed4a8a (diff) |
Merge commit '8281' into complete
Conflicts:
mkarchroot.in
Diffstat (limited to 'mkarchroot.in')
-rw-r--r-- | mkarchroot.in | 72 |
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 {{{ |