Magellan Linux

Diff of /trunk/initscripts/sysvinit/rc/mountfs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

branches/unlabeled-1.1.1/magellan-initscripts/etc/rc.d/init.d/mountfs revision 2 by niro, Mon Dec 13 22:52:07 2004 UTC trunk/magellan-initscripts/rc/mountfs revision 1263 by niro, Fri Mar 11 17:44:48 2011 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2    # $Id$
3    
4  #%rlevels: 7:s 0:k 6:k  #%rlevels: 7:s 0:k 6:k
5  #%start: 40  #%start: 40
# Line 9  Line 10 
10  #%before:  #%before:
11  #%after:  #%after:
12    
13  source /etc/sysconfig/rc  source /etc/conf.d/rc
14  source $rc_functions  source ${rc_functions}
   
 #$1= filesys  
 get_mounted(){  
  local filesys  
  filesys=$1  
   
  cat /proc/mounts | grep ${filesys} | cut -d ' ' -f3  
 }  
15    
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 squashfs -o ro
39     fi
40     else
41     rc_print "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 ..."   rc_print "Recording existing mounts in /etc/mtab ..."
47   > /etc/mtab   > /etc/mtab
48    
49   mount -f / && mount -f /proc   mount -f / && mount -f /proc
  # add /dev above if you use devfs  
   
  #records devfs if mounted  
  if [ "$(get_mounted devfs)" == devfs ]  
  then  
  mount -f -t devfs none /dev  
  fi  
   
  #records devpts if mounted  
  if [ "$(get_mounted devpts)" == devpts ]  
  then  
  mount -f -t devpts none /dev/pts  
  fi  
50    
51   #records sysfs if mounted   # records devfs as mounted
52   if [ "$(get_mounted sysfs)" == sysfs ]   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   then
63   mount -f -t sysfs none /sys   # 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   fi
69    
70   #records udev's ramfs if mounted   # records mdev as mounted
71   if [ "$(get_mounted ramfs)" == ramfs ]   if is_fs_mounted mdev
72   then   then
73   mount -f -t ramfs none /dev   # 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   fi
79    
80     # records usbfs as mounted
81     is_fs_mounted usbfs && mount -f -t usbfs usbfs /proc/bus/usb
82    
83   evaluate_retval   evaluate_retval
84    
85   # The following mount command will mount all file systems. If you   # The following mount command will mount all file systems. If you
# Line 62  case "$1" in Line 87  case "$1" in
87   # cannot be mounted at this time, add them to the NO_FS variable   # 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   # below. All file systems that are added to the variable in the
89   # form of no<filesystem> will be skipped.   # form of no<filesystem> will be skipped.
90     NO_FS="noswap,nonfs,nosmbfs,noproc,nocoda,noncpfs,noshm"
91   #NO_FS="nonfs,nosmbfs,noproc"   rc_print "Mounting remaining file systems ..."
  NO_FS="nonfs,nosmbfs,noproc,nocoda,noncpfs,noshm"  
  echo -e ${COLOREDSTAR}"Mounting remaining file systems ..."  
92   mount -a -t $NO_FS   mount -a -t $NO_FS
93   evaluate_retval   evaluate_retval
94    
# Line 74  case "$1" in Line 97  case "$1" in
97   ;;   ;;
98    
99   stop)   stop)
100   echo -e ${COLOREDSTAR}"Unmounting all other currently mounted file systems ..."   rc_print "Unmounting all other currently mounted file systems ..."
101   if [ -e /dev/.udev ]   if [ -e /dev/.udev ]
102   then   then
103   NO_FS="noramfs"   NO_FS="noramfs,notmpfs,nodevtmpfs,nodevpts"
104   umount -a -r -d -t ${NO_FS}   umount -a -r -d -t ${NO_FS}
105   else   else
106   # -d, umount loop devices as well   # -d, umount loop devices as well
# Line 85  case "$1" in Line 108  case "$1" in
108   fi   fi
109   evaluate_retval   evaluate_retval
110    
111     if [ -e /.bootdev ] && [ -x /usr/bin/eject ]
112     then
113     rc_print "Trying to eject the live-media ..."
114     eject -m /mnt/cdrom &> /dev/null
115     evaluate_retval
116     fi
117    
118   update_svcstatus $1   update_svcstatus $1
119   splash svc_stopped "$(basename $0)" 0   splash svc_stopped "$(basename $0)" 0
120   ;;   ;;
121    
122   *)   *)
123   echo "Usage: $0 {start|stop}"   rc_echo "Usage: $0 {start|stop}"
124   exit 1   exit 1
125   ;;   ;;
126  esac  esac

Legend:
Removed from v.2  
changed lines
  Added in v.1263