[arch-general] [PATCH 33/48] Bashified fscking.

Victor Lowther victor.lowther at gmail.com
Wed Jun 30 17:47:45 EDT 2010


---
 rc.sysinit |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/rc.sysinit b/rc.sysinit
index d54b9bb..91ee03a 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -181,7 +181,7 @@ fi
 status "Mounting Root Read-only" /bin/mount -n -o remount,ro /
 
 FORCEFSCK=
-[ -f /forcefsck ] && FORCEFSCK="-- -f"
+[[ -f /forcefsck ]] && FORCEFSCK="-- -f"
 NETFS="nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,noshfs,nofuse,nofuseblk,noglusterfs"
 
 fsck_reboot() {
@@ -192,7 +192,7 @@ fsck_reboot() {
 	exit 0
 }
 
-if [ -x /sbin/fsck ]; then
+if [[ -x /sbin/fsck ]]; then
 	stat_busy "Checking Filesystems"
 	FSCK_OUT=/dev/stdout
 	FSCK_ERR=/dev/stdout
@@ -200,11 +200,11 @@ if [ -x /sbin/fsck ]; then
 	run_hook sysinit_prefsck
 	/sbin/fsck -A -T -C$FSCK_FD -a -t "$NETFS,noopts=_netdev" $FORCEFSCK >$FSCK_OUT 2>$FSCK_ERR
 	fsckret=$?
-	if [ ${fsckret} -gt 1 ]; then
+	if ((fsckret > 1)); then
 		stat_fail
 	fi
 	run_hook sysinit_postfsck
-	if [ $((${fsckret}&2)) -eq 2 ]; then
+	if (( ( fsckret & 2) == 2)); then
 		echo
 		echo "********************** REBOOT REQUIRED *********************"
 		echo "*                                                          *"
@@ -214,8 +214,7 @@ if [ -x /sbin/fsck ]; then
 		echo
 		/bin/sleep 15
 		fsck_reboot
-	fi
-	if [ ${fsckret} -gt 1 -a ${fsckret} -ne 32 ]; then
+	elif ((fsckret > 1 && fsckret != 32)); then
 		echo
 		echo "*****************  FILESYSTEM CHECK FAILED  ****************"
 		echo "*                                                          *"
-- 
1.7.1



More information about the arch-general mailing list