daily pastebin goal
84%
SHARE
TWEET

Untitled

a guest Jun 27th, 2013 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- rc.S        2013-06-27 17:38:44.794766531 +0200
  2. +++ rc.S.new    2013-06-27 18:08:17.547509102 +0200
  3. @@ -146,114 +146,123 @@
  4.    date
  5.  fi
  6.  
  7. -# Test to see if the root partition is read-only, like it ought to be.
  8. -READWRITE=no
  9. -if touch /fsrwtestfile 2>/dev/null; then
  10. -  rm -f /fsrwtestfile
  11. -  READWRITE=yes
  12. -else
  13. -  echo "Testing root filesystem status:  read-only filesystem"
  14. -fi
  15. -
  16. -# See if a forced filesystem check was requested at shutdown:
  17. -if [ -r /etc/forcefsck ]; then
  18. -  FORCEFSCK="-f"
  19. -fi
  20. +# check if the rootfs type supports fsck at all
  21. +ROOTFSTYPE=$(/bin/findmnt -uno fstype '/')
  22. +FSCK_SKIP_LIST="jffs2 ubifs yaffs2"
  23. +[[ $FSCK_SKIP_LIST =~ $ROOTFSTYPE ]] && READWRITE=skip || READWRITE=no
  24.  
  25. -# Check the root filesystem:
  26. -if [ ! $READWRITE = yes ]; then
  27. -  RETVAL=0
  28. -  if [ ! -r /etc/fastboot ]; then
  29. -    echo "Checking root filesystem:"
  30. -    /sbin/fsck $FORCEFSCK -C -a /
  31. -    RETVAL=$?
  32. +# skip fsck, if rootfs type is in the skip list
  33. +if [ ! $READWRITE = skip ]; then
  34. +  # Test to see if the root partition is read-only, like it ought to be.
  35. +  READWRITE=no
  36. +  if touch /fsrwtestfile 2>/dev/null; then
  37. +    rm -f /fsrwtestfile
  38. +    READWRITE=yes
  39. +  else
  40. +    echo "Testing root filesystem status:  read-only filesystem"
  41. +  fi
  42. +  
  43. +  # See if a forced filesystem check was requested at shutdown:
  44. +  if [ -r /etc/forcefsck ]; then
  45. +    FORCEFSCK="-f"
  46.    fi
  47. -  # An error code of 2 or higher will require a reboot.
  48. -  if [ $RETVAL -ge 2 ]; then
  49. -    # An error code equal to or greater than 4 means that some errors
  50. -    # could not be corrected.  This requires manual attention, so we
  51. -    # offer a chance to try to fix the problem in single-user mode:
  52. -    if [ $RETVAL -ge 4 ]; then
  53. -      echo
  54. -      echo "***********************************************************"
  55. -      echo "*** An error occurred during the root filesystem check. ***"
  56. -      echo "*** You will now be given a chance to log into the      ***"
  57. -      echo "*** system in single-user mode to fix the problem.      ***"
  58. -      echo "***                                                     ***"
  59. -      echo "*** If you are using the ext2 filesystem, running       ***"
  60. -      echo "*** 'e2fsck -v -y <partition>' might help.              ***"
  61. -      echo "***********************************************************"
  62. -      echo
  63. -      echo "Once you exit the single-user shell, the system will reboot."
  64. -      echo
  65. -      PS1="(Repair filesystem) \#"; export PS1
  66. -      sulogin
  67. -    else # With an error code of 2 or 3, reboot the machine automatically:
  68. -      echo
  69. -      echo "***********************************"
  70. -      echo "*** The filesystem was changed. ***"
  71. -      echo "*** The system will now reboot. ***"
  72. -      echo "***********************************"
  73. +  
  74. +  # Check the root filesystem:
  75. +  if [ ! $READWRITE = yes ]; then
  76. +    RETVAL=0
  77. +    if [ ! -r /etc/fastboot ]; then
  78. +      echo "Checking root filesystem:"
  79. +      /sbin/fsck $FORCEFSCK -C -a /
  80. +      RETVAL=$?
  81. +    fi
  82. +    # An error code of 2 or higher will require a reboot.
  83. +    if [ $RETVAL -ge 2 ]; then
  84. +      # An error code equal to or greater than 4 means that some errors
  85. +      # could not be corrected.  This requires manual attention, so we
  86. +      # offer a chance to try to fix the problem in single-user mode:
  87. +      if [ $RETVAL -ge 4 ]; then
  88. +        echo
  89. +        echo "***********************************************************"
  90. +        echo "*** An error occurred during the root filesystem check. ***"
  91. +        echo "*** You will now be given a chance to log into the      ***"
  92. +        echo "*** system in single-user mode to fix the problem.      ***"
  93. +        echo "***                                                     ***"
  94. +        echo "*** If you are using the ext2 filesystem, running       ***"
  95. +        echo "*** 'e2fsck -v -y <partition>' might help.              ***"
  96. +        echo "***********************************************************"
  97. +        echo
  98. +        echo "Once you exit the single-user shell, the system will reboot."
  99. +        echo
  100. +        PS1="(Repair filesystem) \#"; export PS1
  101. +        sulogin
  102. +      else # With an error code of 2 or 3, reboot the machine automatically:
  103. +        echo
  104. +        echo "***********************************"
  105. +        echo "*** The filesystem was changed. ***"
  106. +        echo "*** The system will now reboot. ***"
  107. +        echo "***********************************"
  108. +        echo
  109. +      fi
  110. +      echo "Unmounting file systems."
  111. +      /sbin/umount -a -r
  112. +      /sbin/mount -n -o remount,ro /
  113. +      echo "Rebooting system."
  114. +      sleep 2
  115. +      reboot -f
  116. +    fi
  117. +    # Remount the root filesystem in read-write mode
  118. +    echo "Remounting root device with read-write enabled."
  119. +    /sbin/mount -w -v -n -o remount /
  120. +    if [ $? -gt 0 ] ; then
  121. +      echo
  122. +      echo "Attempt to remount root device as read-write failed!  This is going to"
  123. +      echo "cause serious problems."
  124. +      echo
  125. +      echo "If you're using the UMSDOS filesystem, you **MUST** mount the root partition"
  126. +      echo "read-write!  You can make sure the root filesystem is getting mounted "
  127. +      echo "read-write with the 'rw' flag to Loadlin:"
  128. +      echo
  129. +      echo "loadlin vmlinuz root=/dev/hda1 rw   (replace /dev/hda1 with your root device)"
  130. +      echo
  131. +      echo "Normal bootdisks can be made to mount a system read-write with the rdev command:"
  132. +      echo
  133. +      echo "rdev -R /dev/fd0 0"
  134. +      echo
  135. +      echo "You can also get into your system by using a boot disk with a command like this"
  136. +      echo "on the LILO prompt line:  (change the root partition name as needed)"
  137. +      echo
  138. +      echo "LILO: mount root=/dev/hda1 rw"
  139.        echo
  140. +      echo "Please press ENTER to continue, then reboot and use one of the above methods to"
  141. +      echo -n "get into your machine and start looking for the problem. "
  142. +      read junk;
  143.      fi
  144. -    echo "Unmounting file systems."
  145. -    /sbin/umount -a -r
  146. -    /sbin/mount -n -o remount,ro /
  147. -    echo "Rebooting system."
  148. -    sleep 2
  149. -    reboot -f
  150. -  fi
  151. -  # Remount the root filesystem in read-write mode
  152. -  echo "Remounting root device with read-write enabled."
  153. -  /sbin/mount -w -v -n -o remount /
  154. -  if [ $? -gt 0 ] ; then
  155. -    echo
  156. -    echo "Attempt to remount root device as read-write failed!  This is going to"
  157. -    echo "cause serious problems."
  158. -    echo
  159. -    echo "If you're using the UMSDOS filesystem, you **MUST** mount the root partition"
  160. -    echo "read-write!  You can make sure the root filesystem is getting mounted "
  161. -    echo "read-write with the 'rw' flag to Loadlin:"
  162. -    echo
  163. -    echo "loadlin vmlinuz root=/dev/hda1 rw   (replace /dev/hda1 with your root device)"
  164. -    echo
  165. -    echo "Normal bootdisks can be made to mount a system read-write with the rdev command:"
  166. -    echo
  167. -    echo "rdev -R /dev/fd0 0"
  168. -    echo
  169. -    echo "You can also get into your system by using a boot disk with a command like this"
  170. -    echo "on the LILO prompt line:  (change the root partition name as needed)"
  171. -    echo
  172. -    echo "LILO: mount root=/dev/hda1 rw"
  173. -    echo
  174. -    echo "Please press ENTER to continue, then reboot and use one of the above methods to"
  175. -    echo -n "get into your machine and start looking for the problem. "
  176. -    read junk;
  177. -  fi
  178. +  else
  179. +    echo "Testing root filesystem status:  read-write filesystem"
  180. +    echo
  181. +    echo "*** ERROR: Root partition has already been mounted read-write. Cannot check!"
  182. +    echo
  183. +    echo "For filesystem checking to work properly, your system must initially mount"
  184. +    echo "the root partition as read only. Please modify your kernel with 'rdev' so that"
  185. +    echo "it does this. If you're booting with LILO, add a line:"
  186. +    echo
  187. +    echo "   read-only"
  188. +    echo
  189. +    echo "to the Linux section in your /etc/lilo.conf and type 'lilo' to reinstall it."
  190. +    echo
  191. +    echo "If you boot from a kernel on a floppy disk, put it in the drive and type:"
  192. +    echo "   rdev -R /dev/fd0 1"
  193. +    echo
  194. +    echo "If you boot from a bootdisk, or with Loadlin, you can add the 'ro' flag."
  195. +    echo
  196. +    echo "This will fix the problem *AND* eliminate this annoying message. :^)"
  197. +    echo
  198. +    echo -n "Press ENTER to continue. "
  199. +    read junk;
  200. +  fi # Done checking root filesystem
  201.  else
  202. -  echo "Testing root filesystem status:  read-write filesystem"
  203. -  echo
  204. -  echo "*** ERROR: Root partition has already been mounted read-write. Cannot check!"
  205. -  echo
  206. -  echo "For filesystem checking to work properly, your system must initially mount"
  207. -  echo "the root partition as read only. Please modify your kernel with 'rdev' so that"
  208. -  echo "it does this. If you're booting with LILO, add a line:"
  209. -  echo
  210. -  echo "   read-only"
  211. -  echo
  212. -  echo "to the Linux section in your /etc/lilo.conf and type 'lilo' to reinstall it."
  213. -  echo
  214. -  echo "If you boot from a kernel on a floppy disk, put it in the drive and type:"
  215. -  echo "   rdev -R /dev/fd0 1"
  216. -  echo
  217. -  echo "If you boot from a bootdisk, or with Loadlin, you can add the 'ro' flag."
  218. -  echo
  219. -  echo "This will fix the problem *AND* eliminate this annoying message. :^)"
  220. -  echo
  221. -  echo -n "Press ENTER to continue. "
  222. -  read junk;
  223. -fi # Done checking root filesystem
  224. -
  225. +  echo "The root filesystem type ($ROOTFSTYPE) does not support fsck"
  226. +fi
  227.  
  228.  # Any /etc/mtab that exists here is old, so we start with a new one:
  229.  /bin/rm -f /etc/mtab{,~,.tmp} && /bin/touch /etc/mtab
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top