summaryrefslogtreecommitdiff
path: root/librechroot
diff options
context:
space:
mode:
Diffstat (limited to 'librechroot')
-rwxr-xr-xlibrechroot21
1 files changed, 13 insertions, 8 deletions
diff --git a/librechroot b/librechroot
index e43a3ee..9532214 100755
--- a/librechroot
+++ b/librechroot
@@ -37,16 +37,21 @@ else
source /etc/libretools.conf
fi
-mount -t proc proc $CHROOTDIR/$root/proc/
-mount -t sysfs sys $CHROOTDIR/$root/sys/
-mount -o bind /dev $CHROOTDIR/$root/dev/
+[[ ! -d $CHROOTDIR/$1/ ]] && {
+ echo "There's no $CHROOTDIR/$1"
+ exit 3
+}
+
+mount -t proc proc $CHROOTDIR/$1/proc/
+mount -t sysfs sys $CHROOTDIR/$1/sys/
+mount -o bind /dev $CHROOTDIR/$1/dev/
-cp -L /etc/resolv.conf $CHROOTDIR/$root/etc/resolv.conf
+cp -L /etc/resolv.conf $CHROOTDIR/$1/etc/resolv.conf
-chroot $CHROOTDIR/$root /bin/bash
+chroot $CHROOTDIR/$1 /bin/bash
-umount $CHROOTDIR/$root/proc/
-umount $CHROOTDIR/$root/sys/
-umount $CHROOTDIR/$root/dev/
+umount $CHROOTDIR/$1/proc/
+umount $CHROOTDIR/$1/sys/
+umount $CHROOTDIR/$1/dev/
exit 0