3 [[ -w / ]] || exec sudo env HOME="$HOME" "$0" "$@"
5 mounts="proc sys dev dev/pts usr/portage usr/portage/distfiles"
10 ./*) chroot=${PWD}/${chroot#./} ;;
15 mounts=$(mount | grep ${chroot} | awk '{print $3}' | tac)
16 for m in ${mounts} ; do
20 if [[ -z ${mounts} ]] ; then
21 echo "nothing mounted in ${chroot}"
26 while [[ -n $1 ]] ; do
29 -*) echo "unknown option $1"; exit 1 ;;
35 local src=/$1 dst=${chroot}/${2:-$1}
36 [[ -d ${src} ]] || return 0
38 grep -sq "${dst}" /proc/mounts || mount --bind "${src}" "${dst}"
40 for m in ${mounts} ; do
46 *x86-64*) echo x86_64;;
47 *"Intel 80386"*) echo i386;;
48 *32-bit*PowerPC*) echo ppc;;
49 *64-bit*PowerPC*) echo ppc64;;
52 bin_dst=$(get_type bin/bash)
53 if [[ -n ${bin_dst} ]] && type -P setarch &>/dev/null ; then
54 setarch="setarch ${bin_dst}"
57 if [[ ! -L etc/mtab ]] ; then
59 ln -sf /proc/mounts etc/mtab
74 $(printf 'etc/%s ' ${etc}) \
76 if [ -e "/${f}" ] ; then
84 unset LS_COLORS # format changes over time
85 [[ $# -eq 0 ]] && set -- env HOME=/root /bin/bash -l