Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- rc.S 2013-06-27 17:38:44.794766531 +0200
- +++ rc.S.new 2013-06-27 18:08:17.547509102 +0200
- @@ -146,114 +146,123 @@
- date
- fi
- -# Test to see if the root partition is read-only, like it ought to be.
- -READWRITE=no
- -if touch /fsrwtestfile 2>/dev/null; then
- - rm -f /fsrwtestfile
- - READWRITE=yes
- -else
- - echo "Testing root filesystem status: read-only filesystem"
- -fi
- -
- -# See if a forced filesystem check was requested at shutdown:
- -if [ -r /etc/forcefsck ]; then
- - FORCEFSCK="-f"
- -fi
- +# check if the rootfs type supports fsck at all
- +ROOTFSTYPE=$(/bin/findmnt -uno fstype '/')
- +FSCK_SKIP_LIST="jffs2 ubifs yaffs2"
- +[[ $FSCK_SKIP_LIST =~ $ROOTFSTYPE ]] && READWRITE=skip || READWRITE=no
- -# Check the root filesystem:
- -if [ ! $READWRITE = yes ]; then
- - RETVAL=0
- - if [ ! -r /etc/fastboot ]; then
- - echo "Checking root filesystem:"
- - /sbin/fsck $FORCEFSCK -C -a /
- - RETVAL=$?
- +# skip fsck, if rootfs type is in the skip list
- +if [ ! $READWRITE = skip ]; then
- + # Test to see if the root partition is read-only, like it ought to be.
- + READWRITE=no
- + if touch /fsrwtestfile 2>/dev/null; then
- + rm -f /fsrwtestfile
- + READWRITE=yes
- + else
- + echo "Testing root filesystem status: read-only filesystem"
- + fi
- +
- + # See if a forced filesystem check was requested at shutdown:
- + if [ -r /etc/forcefsck ]; then
- + FORCEFSCK="-f"
- fi
- - # An error code of 2 or higher will require a reboot.
- - if [ $RETVAL -ge 2 ]; then
- - # An error code equal to or greater than 4 means that some errors
- - # could not be corrected. This requires manual attention, so we
- - # offer a chance to try to fix the problem in single-user mode:
- - if [ $RETVAL -ge 4 ]; then
- - echo
- - echo "***********************************************************"
- - echo "*** An error occurred during the root filesystem check. ***"
- - echo "*** You will now be given a chance to log into the ***"
- - echo "*** system in single-user mode to fix the problem. ***"
- - echo "*** ***"
- - echo "*** If you are using the ext2 filesystem, running ***"
- - echo "*** 'e2fsck -v -y <partition>' might help. ***"
- - echo "***********************************************************"
- - echo
- - echo "Once you exit the single-user shell, the system will reboot."
- - echo
- - PS1="(Repair filesystem) \#"; export PS1
- - sulogin
- - else # With an error code of 2 or 3, reboot the machine automatically:
- - echo
- - echo "***********************************"
- - echo "*** The filesystem was changed. ***"
- - echo "*** The system will now reboot. ***"
- - echo "***********************************"
- +
- + # Check the root filesystem:
- + if [ ! $READWRITE = yes ]; then
- + RETVAL=0
- + if [ ! -r /etc/fastboot ]; then
- + echo "Checking root filesystem:"
- + /sbin/fsck $FORCEFSCK -C -a /
- + RETVAL=$?
- + fi
- + # An error code of 2 or higher will require a reboot.
- + if [ $RETVAL -ge 2 ]; then
- + # An error code equal to or greater than 4 means that some errors
- + # could not be corrected. This requires manual attention, so we
- + # offer a chance to try to fix the problem in single-user mode:
- + if [ $RETVAL -ge 4 ]; then
- + echo
- + echo "***********************************************************"
- + echo "*** An error occurred during the root filesystem check. ***"
- + echo "*** You will now be given a chance to log into the ***"
- + echo "*** system in single-user mode to fix the problem. ***"
- + echo "*** ***"
- + echo "*** If you are using the ext2 filesystem, running ***"
- + echo "*** 'e2fsck -v -y <partition>' might help. ***"
- + echo "***********************************************************"
- + echo
- + echo "Once you exit the single-user shell, the system will reboot."
- + echo
- + PS1="(Repair filesystem) \#"; export PS1
- + sulogin
- + else # With an error code of 2 or 3, reboot the machine automatically:
- + echo
- + echo "***********************************"
- + echo "*** The filesystem was changed. ***"
- + echo "*** The system will now reboot. ***"
- + echo "***********************************"
- + echo
- + fi
- + echo "Unmounting file systems."
- + /sbin/umount -a -r
- + /sbin/mount -n -o remount,ro /
- + echo "Rebooting system."
- + sleep 2
- + reboot -f
- + fi
- + # Remount the root filesystem in read-write mode
- + echo "Remounting root device with read-write enabled."
- + /sbin/mount -w -v -n -o remount /
- + if [ $? -gt 0 ] ; then
- + echo
- + echo "Attempt to remount root device as read-write failed! This is going to"
- + echo "cause serious problems."
- + echo
- + echo "If you're using the UMSDOS filesystem, you **MUST** mount the root partition"
- + echo "read-write! You can make sure the root filesystem is getting mounted "
- + echo "read-write with the 'rw' flag to Loadlin:"
- + echo
- + echo "loadlin vmlinuz root=/dev/hda1 rw (replace /dev/hda1 with your root device)"
- + echo
- + echo "Normal bootdisks can be made to mount a system read-write with the rdev command:"
- + echo
- + echo "rdev -R /dev/fd0 0"
- + echo
- + echo "You can also get into your system by using a boot disk with a command like this"
- + echo "on the LILO prompt line: (change the root partition name as needed)"
- + echo
- + echo "LILO: mount root=/dev/hda1 rw"
- echo
- + echo "Please press ENTER to continue, then reboot and use one of the above methods to"
- + echo -n "get into your machine and start looking for the problem. "
- + read junk;
- fi
- - echo "Unmounting file systems."
- - /sbin/umount -a -r
- - /sbin/mount -n -o remount,ro /
- - echo "Rebooting system."
- - sleep 2
- - reboot -f
- - fi
- - # Remount the root filesystem in read-write mode
- - echo "Remounting root device with read-write enabled."
- - /sbin/mount -w -v -n -o remount /
- - if [ $? -gt 0 ] ; then
- - echo
- - echo "Attempt to remount root device as read-write failed! This is going to"
- - echo "cause serious problems."
- - echo
- - echo "If you're using the UMSDOS filesystem, you **MUST** mount the root partition"
- - echo "read-write! You can make sure the root filesystem is getting mounted "
- - echo "read-write with the 'rw' flag to Loadlin:"
- - echo
- - echo "loadlin vmlinuz root=/dev/hda1 rw (replace /dev/hda1 with your root device)"
- - echo
- - echo "Normal bootdisks can be made to mount a system read-write with the rdev command:"
- - echo
- - echo "rdev -R /dev/fd0 0"
- - echo
- - echo "You can also get into your system by using a boot disk with a command like this"
- - echo "on the LILO prompt line: (change the root partition name as needed)"
- - echo
- - echo "LILO: mount root=/dev/hda1 rw"
- - echo
- - echo "Please press ENTER to continue, then reboot and use one of the above methods to"
- - echo -n "get into your machine and start looking for the problem. "
- - read junk;
- - fi
- + else
- + echo "Testing root filesystem status: read-write filesystem"
- + echo
- + echo "*** ERROR: Root partition has already been mounted read-write. Cannot check!"
- + echo
- + echo "For filesystem checking to work properly, your system must initially mount"
- + echo "the root partition as read only. Please modify your kernel with 'rdev' so that"
- + echo "it does this. If you're booting with LILO, add a line:"
- + echo
- + echo " read-only"
- + echo
- + echo "to the Linux section in your /etc/lilo.conf and type 'lilo' to reinstall it."
- + echo
- + echo "If you boot from a kernel on a floppy disk, put it in the drive and type:"
- + echo " rdev -R /dev/fd0 1"
- + echo
- + echo "If you boot from a bootdisk, or with Loadlin, you can add the 'ro' flag."
- + echo
- + echo "This will fix the problem *AND* eliminate this annoying message. :^)"
- + echo
- + echo -n "Press ENTER to continue. "
- + read junk;
- + fi # Done checking root filesystem
- else
- - echo "Testing root filesystem status: read-write filesystem"
- - echo
- - echo "*** ERROR: Root partition has already been mounted read-write. Cannot check!"
- - echo
- - echo "For filesystem checking to work properly, your system must initially mount"
- - echo "the root partition as read only. Please modify your kernel with 'rdev' so that"
- - echo "it does this. If you're booting with LILO, add a line:"
- - echo
- - echo " read-only"
- - echo
- - echo "to the Linux section in your /etc/lilo.conf and type 'lilo' to reinstall it."
- - echo
- - echo "If you boot from a kernel on a floppy disk, put it in the drive and type:"
- - echo " rdev -R /dev/fd0 1"
- - echo
- - echo "If you boot from a bootdisk, or with Loadlin, you can add the 'ro' flag."
- - echo
- - echo "This will fix the problem *AND* eliminate this annoying message. :^)"
- - echo
- - echo -n "Press ENTER to continue. "
- - read junk;
- -fi # Done checking root filesystem
- -
- + echo "The root filesystem type ($ROOTFSTYPE) does not support fsck"
- +fi
- # Any /etc/mtab that exists here is old, so we start with a new one:
- /bin/rm -f /etc/mtab{,~,.tmp} && /bin/touch /etc/mtab
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement