1 |
#!/bin/bash |
#!/bin/bash |
2 |
# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/mountfs,v 1.3 2005-03-15 19:07:56 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/mountfs,v 1.5 2006-02-25 12:23:28 niro Exp $ |
3 |
|
|
4 |
#%rlevels: 7:s 0:k 6:k |
#%rlevels: 7:s 0:k 6:k |
5 |
#%start: 40 |
#%start: 40 |
13 |
source /etc/sysconfig/rc |
source /etc/sysconfig/rc |
14 |
source $rc_functions |
source $rc_functions |
15 |
|
|
|
#$1= filesys |
|
|
get_mounted(){ |
|
|
local filesys |
|
|
filesys=$1 |
|
|
|
|
|
cat /proc/mounts | grep ${filesys} | cut -d ' ' -f3 |
|
|
} |
|
|
|
|
16 |
case "$1" in |
case "$1" in |
17 |
start) |
start) |
18 |
echo -e ${COLOREDSTAR}"Remounting root file system in read-write mode ..." |
# fake mounts rootfs (taken from /.bootdev) |
19 |
mount -n -o remount,rw / |
if [ -e /.bootdev ] |
20 |
evaluate_retval |
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 ..." |
echo -e ${COLOREDSTAR}"Recording existing mounts in /etc/mtab ..." |
47 |
> /etc/mtab |
> /etc/mtab |
48 |
|
|
49 |
mount -f / && mount -f /proc |
mount -f / && mount -f /proc |
50 |
|
|
51 |
#records devfs if mounted |
# records devfs as mounted |
52 |
if [ "$(get_mounted devfs)" == devfs ] |
if is_fs_mounted devfs |
53 |
then |
then |
54 |
mount -f -t devfs none /dev |
mount -f -t devfs devfs /dev |
55 |
fi |
fi |
56 |
|
|
57 |
#records devpts if mounted |
# records devpts as mounted |
58 |
if [ "$(get_mounted devpts)" == devpts ] |
if is_fs_mounted devpts |
59 |
then |
then |
60 |
mount -f -t devpts none /dev/pts |
mount -f -t devpts devpts /dev/pts |
61 |
fi |
fi |
62 |
|
|
63 |
#records sysfs if mounted |
# records sysfs as mounted |
64 |
if [ "$(get_mounted sysfs)" == sysfs ] |
if is_fs_mounted sysfs |
65 |
then |
then |
66 |
mount -f -t sysfs none /sys |
mount -f -t sysfs sysfs /sys |
67 |
fi |
fi |
68 |
|
|
69 |
#records udev's ramfs if mounted |
# records udev as mounted |
70 |
if [ "$(get_mounted ramfs)" == ramfs ] |
if is_fs_mounted udev |
71 |
then |
then |
72 |
mount -f -t ramfs none /dev |
mount -f -t ramfs udev /dev |
73 |
fi |
fi |
74 |
|
|
75 |
evaluate_retval |
evaluate_retval |
101 |
fi |
fi |
102 |
evaluate_retval |
evaluate_retval |
103 |
|
|
104 |
|
if [ -e /.bootdev ] && [ -x /usr/bin/eject ] |
105 |
|
then |
106 |
|
echo -e ${COLOREDSTAR}"Ejecting livecd disc ..." |
107 |
|
eject -m /mnt/cdrom &> /dev/null |
108 |
|
evaluate_retval |
109 |
|
fi |
110 |
|
|
111 |
update_svcstatus $1 |
update_svcstatus $1 |
112 |
splash svc_stopped "$(basename $0)" 0 |
splash svc_stopped "$(basename $0)" 0 |
113 |
;; |
;; |