#!/bin/bash #%rlevels: 7:s 0:k 6:k #%start: 40 #%stop: 60 #deps #%needs: #%before: #%after: source /etc/sysconfig/rc source $rc_functions #$1= filesys get_mounted(){ local filesys filesys=$1 cat /proc/mounts | grep ${filesys} | cut -d ' ' -f3 } case "$1" in start) echo -e ${COLOREDSTAR}"Remounting root file system in read-write mode ..." mount -n -o remount,rw / evaluate_retval echo -e ${COLOREDSTAR}"Recording existing mounts in /etc/mtab ..." > /etc/mtab mount -f / && mount -f /proc #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 #records sysfs if mounted if [ "$(get_mounted sysfs)" == sysfs ] then mount -f -t sysfs none /sys fi #records udev's ramfs if mounted if [ "$(get_mounted ramfs)" == ramfs ] then mount -f -t ramfs none /dev fi evaluate_retval # The following mount command will mount all file systems. If you # have other (network based) file system that should not be or # cannot be mounted at this time, add them to the NO_FS variable # below. All file systems that are added to the variable in the # form of no will be skipped. NO_FS="nonfs,nosmbfs,noproc,nocoda,noncpfs,noshm" echo -e ${COLOREDSTAR}"Mounting remaining file systems ..." mount -a -t $NO_FS evaluate_retval update_svcstatus $1 splash svc_started "$(basename $0)" 0 ;; stop) echo -e ${COLOREDSTAR}"Unmounting all other currently mounted file systems ..." if [ -e /dev/.udev ] then NO_FS="noramfs" umount -a -r -d -t ${NO_FS} else # -d, umount loop devices as well umount -a -r -d fi evaluate_retval update_svcstatus $1 splash svc_stopped "$(basename $0)" 0 ;; *) echo "Usage: $0 {start|stop}" exit 1 ;; esac