aboutsummaryrefslogtreecommitdiffstats
path: root/packages/slugos-init/files/initscripts/umountinitrd.sh
blob: 2798fe59850f734e91243aaa0920080b2f7c0de3 (plain)
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
#!/bin/sh
#
# umount /mnt, which is where the initrd ends up mounted
# if the directory /initrd is not present, if this fails
# then the /initrd is mounted and we want to remount that
# ro - this works round the shutdown -r hang problem
. /etc/default/functions

case "$(machine)" in
nslu2)
	ffspart="Flashdisk";;
*)
	ffspart="filesystem";;
esac

while read device directory remainder
do
	case "$directory" in
	/mnt)	echo "InitRD: unmount initrd on /mnt" >&2
		umount /mnt;;
	/initrd)# need the device for a remount
		ffsdev="$(mtblockdev $ffspart)"
		echo "Remounting $ffsdev read-only on /initrd" >&2
		if test -n "$ffsdev" -a -b "$ffsdev"
		then
			mount -o remount,ro "$ffsdev" /initrd
		else
			echo "$ffspart: $ffsdev: flash device not found" >&2
		fi;;
	esac
done </proc/mounts