]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
plymouth-populate-initrd: fix THEME_OVERRIDE with empty conf
authorWill Woods <wwoods@redhat.com>
Wed, 20 May 2015 16:03:58 +0000 (12:03 -0400)
committerRay Strode <rstrode@redhat.com>
Fri, 20 May 2016 20:31:01 +0000 (16:31 -0400)
If you set PLYMOUTH_THEME_NAME to override the theme in an initrd
(as e.g. lorax does when building upgrade.img), plymouth-populate-initrd
tries to edit plymouthd.conf to enable that theme.

Unfortunately, the existing `sed` line doesn't work if your
plymouthd.conf is empty or all commented out - which is how we currently
ship it.

So before modifying the config, make sure it has a [Daemon] section
header, and a Theme=[placeholder] line for us to modify.

Resolves: RHBZ#1223344

scripts/plymouth-populate-initrd.in

index 43c7f22c91c64c6a48aadbbf55ef72e154f2d29c..e3326e94c307d7b57c6a7f2b735e8376a25750b4 100755 (executable)
@@ -392,6 +392,9 @@ fi
 if [ $THEME_OVERRIDE ]; then
     conf=$INITRDDIR/${PLYMOUTH_CONFDIR}/plymouthd.conf
     echo "modifying plymouthd.conf: Theme=$PLYMOUTH_THEME_NAME" > /dev/stderr
+    # make sure the section and key exist so we can modify them
+    grep -q "^ *\[Daemon\]" $conf || echo "[Daemon]" >> $conf
+    grep -q "^ *Theme *=" $conf || echo "Theme=fade-in" >> $conf
     sed -i "s/^ *Theme *=.*/# theme modified by plymouth-populate-initrd\nTheme=$PLYMOUTH_THEME_NAME/" $conf
 fi