Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (hide annotations) (download)
Mon Dec 13 22:52:07 2004 UTC (19 years, 4 months ago) by niro
Original Path: branches/unlabeled-1.1.1/magellan-initscripts/etc/rc.d/init.d/checkfs
File size: 2261 byte(s)
imported.

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

Properties

Name Value
svn:executable *