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.

82 lines
2.7 KiB

  1. #!/bin/sh
  2. #
  3. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  4. #
  5. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  6. # Please add additional copyright information _after_ the line containing
  7. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  8. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  9. #
  10. # ROCK Linux: rock-src/package/base/sysfiles/system.init
  11. # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
  12. #
  13. # This program is free software; you can redistribute it and/or modify
  14. # it under the terms of the GNU General Public License as published by
  15. # the Free Software Foundation; either version 2 of the License, or
  16. # (at your option) any later version. A copy of the GNU General Public
  17. # License can be found at Documentation/COPYING.
  18. #
  19. # Many people helped and are helping developing ROCK Linux. Please
  20. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  21. # file for details.
  22. #
  23. # --- ROCK-COPYRIGHT-NOTE-END ---
  24. #
  25. # Desc: Mounting local filesystems
  26. # Runlevel: 05 rcX rc1 rc2 rc3 rc4 rc5
  27. #
  28. main_begin
  29. block_begin(start, `Checking file systems.')
  30. fsck -A -C -a ; fsckrc=$?
  31. if [ $(( $fsckrc & ~3 )) != 0 ] ; then
  32. echo " **"
  33. echo " ** Filesystem check failed (returncode=$fsckrc)."
  34. echo " ** Please repair the broken disk(s) manually."
  35. echo " **"
  36. sulogin -t 600 /dev/console
  37. umount -adrv ; /sbin/reboot -d -f
  38. while true ; do sleep 1 ; done
  39. elif [ $(( $fsckrc & 2 )) != 0 ] ; then
  40. for x in 10 9 8 7 6 5 4 3 2 ; do
  41. echo -en "\rSystem reboot in $x seconds ... "
  42. sleep 1
  43. done ; echo -e "\rSystem reboot now! "
  44. umount -adrv ; /sbin/reboot -d -f
  45. while true ; do sleep 1 ; done
  46. fi
  47. dnl
  48. if [ -s /etc/lvmtab ]; then
  49. block_split(`Activating volume groups.')
  50. check(`/sbin/vgchange -ay')
  51. fi
  52. dnl
  53. block_split(`Mounting local file systems.')
  54. check(`mount -n -o remount,rw /')
  55. rootdev="/dev/$(ls -l /dev/root 2> /dev/null | sed 's,.* -> ,,')"
  56. if [ "$rootdev" = "/dev/" ]; then
  57. rootdev="$( sed 's, ,\n,g' < /proc/cmdline | \
  58. grep ^root= | cut -f2- -d= )"
  59. [ -z "$rootdev" ] && rootdev="/dev/root"
  60. fi
  61. check(`grep -v "^rootfs " /proc/mounts | \
  62. sed "s,^/dev/root ,$rootdev ," > /etc/mtab')
  63. check(`mount -a -t nocoda,nfs,devfs,proc,sysfs')
  64. block_end
  65. block_begin(stop, `Remounting sync/ro and unmounting filesystems.')
  66. cut -d' ' -f-3 /etc/mtab /proc/mounts | sort -k2 -u -r | \
  67. while read dev dir fs ; do
  68. [ "$dir" = "/" ] && continue
  69. [ "$dir" = "/dev" ] && continue
  70. [ "$dir" = "/dev/shm" ] && continue
  71. [ "$dir" = "/proc" ] && continue
  72. [ "$dir" = "/sys" ] && continue
  73. [ "$dir" = "/tmp" ] && continue
  74. echo "Unmounting $dev on $dir ($fs)."
  75. mount -o remount,sync $dir
  76. mount -o remount,ro $dir
  77. umount -d $dir
  78. done
  79. block_end
  80. main_end