1 |
#!/bin/bash |
#!/bin/bash |
2 |
|
# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/mountfslivecd,v 1.3 2005-03-15 19:07:56 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 |
|
|
16 |
|
get_mounted(){ |
17 |
|
local filesys |
18 |
|
filesys=$1 |
19 |
|
|
20 |
|
cat /proc/mounts | grep ${filesys} | cut -d ' ' -f3 |
21 |
|
} |
22 |
|
|
23 |
|
|
24 |
case "$1" in |
case "$1" in |
25 |
start) |
start) |
26 |
echo -e ${COLOREDSTAR}"Recording existing mounts in /etc/mtab ..." |
echo -e ${COLOREDSTAR}"Recording existing mounts in /etc/mtab ..." |
27 |
> /etc/mtab |
> /etc/mtab |
28 |
|
|
29 |
#fake mount rootfs (taken from /.bootdev) |
#fake mount rootfs (taken from /.bootdev) |
30 |
if [ -e /.bootdev ] |
if [ -e /.bootdev ] |
31 |
then |
then |
35 |
#wanna check if usbstorage or not |
#wanna check if usbstorage or not |
36 |
#rm /.bootdev |
#rm /.bootdev |
37 |
fi |
fi |
38 |
|
|
39 |
#fake mount cloop |
#fake mount cloop, loop or sqsh |
40 |
mount -f /mnt/cdrom/livecdrootfs.cloop /mnt/cloop -t ext2 -o ro |
if [ -f /mnt/cdrom/livecdrootfs.loop ] |
41 |
|
then |
42 |
#fake mount dev |
mount -f /mnt/cdrom/livecdrootfs.loop /mnt/cloop -t ext2 -o ro |
43 |
mount -f devfs /dev -t devfs -o rw |
|
44 |
|
elif [ -f /mnt/cdrom/livecdrootfs.cloop ] |
45 |
|
then |
46 |
|
mount -f /mnt/cdrom/livecdrootfs.cloop /mnt/cloop -t ext2 -o ro |
47 |
|
|
48 |
|
elif [ -f /mnt/cdrom/livecdrootfs.sqsh ] |
49 |
|
then |
50 |
|
mount -f /mnt/cdrom/livecdrootfs.sqsh /mnt/cloop -t ext2 -o ro |
51 |
|
fi |
52 |
|
|
53 |
|
#records devfs if mounted |
54 |
|
if [ "$(get_mounted devfs)" == devfs ] |
55 |
|
then |
56 |
|
mount -f -t devfs none /dev |
57 |
|
fi |
58 |
|
|
59 |
|
#records devpts if mounted |
60 |
|
if [ "$(get_mounted devpts)" == devpts ] |
61 |
|
then |
62 |
|
mount -f -t devpts none /dev/pts |
63 |
|
fi |
64 |
|
|
65 |
|
#records sysfs if mounted |
66 |
|
if [ "$(get_mounted sysfs)" == sysfs ] |
67 |
|
then |
68 |
|
mount -f -t sysfs none /sys |
69 |
|
fi |
70 |
|
|
71 |
|
#records udev's ramfs if mounted |
72 |
|
if [ "$(get_mounted ramfs)" == ramfs ] |
73 |
|
then |
74 |
|
mount -f -t ramfs none /dev |
75 |
|
fi |
76 |
|
|
77 |
#fake mount tmpfs |
#fake mount tmpfs |
78 |
mount -f tmpfs / -t tmpfs -o rw |
mount -f tmpfs / -t tmpfs -o rw |
79 |
|
|