forked from kaylorchen/rk3588_dev_rootfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ch-mount.sh
executable file
·42 lines (36 loc) · 880 Bytes
/
ch-mount.sh
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
#!/bin/bash
function mnt() {
echo "MOUNTING"
# sudo chown -R root:root ${2}
sudo mount -t proc /proc ${2}/proc
sudo mount -t sysfs /sys ${2}/sys
sudo mount -o bind /dev ${2}/dev
sudo chroot ${2}
}
function umnt() {
echo "UNMOUNTING"
sudo sync
sleep 3
sudo umount ${2}/proc
sudo umount ${2}/sys
sudo umount ${2}/dev
}
if [ "$1" == "-m" ] && [ -n "$2" ] ;
then
mnt $1 $2
umnt $1 $2
elif [ "$1" == "-u" ] && [ -n "$2" ];
then
umnt $1 $2
else
echo ""
echo "Either 1'st, 2'nd or both parameters were missing"
echo ""
echo "1'st parameter can be one of these: -m(mount) OR -u(umount)"
echo "2'nd parameter is the full path of rootfs directory(with trailing '/')"
echo ""
echo "For example: ch-mount -m /media/sdcard/"
echo ""
echo 1st parameter : ${1}
echo 2nd parameter : ${2}
fi