Magellan Linux

Contents of /trunk/magellan-initscripts/etc/rc.d/init.d/mountfs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 520 - (show annotations) (download)
Sat Aug 18 13:55:22 2007 UTC (16 years, 8 months ago) by niro
File size: 3101 byte(s)
-fixed typos

1 #!/bin/bash
2 # $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/mountfs,v 1.10 2007-08-18 13:55:22 niro Exp $
3
4 #%rlevels: 7:s 0:k 6:k
5 #%start: 40
6 #%stop: 60
7
8 #deps
9 #%needs:
10 #%before:
11 #%after:
12
13 source /etc/sysconfig/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 mount -f /mnt/cdrom/livecdrootfs.sqsh /mnt/cloop -t ext2 -o ro
39 fi
40 else
41 echo -e ${COLOREDSTAR}"Remounting root file system in read-write mode ..."
42 mount -n -o remount,rw /
43 evaluate_retval
44 fi
45
46 echo -e ${COLOREDSTAR}"Recording existing mounts in /etc/mtab ..."
47 > /etc/mtab
48
49 mount -f / && mount -f /proc
50
51 # records devfs as mounted
52 if is_fs_mounted devfs
53 then
54 mount -f -t devfs devfs /dev
55 fi
56
57 # records devpts as mounted
58 if is_fs_mounted devpts
59 then
60 mount -f -t devpts devpts /dev/pts
61 fi
62
63 # records sysfs as mounted
64 if is_fs_mounted sysfs
65 then
66 mount -f -t sysfs sysfs /sys
67 fi
68
69 # records udev as mounted
70 if is_fs_mounted udev
71 then
72 # get the fstype of udev - it may be ramfs or tmpfs
73 udev_fstype="$(cat /proc/mounts | grep udev | cut -d ' ' -f3)"
74 # get the right mount opts - udev with tmpfs comes nosuid
75 udev_mopts="$(cat /proc/mounts | grep udev | cut -d ' ' -f4)"
76 mount -f -t ${udev_fstype} -o ${udev_mopts} udev /dev
77 fi
78
79 # records usbfs as mounted
80 if is_fs_mounted usbfs
81 then
82 mount -f -t usbfs usbfs /proc/bus/usb
83 fi
84
85 evaluate_retval
86
87 # The following mount command will mount all file systems. If you
88 # have other (network based) file system that should not be or
89 # cannot be mounted at this time, add them to the NO_FS variable
90 # below. All file systems that are added to the variable in the
91 # form of no<filesystem> will be skipped.
92
93 NO_FS="nonfs,nosmbfs,noproc,nocoda,noncpfs,noshm"
94 echo -e ${COLOREDSTAR}"Mounting remaining file systems ..."
95 mount -a -t $NO_FS
96 evaluate_retval
97
98 update_svcstatus $1
99 splash svc_started "$(basename $0)" 0
100 ;;
101
102 stop)
103 echo -e ${COLOREDSTAR}"Unmounting all other currently mounted file systems ..."
104 if [ -e /dev/.udev ]
105 then
106 NO_FS="noramfs"
107 umount -a -r -d -t ${NO_FS}
108 else
109 # -d, umount loop devices as well
110 umount -a -r -d
111 fi
112 evaluate_retval
113
114 if [ -e /.bootdev ] && [ -x /usr/bin/eject ]
115 then
116 echo -e ${COLOREDSTAR}"Trying to eject the live-media ..."
117 eject -m /mnt/cdrom &> /dev/null
118 evaluate_retval
119 fi
120
121 update_svcstatus $1
122 splash svc_stopped "$(basename $0)" 0
123 ;;
124
125 *)
126 echo "Usage: $0 {start|stop}"
127 exit 1
128 ;;
129 esac

Properties

Name Value
svn:executable *