From 2fe900a4f3308e31f94efa286898fb511d2d46db Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mon, 25 Dec 2023 14:48:27 -0800 Subject: [PATCH] Fix checks for existence of vars set by fc-match The first line here checked for the wrong variable and is a dupe from two lines earlier anyway, and the second line isn't guarded at all, which seems to cause the weird failure we've been seeing in openQA testing. Also add a couple more existence checks for the same variables later. Signed-off-by: Adam Williamson --- scripts/plymouth-populate-initrd.in | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/plymouth-populate-initrd.in b/scripts/plymouth-populate-initrd.in index 0c391523..20614a22 100755 --- a/scripts/plymouth-populate-initrd.in +++ b/scripts/plymouth-populate-initrd.in @@ -572,69 +572,68 @@ PLYMOUTH_MONOSPACE_FONT_PATH="" PLYMOUTH_MONOSPACE_FONT=$(grep "\bMonospaceFont *= *" ${PLYMOUTH_SYSROOT}${PLYMOUTH_THEME_DIR}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/MonospaceFont *= *//' | head -1) if [ ! -z "$PLYMOUTH_MONOSPACE_FONT" ]; then PLYMOUTH_MONOSPACE_FONT_PATH=$(fc-match -f %{file} "$PLYMOUTH_MONOSPACE_FONT" 2> /dev/null) if [ ! -z "$PLYMOUTH_MONOSPACE_FONT_PATH" ]; then inst "$PLYMOUTH_MONOSPACE_FONT_PATH" $INITRDDIR fi fi if [ ! -f ${PLYMOUTH_SYSROOT}${PLYMOUTH_PLUGIN_PATH}/${PLYMOUTH_MODULE_NAME}.so ]; then echo "The default plymouth plugin (${PLYMOUTH_MODULE_NAME}) doesn't exist" >&2 exit 1 fi inst ${PLYMOUTH_PLUGIN_PATH}/${PLYMOUTH_MODULE_NAME}.so $INITRDDIR [ -f "${PLYMOUTH_SYSROOT}${PLYMOUTH_PLUGIN_PATH}/renderers/drm.so" ] && inst ${PLYMOUTH_PLUGIN_PATH}/renderers/drm.so $INITRDDIR inst ${PLYMOUTH_PLUGIN_PATH}/renderers/frame-buffer.so $INITRDDIR if [ -d "${PLYMOUTH_SYSROOT}${PLYMOUTH_THEME_DIR}" ]; then inst_recur "${PLYMOUTH_THEME_DIR}" fi if [ "${PLYMOUTH_IMAGE_DIR}" != "${PLYMOUTH_THEME_DIR}" -a -d "${PLYMOUTH_SYSROOT}${PLYMOUTH_IMAGE_DIR}" ]; then inst_recur "${PLYMOUTH_IMAGE_DIR}" fi DEFAULT_FONT=$(fc-match -f %{file} 2> /dev/null) [ ! -z "$DEFAULT_FONT" ] && inst "$DEFAULT_FONT" $INITRDDIR DEFAULT_MONOSPACE_FONT=$(fc-match -f %{file} monospace 2> /dev/null) -[ ! -z "$DEFAULT_MONOSPACE_FONT" ] && inst "$DEFAULT_FONT" $INITRDDIR -inst "$DEFAULT_MONOSPACE_FONT" $INITRDDIR +[ ! -z "$DEFAULT_MONOSPACE_FONT" ] && inst "$DEFAULT_MONOSPACE_FONT" $INITRDDIR if [ -f "${PLYMOUTH_PLUGIN_PATH}/label-freetype.so" ]; then inst ${PLYMOUTH_PLUGIN_PATH}/label-freetype.so $INITRDDIR # The label-freetype plugin expects it at this location mkdir -p $INITRDDIR/usr/share/fonts - ln -s "$DEFAULT_FONT" $INITRDDIR/usr/share/fonts/Plymouth.ttf - ln -s "$DEFAULT_MONOSPACE_FONT" $INITRDDIR/usr/share/fonts/Plymouth-monospace.ttf + [ ! -z "$DEFAULT_FONT" ] && ln -s "$DEFAULT_FONT" $INITRDDIR/usr/share/fonts/Plymouth.ttf + [ ! -z "$DEFAULT_MONOSPACE_FONT" ] && ln -s "$DEFAULT_MONOSPACE_FONT" $INITRDDIR/usr/share/fonts/Plymouth-monospace.ttf fi if [ -L ${PLYMOUTH_SYSROOT}${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth ]; then cp -a ${PLYMOUTH_SYSROOT}${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth $INITRDDIR${PLYMOUTH_DATADIR}/plymouth/themes fi if [ -n "$SYSTEMD_UNIT_DIR" -a -d "${PLYMOUTH_SYSROOT}$SYSTEMD_UNIT_DIR" ]; then inst $SYSTEMD_UNIT_DIR/systemd-ask-password-plymouth.path $INITRDDIR inst $SYSTEMD_UNIT_DIR/systemd-ask-password-plymouth.service $INITRDDIR inst $SYSTEMD_UNIT_DIR/plymouth-switch-root.service $INITRDDIR inst $SYSTEMD_UNIT_DIR/plymouth-start.service $INITRDDIR inst $SYSTEMD_UNIT_DIR/plymouth-quit.service $INITRDDIR inst $SYSTEMD_UNIT_DIR/plymouth-quit-wait.service $INITRDDIR inst $SYSTEMD_UNIT_DIR/plymouth-reboot.service $INITRDDIR inst $SYSTEMD_UNIT_DIR/plymouth-kexec.service $INITRDDIR inst $SYSTEMD_UNIT_DIR/plymouth-poweroff.service $INITRDDIR inst $SYSTEMD_UNIT_DIR/plymouth-halt.service $INITRDDIR inst $SYSTEMD_UNIT_DIR/initrd-switch-root.target.wants/plymouth-switch-root.service $INITRDDIR inst $SYSTEMD_UNIT_DIR/initrd-switch-root.target.wants/plymouth-start.service $INITRDDIR inst $SYSTEMD_UNIT_DIR/sysinit.target.wants/plymouth-start.service $INITRDDIR inst $SYSTEMD_UNIT_DIR/multi-user.target.wants/plymouth-quit.service $INITRDDIR inst $SYSTEMD_UNIT_DIR/multi-user.target.wants/plymouth-quit-wait.service $INITRDDIR inst $SYSTEMD_UNIT_DIR/reboot.target.wants/plymouth-reboot.service $INITRDDIR inst $SYSTEMD_UNIT_DIR/kexec.target.wants/plymouth-kexec.service $INITRDDIR inst $SYSTEMD_UNIT_DIR/poweroff.target.wants/plymouth-poweroff.service $INITRDDIR inst $SYSTEMD_UNIT_DIR/halt.target.wants/plymouth-halt.service $INITRDDIR fi -- 2.43.0