mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

97 lines
3.4 KiB

#!/bin/sh
#
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/package/base/sysfiles/system.init
# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
#
# Desc: Mounting local filesystems
# Runlevel: 05 rcX rc1 rc2 rc3 rc4 rc5
#
main_begin
block_begin(start, `Checking file systems.')
if ! mount / -o remount,ro ; then
fsck_root=-R
fi
fsck -A -C -a $fsck_root ; fsckrc=$?
if [ "$fsckrc" != 0 ] ; then
echo "'fsck -A -C -a $fsck_root' returned the following:"
[ $(( $fsckrc & 1 )) != 0 ] && echo "file system errors corrected"
[ $(( $fsckrc & 2 )) != 0 ] && echo "system should be rebooted"
[ $(( $fsckrc & 4 )) != 0 ] && echo "file system errors left uncorrected"
[ $(( $fsckrc & 8 )) != 0 ] && echo "operational error"
[ $(( $fsckrc & 16 )) != 0 ] && echo "usage or syntax error"
[ $(( $fsckrc & 32 )) != 0 ] && echo "fsck canceled by user request"
[ $(( $fsckrc & 128 )) != 0 ] && echo "shared library error"
fi
echo
if [ $(( $fsckrc & 4 )) != 0 ] ; then
echo " Please repair the broken disk(s) manually."
if [ $(( $fsckrc & 2 )) != 0 ] ; then
echo "When you exit the shell, the system will reboot as recommended by fsck."
else
echo "Afterwards, exit the shell to continue booting or reboot the system if needed."
fi
sulogin -t 600 /dev/console
fi
if [ $(( $fsckrc & 2 )) != 0 ] ; then
for x in 10 9 8 7 6 5 4 3 2 ; do
echo -en "\rSystem reboot in $x seconds ... "
sleep 1
done ; echo -e "\rSystem reboot now! "
umount -adrv ; /sbin/reboot -d -f
while true ; do sleep 1 ; done
fi
dnl
if [ -s /etc/lvmtab ]; then
block_split(`Activating volume groups.')
check(`/sbin/vgchange -ay')
fi
dnl
block_split(`Mounting local file systems.')
check(`mount -n -o remount,rw /')
rootdev="/dev/$(ls -l /dev/root 2> /dev/null | sed 's,.* -> ,,')"
if [ "$rootdev" = "/dev/" ]; then
rootdev="$( sed 's, ,\n,g' < /proc/cmdline | \
grep ^root= | cut -f2- -d= )"
[ -z "$rootdev" ] && rootdev="/dev/root"
fi
check(`grep -v "^rootfs " /proc/mounts | \
sed "s,^/dev/root ,$rootdev ," > /etc/mtab')
check(`mount -a -t nocoda,nfs,devfs,proc,sysfs')
block_end
block_begin(stop, `Remounting sync/ro and unmounting filesystems.')
cut -d' ' -f-3 /etc/mtab /proc/mounts | sort -k2 -u -r | \
while read dev dir fs ; do
[ "$dir" = "/" ] && continue
[ "$dir" = "/dev" ] && continue
[ "$dir" = "/dev/shm" ] && continue
[ "$dir" = "/proc" ] && continue
[ "$dir" = "/sys" ] && continue
[ "$dir" = "/tmp" ] && continue
echo "Unmounting $dev on $dir ($fs)."
mount -o remount,sync $dir
mount -o remount,ro $dir
umount -d $dir
done
block_end
main_end