]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/initscripts/initscripts-1.0/openslug/umountfs
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / initscripts / initscripts-1.0 / openslug / umountfs
1 #! /bin/sh
2 #
3 # umountfs      Turn off swap and unmount all local filesystems.
4 #
5
6 PATH=/sbin:/bin:/usr/sbin:/usr/bin
7
8 # Ensure /proc is mounted
9 test -r /proc/mounts || mount -t proc proc /proc
10
11 echo "Deactivating swap..."
12 swapoff -a
13
14 # We leave /proc mounted, the umount of /dev/devpts seems to fail
15 # quite frequently, the busybox umount apparently gives up at the
16 # first failure, so it is necessary to go file system by file
17 # system.  It is necessary to go backward in the /proc list, because
18 # later things may have been mounted on earlier mounts.
19 devfs=
20 unmount() {
21         local dev mp type opts
22         if read dev mp type opts
23         then
24                 # recurse - unmount later items
25                 unmount
26                 # skip /proc and /dev but not the sub-directories
27                 case "$mp" in
28                 /|/proc)return 0;;
29                 /dev)   devfs=1
30                         return 0;;
31                 esac
32                 # then unmount this, if possible, otherwise make
33                 # it read-only
34                 umount -f -r "$mp"
35         fi
36 }
37
38 echo "Unmounting local filesystems..."
39 unmount </proc/mounts
40
41 # now /dev and read-only /  (halt/reboot may need /proc!)
42 test -n "$devfs" && umount -f -r /dev
43 mount -o remount,ro /