[[ -w / ]] || exec sudo env HOME="$HOME" "$0" "$@"
+if [[ -z ${UNSHARE} ]] ; then
+ mount_args=
+ if type -P unshare >&/dev/null ; then
+ UNSHARE=true exec unshare -m -- "$0" "$@"
+ fi
+else
+ mount_args='-n'
+fi
+unset UNSHARE
+
mounts="proc sys dev dev/pts usr/portage usr/portage/distfiles"
chroot=${0%/*}
local src=/$1 dst=${chroot}/${2:-$1}
[[ -d ${src} ]] || return 0
mkdir -p "${dst}"
- grep -sq "${dst}" /proc/mounts || mount --bind "${src}" "${dst}"
+ grep -sq "${dst}" /proc/mounts || mount ${mount_args} --bind "${src}" "${dst}"
}
for m in ${mounts} ; do
maybe_mount ${m}
esac
}
bin_dst=$(get_type bin/bash)
+setarch=
if [[ -n ${bin_dst} ]] && type -P setarch &>/dev/null ; then
setarch="setarch ${bin_dst}"
fi