]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dmsquash-live-root: Replace incompatible shell syntax. 303/head
authorFrederick Grose <fgrose@sugarlabs.org>
Sun, 5 Nov 2017 06:18:44 +0000 (01:18 -0500)
committerFrederick Grose <fgrose@sugarlabs.org>
Sun, 5 Nov 2017 07:19:10 +0000 (02:19 -0500)
Fix issue #279  supercede PR #299
Fix bug https://issues.openmandriva.org/show_bug.cgi?id=2219
Replace Bashisms in the boot message for a missing overlay.
Verify presence of plymouth before calling it.
(Rework of commit f1b65e92af5e3f9df79f99e55d5aa936c9bca940.)

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

index 723d7f01a141cf5dda722903eabd7010db699c62..1458329c211d6d3cc100087552c610e9a66985c0 100755 (executable)
@@ -178,29 +178,26 @@ do_live_overlay() {
             warn "Using temporary overlay."
         elif [ -n "$devspec" -a -n "$pathspec" ]; then
             [ -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
+                m='   Unable to find a persistent overlay; using a temporary one.'
+            m="$m"$'\n      All root filesystem changes will be lost on shutdown.'
+            m="$m"$'\n         Press [Enter] to continue.'
+            echo -e "\n\n\n\n${m}\n\n\n" > /dev/kmsg
             if [ -n "$DRACUT_SYSTEMD" ]; then
-                if plymouth --ping ; then
+                if type plymouth >/dev/null 2>&1 && 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[*]}"
+                        m='>>>'$'\n''>>>'$'\n''>>>'$'\n\n\n'"$m"
+                        m="${m%n.*}"$'n.\n\n\n''<<<'$'\n''<<<'$'\n''<<<'
+                        plymouth display-message --text="${m}"
                     else
-                        plymouth ask-question --prompt="${m[*]}" --command=true
+                        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[*]}"
+                    m=">>>${m//.[[:space:]]/.}  <<<"
+                    systemd-ask-password --timeout=0 "${m}"
                 fi
             else
-                plymouth --ping && plymouth --quit
-                read -s -r -p $'\n\n'"${m[*]}:" -n 1 reply
+                type plymouth >/dev/null 2>&1 && plymouth --ping && plymouth --quit
+                read -s -r -p $'\n\n'"${m}" -n 1 reply
             fi
         fi
         if [ -n "$overlayfs" ]; then