merge of 8eaefa4f638dc67e29fb59fca3c6a98e4049eb09
[vuplus_openembedded] / packages / openprotium-init / files / initscripts / umountinitrd.sh
1 #!/bin/sh
2 #
3 # umount /mnt, which is where the initrd ends up mounted
4 # if the directory /initrd is not present, if this fails
5 # then the /initrd is mounted and we want to remount that
6 # ro - this works round the shutdown -r hang problem
7 . /etc/default/functions
8 #
9 # if we are turnup'ed to disk, then just unmount the initrd all together
10 #
11 if [ -e /initrd/dev/.devfsd ]; then 
12         [ "$VERBOSE" = "very" ] && echo "Unmounting initrd..."
13         umount /initrd/dev
14         umount /initrd
15         exit 0
16 fi
17
18 while read device directory remainder
19 do
20         case "$directory" in
21         /mnt)   echo "InitRD: unmount initrd on /mnt" >&2
22                 umount /mnt;;
23         /initrd)# need the device for a remount
24                 ffspart=Flashdisk
25                 ffsdev="$(mtblockdev $ffspart)"
26                 echo "InitRD: remount $ffdev read-only on /initrd" >&2
27                 if test -n "$ffsdev" -a -b "$ffsdev"
28                 then
29                         mount -o remount,ro "$ffsdev" /initrd
30                 else
31                         echo "Flashdisk: $ffsdev: flash device not found" >&2
32                 fi;;
33         esac
34 done </proc/mounts