bug in checkroot script

Georg Wilckens durandal at nfinity.de
Fri Jun 2 15:32:04 PDT 2000


Hello folks,

I just noticed the following in the checkroot-rc-Script as published
in LFS-2.3.3. Hope this hasn't been posted here 100 times yet:

     #!/bin/sh
     # Begin /etc/init.d/checkroot
     echo -n "Activating swap..."
     /sbin/swapon -a
     if [ -f /fastboot ]

What if we are not fastbooting? The following code up to the last if
isn't being executed at all. Also don't we have to remove the fastboot
file after evaluating it? As it seems, fsck will be executed _only_ if
/fastboot is present. So we don't get fscks on a normal installation
at all currently.

     then
       echo "Fast boot, no file system check"
       /bin/mount -n -o remount,ro /

I guess we should have an "else" here.

       if [ $? = 0 ]

Can mount return a non-zero value in this setup?

       then
         if [ -f /forcecheck ]
         then
           force="-f"
         else
           force=""
         fi
         echo "Checking root file system..."
         /sbin/fsck $force -a /
         if [ $? -gt 1 ]
         then
           echo
           echo "fsck failed. Please repair your file system manually by"
           echo "running /sbin/fsck without the -a option"
           echo
           echo "Please note that the file system is currently mounted in"
                   echo "read-only mode."
           echo
             echo "I will start sulogin now. CTRL+D will reboot your system."
           echo
                   /sbin/sulogin
                   /sbin/reboot -f
         fi
       else
         echo "Cannot check root file system because it is not mounted in"
         echo "read-only mode."
       fi
     fi
     # End /etc/init.d/checkroot

If I am missing something, please flame me.

Regards,
	Georg
-- 
Georg Wilckens <durandal at nfinity.de>

Anyone who isn't confused really doesn't understand the situation.
--
Mail archive: http://www.pcrdallas.com/mail-archives/lfs-discuss
IRC access: server: irc.linuxfromscratch.org port: 6667 channel: #LFS
Unsubscribe: email lfs-discuss-request at linuxfromscratch.org and put
"unsubscribe" (without the quotation marks) in the body of the message
(no subject is required)



More information about the lfs-dev mailing list