Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1253 - (hide annotations) (download)
Fri Mar 11 17:20:16 2011 UTC (13 years, 2 months ago) by niro
File size: 2571 byte(s)
-respect start|stop pragma
-use rc_print and rc_echo

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

Properties

Name Value
svn:executable *