Magellan Linux

Annotation of /trunk/initscripts/busybox/rc/mountfs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1196 - (hide annotations) (download)
Thu Jan 27 20:42:23 2011 UTC (13 years, 3 months ago) by niro
Original Path: trunk/busybox-initscripts/rc/mountfs
File size: 3362 byte(s)
-merged with upstream
1 niro 724 #!/bin/sh
2 niro 735 # $Header: /home/cvsd/magellan-cvs/magellan-src/busybox-initscripts/rc/mountfs,v 1.2 2008-06-10 23:08:56 niro Exp $
3 niro 724
4     #%rlevels: 7:s 0:k
5     #%start: 40
6     #%stop: 60
7    
8     #deps
9     #%needs:
10     #%before:
11     #%after:
12    
13     source /etc/conf.d/rc
14     source ${rc_functions}
15    
16     case "$1" in
17     start)
18     # fake mounts rootfs (taken from /.bootdev)
19     if [ -e /.bootdev ]
20     then
21     source /.bootdev
22     mount -f ${BOOTDEV} /mnt/cdrom -t ${FSTYPE} -o ro
23     # we don't delete this for the alx settings import
24     # wanna check if usbstorage or not
25     # rm /.bootdev
26    
27     # fake mounts cloop, loop or sqsh
28     if [ -f /mnt/cdrom/livecdrootfs.loop ]
29     then
30     mount -f /mnt/cdrom/livecdrootfs.loop /mnt/cloop -t ext2 -o ro
31    
32     elif [ -f /mnt/cdrom/livecdrootfs.cloop ]
33     then
34     mount -f /mnt/cdrom/livecdrootfs.cloop /mnt/cloop -t ext2 -o ro
35    
36     elif [ -f /mnt/cdrom/livecdrootfs.sqsh ]
37     then
38 niro 1196 mount -f /mnt/cdrom/livecdrootfs.sqsh /mnt/cloop -t squashfs -o ro
39 niro 724 fi
40     else
41 niro 1168 rc_print "Remounting root file system in read-write mode ..."
42 niro 724 mount -n -o remount,rw /
43     evaluate_retval
44     fi
45    
46 niro 1168 rc_print "Recording existing mounts in /etc/mtab ..."
47 niro 724 > /etc/mtab
48    
49     mount -f / && mount -f /proc
50    
51     # records devfs as mounted
52     is_fs_mounted devfs && mount -f -t devfs devfs /dev
53    
54     # records devpts as mounted
55     is_fs_mounted devpts && mount -f -t devpts devpts /dev/pts
56    
57     # records sysfs as mounted
58     is_fs_mounted sysfs && mount -f -t sysfs sysfs /sys
59    
60     # records udev as mounted
61     if is_fs_mounted udev
62     then
63     # get the fstype of udev - it may be ramfs or tmpfs
64     udev_fstype="$(cat /proc/mounts | grep udev | cut -d ' ' -f3)"
65     # get the right mount opts - udev with tmpfs comes nosuid
66     udev_mopts="$(cat /proc/mounts | grep udev | cut -d ' ' -f4)"
67     mount -f -t ${udev_fstype} -o ${udev_mopts} udev /dev
68     fi
69    
70 niro 1168 # records mdev as mounted
71     if is_fs_mounted mdev
72     then
73     # get the fstype of mdev - it may be ramfs or tmpfs
74     mdev_fstype="$(cat /proc/mounts | grep mdev | cut -d ' ' -f3)"
75     # get the right mount opts - mdev with tmpfs comes nosuid
76     mdev_mopts="$(cat /proc/mounts | grep mdev | cut -d ' ' -f4)"
77     mount -f -t ${mdev_fstype} -o ${mdev_mopts} mdev /dev
78     fi
79    
80 niro 724 # records usbfs as mounted
81     is_fs_mounted usbfs && mount -f -t usbfs usbfs /proc/bus/usb
82    
83     evaluate_retval
84    
85     # The following mount command will mount all file systems. If you
86     # have other (network based) file system that should not be or
87     # cannot be mounted at this time, add them to the NO_FS variable
88     # below. All file systems that are added to the variable in the
89     # form of no<filesystem> will be skipped.
90 niro 735 NO_FS="noswap,nonfs,nosmbfs,noproc,nocoda,noncpfs,noshm"
91 niro 1168 rc_print "Mounting remaining file systems ..."
92 niro 724 mount -a -t $NO_FS
93     evaluate_retval
94    
95     update_svcstatus $1
96     splash svc_started "$(basename $0)" 0
97     ;;
98    
99     stop)
100 niro 1168 rc_print "Unmounting all other currently mounted file systems ..."
101 niro 724 if [ -e /dev/.udev ]
102     then
103 niro 1196 NO_FS="noramfs,notmpfs,nodevtmpfs,nodevpts"
104 niro 724 umount -a -r -d -t ${NO_FS}
105     else
106     # -d, umount loop devices as well
107     umount -a -r -d
108     fi
109     evaluate_retval
110    
111     if [ -e /.bootdev ] && [ -x /usr/bin/eject ]
112     then
113 niro 1168 rc_print "Trying to eject the live-media ..."
114 niro 724 eject -m /mnt/cdrom &> /dev/null
115     evaluate_retval
116     fi
117    
118     update_svcstatus $1
119     splash svc_stopped "$(basename $0)" 0
120     ;;
121    
122     *)
123 niro 1196 rc_echo "Usage: $0 {start|stop}"
124 niro 724 exit 1
125     ;;
126     esac