On Fri, 2015-08-21 at 11:31 +0000, Chas Williams III wrote:
> At one point live boot had support for fsck'ing persistent media before
> mounting read/write.  This appeared to have been removed due to lack
> of usage/interest. 

Here is a better attempt -- now fsck runs before the filesystem is
mounted readonly.  I am not sure what to do with the output from fsck
in check_dev though.  How do I get it into boot.log?


Similar to a974d9cd39ed0ed6490c7894056c7c0666855994.  Additionally,
allow the user to force a fsck via the command line.
---
 components/9990-misc-helpers.sh | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/components/9990-misc-helpers.sh b/components/9990-misc-helpers.sh
index 9318a4b..8900aaf 100755
--- a/components/9990-misc-helpers.sh
+++ b/components/9990-misc-helpers.sh
@@ -195,6 +195,33 @@ check_dev ()
        then
                devuid=$(blkid -o value -s UUID "$devname")
                [ -n "$devuid" ] && grep -qs "\<$devuid\>" 
/var/lib/live/boot/devices-already-tried-to-mount && continue
+
+               for _PARAMETER in ${LIVE_BOOT_CMDLINE}
+               do
+                       case "${_PARAMETER}" in
+                               forcefsck)
+                                       FORCEFSCK="Yes"
+                                       ;;
+                       esac
+               done
+
+               if [ "${PERSISTENCE_FSCK}" = "Yes" ] || [ "${FORCEFSCK}" = 
"Yes" ]
+               then
+                       force=""
+                       if [ "$FORCEFSCK" = "Yes" ]
+                       then
+                               force="-f"
+                       fi
+
+                       fix="-a"
+                       if [ "$FSCKFIX" = "Yes" ]
+                       then
+                               fix="-y"
+                       fi
+
+                       fsck $fix $force ${devname} >/dev/null 2>&1
+               fi
+
                mount -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || 
continue
                [ -n "$devuid" ] && echo "$devuid" >> 
/var/lib/live/boot/devices-already-tried-to-mount
 
-- 
1.9.1


Reply via email to