Magellan Linux

Diff of /trunk/magellan-initscripts/etc/rc.d/init.d/checkfs

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

revision 1252 by niro, Thu Nov 5 12:57:14 2009 UTC revision 1253 by niro, Fri Mar 11 17:20:16 2011 UTC
# Line 13  Line 13 
13  source /etc/conf.d/rc  source /etc/conf.d/rc
14  source ${rc_functions}  source ${rc_functions}
15    
16  # stops annoying kernel messages  case "$1" in
17  echo "0" > /proc/sys/kernel/printk   start)
18     # stops annoying kernel messages
19  if [ -f /fastboot ]   echo "0" > /proc/sys/kernel/printk
20  then  
21   echo "Fast boot requested, will not perform file system checks ..."   if [ -f /fastboot ]
22   exit 0   then
23  fi   rc_echo "Fast boot requested, will not perform file system checks ..."
24     exit 0
25  echo -e ${COLOREDSTAR}"Mounting root file system in read-only mode ..."   fi
26  mount -n -o remount,ro /  
27  evaluate_retval   rc_print "Mounting root file system in read-only mode ..."
28     mount -n -o remount,ro /
29  if [ $? != 0 ]   evaluate_retval
30  then  
31   $FAILURE   if [ $? != 0 ]
32   echo   then
33   echo "Cannot check root file system because it could not"   $FAILURE
34   echo "be mounted in read-only mode."   rc_echo
35   echo   rc_echo "Cannot check root file system because it could not"
36   echo -n "When you press enter, this system will be halted."   rc_echo "be mounted in read-only mode."
37   $NORMAL   rc_echo
38   echo   rc_echo -n "When you press enter, this system will be halted."
39   echo "Press enter to continue ..."   $NORMAL
40   read   rc_echo
41   echo "gonna run: $rc_base/init.d/halt"   rc_echo "Press enter to continue ..."
42   $rc_base/init.d/halt   read
43  fi   rc_echo "gonna run: $rc_base/init.d/halt"
44     $rc_base/init.d/halt
45  if [ -f /forcefsck ]   fi
46  then  
47   echo "/forcefsck exists, forcing file system check"   if [ -f /forcefsck ]
48   options="-f"   then
49  else   rc_echo "/forcefsck exists, forcing file system check"
50   options=""   options="-f"
51  fi   else
52     options=""
53  echo -e ${COLOREDSTAR}"Checking file systems ..."   fi
54  #Note: -a option used to be -p; but this fails e.g. on fsck.minix  
55  fsck $options -a -A -C -T   rc_print "Checking file systems ..."
56  error_value=$?   #Note: -a option used to be -p; but this fails e.g. on fsck.minix
57     fsck $options -a -A -C -T
58  if [ "$error_value" = 1 ]   error_value=$?
59  then  
60   $WARNING   if [ "$error_value" = 1 ]
61   echo "File system errors were found and have been corrected."   then
62   echo "You may want to double-check that everything was fixed"   $WARNING
63   echo -n "properly"   rc_echo "File system errors were found and have been corrected."
64   $NORMAL   rc_echo "You may want to double-check that everything was fixed"
65   print_status warning   rc_echo -n "properly"
66  fi   $NORMAL
67     print_status warning
68  if [ "$error_value" = 0 ]   fi
69  then  
70   print_status success   if [ "$error_value" = 0 ]
71  fi   then
72     print_status success
73  if [ "$error_value" = 2 ]   fi
74  then  
75   $WARNING   if [ "$error_value" = 2 ]
76   echo "File system errors were found and have been corrected, but"   then
77   echo "the nature of the errors require this system to be rebooted."   $WARNING
78   echo   rc_echo "File system errors were found and have been corrected, but"
79   echo -n "When you press enter, this system will be rebooted."   rc_echo "the nature of the errors require this system to be rebooted."
80   $NORMAL   rc_echo
81   print_status warning   rc_echo -n "When you press enter, this system will be rebooted."
82   echo   $NORMAL
83   echo "Please press enter to continue ..."   print_status warning
84   read   rc_echo
85   $rc_base/init.d/reboot   rc_echo "Please press enter to continue ..."
86  fi   read
87     $rc_base/init.d/reboot
88  if [ "$error_value" -gt 2 -a "$error_value" -lt 16 ]   fi
89  then  
90   $FAILURE   if [ "$error_value" -gt 2 -a "$error_value" -lt 16 ]
91   echo "File system errors were encountered that couldn't be"   then
92   echo "fixed automatically. This system cannot continue to boot"   $FAILURE
93   echo "and will therefore be halted until those errors fixed manually"   rc_echo "File system errors were encountered that couldn't be"
94   echo "by a System Administrator."   rc_echo "fixed automatically. This system cannot continue to boot"
95   echo   rc_echo "and will therefore be halted until those errors fixed manually"
96   echo -n "When you press enter, this system will be halted."   rc_echo "by a System Administrator."
97   $NORMAL   rc_echo
98   print_status failure   rc_echo -n "When you press enter, this system will be halted."
99   echo   $NORMAL
100   echo "Press enter to continue ..."   print_status failure
101   read   rc_echo
102   $rc_base/init.d/halt   rc_echo "Press enter to continue ..."
103  fi   rc_echo
104     $rc_base/init.d/halt
105  #sets default level for kernel messages   fi
106  echo "3" > /proc/sys/kernel/printk  
107     #sets default level for kernel messages
108  update_svcstatus $1   echo "3" > /proc/sys/kernel/printk
109  splash svc_started "$(basename $0)" 0  
110     update_svcstatus $1
111     splash svc_started "$(basename $0)" 0
112     ;;
113    
114     *)
115     rc_echo "Usage: $0 {start}"
116     exit 1
117     ;;
118    esac

Legend:
Removed from v.1252  
changed lines
  Added in v.1253