]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dmsquash-live-root: Provide enhanced feedback on missing overlay.
authorFrederick Grose <fgrose@sugarlabs.org>
Thu, 9 Mar 2017 18:02:58 +0000 (13:02 -0500)
committerFrederick Grose <fgrose@sugarlabs.org>
Sat, 11 Mar 2017 05:43:05 +0000 (00:43 -0500)
Provide a more prominent alert to the user if an overlay is
missing or the overlay module is not available and a temporary
overlay will be provided.  This, to avoid losing data intended to
persist.

modules.d/90dmsquash-live/dmsquash-live-root.sh

index c7526a43b11ecb404d74605d37d6e3cea0311941..2f0cf4076358a33de50e0125e21d0d8fb905c6ca 100755 (executable)
@@ -155,10 +155,9 @@ do_live_overlay() {
     if [ -n "$overlayfs" ]; then
         modprobe overlay
         if [ $? != 0 ]; then
-            echo "OverlayFS is not available; using temporary Device-mapper overlay." > /dev/kmsg
+            m='OverlayFS is not available; using temporary Device-mapper overlay.'
             unset -v overlayfs setup
             [ -n "$reloadsysrootmountunit" ] && unset -v reloadsysrootmountunit
-            sleep 5
         fi
     fi
 
@@ -166,8 +165,31 @@ do_live_overlay() {
         if [ -n "$setup" ]; then
             warn "Using temporary overlay."
         elif [ -n "$devspec" -a -n "$pathspec" ]; then
-            echo "Unable to find persistent overlay; using temporary." > /dev/kmsg
-            sleep 5
+            [ -z "$m" ] &&
+                m='  Unable to find a persistent overlay; using a temporary one.'
+            m=($'\n' "$m" $'\n'
+               '     All root filesystem changes will be lost on shutdown.'
+               $'\n' '        Press any key to continue')
+            echo -e "\n\n\n${m[*]}\n\n\n" > /dev/kmsg
+            if [ -n "$DRACUT_SYSTEMD" ]; then
+                if plymouth --ping ; then
+                    if getargbool 0 rhgb || getargbool 0 splash ; then
+                        m[0]='>>>'$'\n''>>>'$'\n''>>>'$'\n\n'
+                        m[5]=$'\n''<<<'$'\n''<<<'$'\n''<<<'
+                        plymouth display-message --text="${m[*]}"
+                    else
+                        plymouth ask-question --prompt="${m[*]}" --command=true
+                    fi
+                else
+                    m[0]='>>>'
+                    m[5]='<<<'
+                    unset -v m[2] m[4]
+                    systemd-ask-password --timeout=0 "${m[*]}"
+                fi
+            else
+                plymouth --ping && plymouth --quit
+                read -s -r -p $'\n\n'"${m[*]}:" -n 1 reply
+            fi
         fi
         if [ -n "$overlayfs" ]; then
             mkdir -m 0755 /run/overlayfs