Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 781 - (hide annotations) (download)
Mon Dec 22 22:01:15 2008 UTC (15 years, 4 months ago) by niro
File size: 2390 byte(s)
-use /etc/conf.d/rc instead of /etc/sysconfig/rc

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

Properties

Name Value
svn:executable *