diff options
| -rw-r--r-- | mkshrc | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -328,6 +328,22 @@ startup_zram() { swapon /dev/zram0 } +# System setup `chroot`, useful mainly on Linux +syschroot() { + CHDIR=$1 + PROG=$2 + CUR_PS1="$PS1" + PS1="(CHROOT) # " + mount -o bind /dev $CHDIR/dev + mount -o bind /sys $CHDIR/sys + mount -o bind /proc $CHDIR/proc + if [ "$PROG" = "/bin/bash" ] ; then + PS1="(CHROOT) [ \u@\h \w ] # " + fi + chroot $CHDIR $PROG + umount $CHDIR/dev $CHDIR/sys $CHDIR/proc + PS1="$CUR_PS1" +} # Sometimes useful function for unmounting a chroot dir on Linux umount_recursive() { case $1 in |
