-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchroot_pick
More file actions
executable file
·52 lines (41 loc) · 961 Bytes
/
chroot_pick
File metadata and controls
executable file
·52 lines (41 loc) · 961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# Switch to a specific chroot
user=`whoami`
if [[ $user != "root" ]]; then
echo "Running $0 as root..."
sudo $0 $@
exit
fi
if [[ $# -eq 0 ]]; then
echo "Available chroot:"
ls -l /chroot
echo ""
read -e -p "Use /chroot/" chroot
else
chroot="$1"
fi
if [[ ! -d "/chroot/$chroot" ]]; then
echo "/chroot/$chroot does not exist"
exit
fi
#if mountpoint -q "/chroot/$chroot/media/olddd"; then
# echo "olddd already mounted"
#else
# mount /dev/sdb1 /chroot/$chroot/media/olddd
#fi
if mountpoint -q "/chroot/$chroot/dev/pts"; then
echo "pts already mounted"
else
mount --bind /dev/pts /chroot/$chroot/dev/pts
fi
if mountpoint -q "/chroot/$chroot/proc"; then
echo "proc already mounted"
else
mount --bind /proc /chroot/$chroot/proc
fi
if mountpoint -q "/chroot/$chroot/sys"; then
echo "sys already mounted"
else
mount --bind /sys /chroot/$chroot/sys
fi
chroot /chroot/$chroot