unset UNSHARE
}
+is_mounted() {
+ local dst=$1
+ grep -sq "${dst}" /proc/mounts
+}
+
maybe_mount() {
local src=/$1 dst=${chroot}/${2:-$1}
[[ -d ${src} ]] || return 0
if ! mkdir -p "${dst}" ; then
[[ -w ${chroot} ]] && exit 1 || return 0
fi
- grep -sq "${dst}" /proc/mounts || mount ${mount_args} --bind "${src}" "${dst}"
+ is_mounted "${dst}" || mount ${mount_args} --bind "${src}" "${dst}"
}
get_type() {
main() {
bootstrap "$@"
- local mounts=( proc sys tmp dev dev/pts dev/shm run usr/portage usr/portage/distfiles usr/local/src )
+ local mounts=( proc sys tmp dev dev/shm run usr/portage usr/portage/distfiles usr/local/src )
local chroot=${0%/*}
case ${chroot} in
for m in "${mounts[@]}" ; do
maybe_mount ${m}
done
+ # Handle special mounts that we don't want to just bind mount.
+ if ! is_mounted "${chroot}/dev/pts" ; then
+ mount -t devpts devpts "${chroot}/dev/pts" \
+ -o nosuid,noexec,newinstance,ptmxmode=0666,mode=0620,gid=5
+ fi
init_chroot