mirror of
https://linux.maple.camp/git/ahill/maplelinux-bootstrap.git
synced 2026-02-11 10:13:35 +00:00
Cleaned the branch up
This commit is contained in:
25
scripts/maple-chroot
Executable file
25
scripts/maple-chroot
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -z "$1" ] && [ ! -d "$1" ]; then
|
||||
echo "Usage: $0 <root>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if mount --rbind /dev $1/dev && mount --make-rslave $1/dev; then
|
||||
if mount -t proc /proc $1/proc; then
|
||||
if mount --bind /run $1/run; then
|
||||
if mount --rbind /sys $1/sys && mount --make-rslave $1/sys; then
|
||||
if mount --rbind /tmp $1/tmp; then
|
||||
SHELL=$2
|
||||
[ -z "$SHELL" ] && SHELL=/bin/sh
|
||||
chroot $1 $SHELL
|
||||
umount -R $1/tmp
|
||||
fi
|
||||
umount -R $1/sys
|
||||
fi
|
||||
umount -R $1/run
|
||||
fi
|
||||
umount -R $1/proc
|
||||
fi
|
||||
umount -R $1/dev
|
||||
fi
|
||||
Reference in New Issue
Block a user