-
Notifications
You must be signed in to change notification settings - Fork 0
/
mount_mini-debian.sh
56 lines (45 loc) · 1.34 KB
/
mount_mini-debian.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh -eu
for SRC in /root/bin/luks_MINIDEB*.inc ; do [ ! -s "${SRC}" ] || . "${SRC}" ; done
if [ -z "${MINIDEB:-}" ]; then
echo 'ERROR: var MINIDEB not set'
return 1 2>/dev/null || exit 1
fi
for SRC in /root/bin/luks_OLD*.inc ; do [ ! -s "${SRC}" ] || . "${SRC}" ; done
if [ -z "${OLDROOT:-}" ]; then
echo 'ERROR: var OLDROOT not set'
return 1 2>/dev/null || exit 1
fi
for SRC in /root/bin/luks_NEW*.inc ; do [ ! -s "${SRC}" ] || . "${SRC}" ; done
MOUNTBASE='/mnt/mini'
[ -d "${MOUNTBASE}" ] || mkdir "${MOUNTBASE}"
grep -q -F -e "${MOUNTBASE} " /proc/mounts || {
echo "Mounting ${MINIDEBMOUNT} on ${MOUNTBASE}"
while mount "${MINIDEBMOUNT}" "${MOUNTBASE}" 2>/dev/null
do
:
done
}
unset -v BOOTMOUNT
if [ "${1:-}" != 'noboot' ]; then
BOOTMOUNT="$(eval echo "\${${1:-OLDBOOT}MOUNT}")"
fi
grep -q -F -e "${MOUNTBASE}/boot " /proc/mounts && {
echo "Unmounting ${MOUNTBASE}/boot"
while umount "${MOUNTBASE}/boot" 2>/dev/null
do
:
done
}
if [ -n "${BOOTMOUNT:-}" ]; then
grep -q -F -e "${MOUNTBASE}/boot " /proc/mounts || {
echo "Mounting ${BOOTMOUNT} on ${MOUNTBASE}/boot"
# mount --bind /boot "${MOUNTBASE}/boot"
while mount "${BOOTMOUNT}" "${MOUNTBASE}/boot" 2>/dev/null
do
:
done
}
fi
mount_sys.sh "${MOUNTBASE}"
echo "${MOUNTBASE} is set up as following..."
mount | grep -F -e "${MOUNTBASE}"