From e08eb228aef455106511b0eb6155e17e09aced29 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Mon, 25 Dec 2023 21:01:03 -0500 Subject: [PATCH] Various fixes for more minimal installs --- ...or-existence-of-vars-set-by-fc-match.patch | 98 +++++++ ...er-Fall-back-to-text-plugin-if-no-re.patch | 150 +++++++++++ ...e-initrd-Handle-xkb-and-fontconfig-n.patch | 249 ++++++++++++++++++ ...e-initrd-More-dependency-softificati.patch | 176 +++++++++++++ plymouth.spec | 4 + 5 files changed, 677 insertions(+) create mode 100644 0001-Fix-checks-for-existence-of-vars-set-by-fc-match.patch create mode 100644 0001-ply-device-manager-Fall-back-to-text-plugin-if-no-re.patch create mode 100644 0001-plymouth-populate-initrd-Handle-xkb-and-fontconfig-n.patch create mode 100644 0001-plymouth-populate-initrd-More-dependency-softificati.patch diff --git a/0001-Fix-checks-for-existence-of-vars-set-by-fc-match.patch b/0001-Fix-checks-for-existence-of-vars-set-by-fc-match.patch new file mode 100644 index 0000000..db03eef --- /dev/null +++ b/0001-Fix-checks-for-existence-of-vars-set-by-fc-match.patch @@ -0,0 +1,98 @@ +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 + diff --git a/0001-ply-device-manager-Fall-back-to-text-plugin-if-no-re.patch b/0001-ply-device-manager-Fall-back-to-text-plugin-if-no-re.patch new file mode 100644 index 0000000..7452db9 --- /dev/null +++ b/0001-ply-device-manager-Fall-back-to-text-plugin-if-no-re.patch @@ -0,0 +1,150 @@ +From 2b18218ef6b5fe33b64a418d9596924acd62b093 Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Mon, 25 Dec 2023 20:20:31 -0500 +Subject: [PATCH] ply-device-manager: Fall back to text plugin if no renderers + installed + +If there's no renderers installed there's no point in continuing to +listen for DRM events and trying to load the drm plugin. + +This commit just forces text mode right away in that case. +--- + src/libply-splash-core/ply-device-manager.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c +index 99433345..d65d9dd6 100644 +--- a/src/libply-splash-core/ply-device-manager.c ++++ b/src/libply-splash-core/ply-device-manager.c +@@ -25,60 +25,61 @@ + #include + #include + #include + #include + #include + #include + #include + + #ifdef HAVE_UDEV + #include + #endif + + #include + + #include "ply-logger.h" + #include "ply-event-loop.h" + #include "ply-hashtable.h" + #include "ply-list.h" + #include "ply-key-file.h" + #include "ply-utils.h" + #include "ply-input-device.h" + + #define SUBSYSTEM_DRM "drm" + #define SUBSYSTEM_FRAME_BUFFER "graphics" + #define SUBSYSTEM_INPUT "input" + + #ifdef HAVE_UDEV + static void create_devices_from_udev (ply_device_manager_t *manager); + #endif + ++static void create_non_graphical_devices (ply_device_manager_t *manager); + static bool create_devices_for_terminal_and_renderer_type (ply_device_manager_t *manager, + const char *device_path, + ply_terminal_t *terminal, + ply_renderer_type_t renderer_type); + static void create_pixel_displays_for_renderer (ply_device_manager_t *manager, + ply_renderer_t *renderer); + + struct _ply_device_manager + { + ply_device_manager_flags_t flags; + ply_event_loop_t *loop; + ply_hashtable_t *terminals; + ply_hashtable_t *renderers; + ply_hashtable_t *input_devices; + ply_terminal_t *local_console_terminal; + const char *keymap; + ply_list_t *keyboards; + ply_list_t *text_displays; + ply_list_t *pixel_displays; + struct udev *udev_context; + struct udev_monitor *udev_monitor; + ply_fd_watch_t *fd_watch; + + struct xkb_context *xkb_context; + struct xkb_keymap *xkb_keymap; + + ply_keyboard_added_handler_t keyboard_added_handler; + ply_keyboard_removed_handler_t keyboard_removed_handler; + ply_pixel_display_added_handler_t pixel_display_added_handler; + ply_pixel_display_removed_handler_t pixel_display_removed_handler; +@@ -1070,60 +1071,66 @@ create_text_displays_for_terminal (ply_device_manager_t *manager, + + if (manager->text_display_added_handler != NULL) + manager->text_display_added_handler (manager->event_handler_data, display); + } + + static bool + create_devices_for_terminal_and_renderer_type (ply_device_manager_t *manager, + const char *device_path, + ply_terminal_t *terminal, + ply_renderer_type_t renderer_type) + { + ply_renderer_t *renderer = NULL; + ply_keyboard_t *keyboard = NULL; + + if (device_path != NULL) + renderer = ply_hashtable_lookup (manager->renderers, (void *) device_path); + + if (renderer != NULL) { + ply_trace ("ignoring device %s since it's already managed", device_path); + return true; + } + + ply_trace ("creating devices for %s (renderer type: %u) (terminal: %s)", + device_path ? : "", renderer_type, terminal ? ply_terminal_get_name (terminal) : "none"); + + if (renderer_type != PLY_RENDERER_TYPE_NONE) { + ply_renderer_t *old_renderer = NULL; + renderer = ply_renderer_new (renderer_type, device_path, terminal); + + if (renderer != NULL && !ply_renderer_open (renderer)) { ++ if (errno == ENOENT) { ++ ply_trace ("No renderers available creating non-graphical devices"); ++ create_non_graphical_devices (manager); ++ manager->device_timeout_elapsed = true; ++ return false; ++ } + ply_trace ("could not open renderer for %s", device_path); + ply_renderer_free (renderer); + renderer = NULL; + + if (renderer_type != PLY_RENDERER_TYPE_AUTO) + return false; + } + + if (renderer != NULL) { + old_renderer = ply_hashtable_lookup (manager->renderers, + (void *) ply_renderer_get_device_name (renderer)); + + if (old_renderer != NULL) { + ply_trace ("ignoring device %s since it's already managed", + ply_renderer_get_device_name (renderer)); + ply_renderer_free (renderer); + + renderer = NULL; + return true; + } + + add_input_devices_to_renderer (manager, renderer); + } + } + + if (renderer != NULL) { + keyboard = ply_keyboard_new_for_renderer (renderer); + ply_list_append_data (manager->keyboards, keyboard); + + if (manager->keyboard_added_handler != NULL) +-- +2.43.0 + diff --git a/0001-plymouth-populate-initrd-Handle-xkb-and-fontconfig-n.patch b/0001-plymouth-populate-initrd-Handle-xkb-and-fontconfig-n.patch new file mode 100644 index 0000000..14840cc --- /dev/null +++ b/0001-plymouth-populate-initrd-Handle-xkb-and-fontconfig-n.patch @@ -0,0 +1,249 @@ +From 97a19552f39491e1cade1011fa96120710935f06 Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Mon, 25 Dec 2023 14:42:53 -0500 +Subject: [PATCH] plymouth-populate-initrd: Handle xkb and fontconfig not being + installed + +Some minimal installs won't have fontconfig or xkb. In those cases, +the script should continue to work even if the initramfs will be +less featureful. + +This commit fixes that. +--- + scripts/plymouth-populate-initrd.in | 99 +++++++++++++++-------------- + 1 file changed, 51 insertions(+), 48 deletions(-) + +diff --git a/scripts/plymouth-populate-initrd.in b/scripts/plymouth-populate-initrd.in +index 8ccac22c..a7919ded 100755 +--- a/scripts/plymouth-populate-initrd.in ++++ b/scripts/plymouth-populate-initrd.in +@@ -448,103 +448,105 @@ while [ $# -gt 0 ]; do + X11_DIRECTORY="$1" + ;; + *) + usage error + break + ;; + esac + shift + done + + [ -z "$INITRDDIR" ] && usage error + + ddebug "Running with PLYMOUTH_SYSROOT=$PLYMOUTH_SYSROOT" + ddebug "Running with PLYMOUTH_LDD=$PLYMOUTH_LDD" + ddebug "Running with PLYMOUTH_LDD_PATH=$PLYMOUTH_LDD_PATH" + + mkdir -p ${INITRDDIR}${PLYMOUTH_DATADIR}/plymouth/themes + inst ${PLYMOUTH_DAEMON_PATH} $INITRDDIR + inst ${PLYMOUTH_CLIENT_PATH} $INITRDDIR + inst ${PLYMOUTH_DRM_ESCROW_PATH} $INITRDDIR + inst ${PLYMOUTH_DATADIR}/plymouth/themes/text/text.plymouth $INITRDDIR + inst ${PLYMOUTH_PLUGIN_PATH}/text.so $INITRDDIR + inst ${PLYMOUTH_DATADIR}/plymouth/themes/details/details.plymouth $INITRDDIR + inst ${PLYMOUTH_PLUGIN_PATH}/details.so $INITRDDIR + inst ${PLYMOUTH_LOGO_FILE} $INITRDDIR + inst @RELEASE_FILE@ $INITRDDIR + inst ${PLYMOUTH_POLICYDIR}/plymouthd.defaults $INITRDDIR + inst ${PLYMOUTH_CONFDIR}/plymouthd.conf $INITRDDIR + + # Install xkb info +-mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/xkb/" +-mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/xkb/compat/" +- +-mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/xkb/keycodes/" +-mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/xkb/rules/" +-mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/xkb/symbols/" +-mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/xkb/types/" +-mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/locale/" +-inst ${X11_DIRECTORY}/xkb/compat/accessx $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/compat/basic $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/compat/caps $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/compat/complete $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/compat/iso9995 $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/compat/ledcaps $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/compat/lednum $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/compat/ledscroll $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/compat/level5 $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/compat/misc $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/compat/mousekeys $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/compat/xfree86 $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/keycodes/aliases $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/keycodes/evdev $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/rules/evdev $INITRDDIR +-find ${X11_DIRECTORY}/xkb/symbols -maxdepth 1 ! -type d | while read file; do +- inst $file $INITRDDIR +-done +-inst ${X11_DIRECTORY}/xkb/types/basic $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/types/complete $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/types/extra $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/types/iso9995 $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/types/level5 $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/types/mousekeys $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/types/numpad $INITRDDIR +-inst ${X11_DIRECTORY}/xkb/types/pc $INITRDDIR +- +-# In the off chance the user uses their compose key when +-# typing their password, install compose sequences +-inst ${X11_DIRECTORY}/locale/compose.dir $INITRDDIR +-grep UTF-8/Compose: ${X11_DIRECTORY}/locale/compose.dir | awk -F: '{ print $1 }' | sort -u | xargs dirname | while read DIR; do +- find ${X11_DIRECTORY}/locale/$DIR -maxdepth 1 ! -type d | while read file; do ++if [ -d "${X11_DIRECTORY}" ]; then ++ mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/xkb/" ++ mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/xkb/compat/" ++ ++ mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/xkb/keycodes/" ++ mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/xkb/rules/" ++ mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/xkb/symbols/" ++ mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/xkb/types/" ++ mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/locale/" ++ inst ${X11_DIRECTORY}/xkb/compat/accessx $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/compat/basic $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/compat/caps $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/compat/complete $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/compat/iso9995 $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/compat/ledcaps $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/compat/lednum $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/compat/ledscroll $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/compat/level5 $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/compat/misc $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/compat/mousekeys $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/compat/xfree86 $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/keycodes/aliases $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/keycodes/evdev $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/rules/evdev $INITRDDIR ++ find ${X11_DIRECTORY}/xkb/symbols -maxdepth 1 ! -type d | while read file; do + inst $file $INITRDDIR +- done +-done ++ done ++ inst ${X11_DIRECTORY}/xkb/types/basic $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/types/complete $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/types/extra $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/types/iso9995 $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/types/level5 $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/types/mousekeys $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/types/numpad $INITRDDIR ++ inst ${X11_DIRECTORY}/xkb/types/pc $INITRDDIR ++ ++ # In the off chance the user uses their compose key when ++ # typing their password, install compose sequences ++ inst ${X11_DIRECTORY}/locale/compose.dir $INITRDDIR ++ grep UTF-8/Compose: ${X11_DIRECTORY}/locale/compose.dir | awk -F: '{ print $1 }' | sort -u | xargs dirname | while read DIR; do ++ find ${X11_DIRECTORY}/locale/$DIR -maxdepth 1 ! -type d | while read file; do ++ inst $file $INITRDDIR ++ done ++ done ++fi + + if [ -z "$PLYMOUTH_THEME_NAME" ]; then + echo "No default plymouth plugin is set" >&2 + exit 1 + fi + + set_theme_dir + mkdir -p ${INITRDDIR}${PLYMOUTH_THEME_DIR} + + if [ $THEME_OVERRIDE ]; then + conf=$INITRDDIR/${PLYMOUTH_CONFDIR}/plymouthd.conf + echo "modifying plymouthd.conf: Theme=$PLYMOUTH_THEME_NAME" >&2 + # 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 + if [ "$THEME_DIR_OVERRIDE" ]; then + echo "modifying plymouthd.conf: ThemeDir=$PLYMOUTH_CONFIGURED_DIR_PATH" >&2 + grep -q "^ *ThemeDir *=" $conf || echo "ThemeDir=/some/path" >> $conf + sed -i "s@^ *ThemeDir *=.*@# theme dir modified by plymouth-populate-initrd\nThemeDir=$PLYMOUTH_CONFIGURED_DIR_PATH@" $conf + PLYMOUTH_THEME_DIR=${PLYMOUTH_CONFIGURED_DIR_PATH} + fi + fi + + PLYMOUTH_MODULE_NAME=$(grep "ModuleName *= *" ${PLYMOUTH_SYSROOT}${PLYMOUTH_THEME_DIR}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/ModuleName *= *//') + PLYMOUTH_IMAGE_DIR=$(grep "ImageDir *= *" ${PLYMOUTH_SYSROOT}${PLYMOUTH_THEME_DIR}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/ImageDir *= *//') + + + PLYMOUTH_FONT_PATH="" + PLYMOUTH_FONT=$(grep "\bFont *= *" ${PLYMOUTH_SYSROOT}${PLYMOUTH_THEME_DIR}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/Font *= *//' | head -1) +@@ -565,71 +567,72 @@ if [ ! -z "$PLYMOUTH_TITLE_FONT" ]; then + fi + + 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") + 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 + +-DefaultFont=$(fc-match -f %{file}) +-inst "$DefaultFont" $INITRDDIR +-DefaultMonospaceFont=$(fc-match -f %{file} monospace) +-inst "$DefaultMonospaceFont" $INITRDDIR ++DEFAULT_FONT=$(fc-match -f %{file}) ++[ ! -z "$DEFAULT_FONT" ] && inst "$DEFAULT_FONT" $INITRDDIR ++DEFAULT_MONOSPACE_FONT=$(fc-match -f %{file} monospace) ++[ ! -z "$DEFAULT_MONOSPACE_FONT" ] && inst "$DEFAULT_FONT" $INITRDDIR ++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 "$DefaultFont" $INITRDDIR/usr/share/fonts/Plymouth.ttf +- ln -s "$DefaultMonospaceFont" $INITRDDIR/usr/share/fonts/Plymouth-monospace.ttf ++ ln -s "$DEFAULT_FONT" $INITRDDIR/usr/share/fonts/Plymouth.ttf ++ 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 + diff --git a/0001-plymouth-populate-initrd-More-dependency-softificati.patch b/0001-plymouth-populate-initrd-More-dependency-softificati.patch new file mode 100644 index 0000000..6f34d44 --- /dev/null +++ b/0001-plymouth-populate-initrd-More-dependency-softificati.patch @@ -0,0 +1,176 @@ +From ac6c34b9f54c648cd01008a1460cb25d5b05bd8c Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Mon, 25 Dec 2023 15:24:29 -0500 +Subject: [PATCH] plymouth-populate-initrd: More dependency softification + +This commit makes lack of fc-match less noisy and makes +compose.dir from libX11 be optional as well. +--- + scripts/plymouth-populate-initrd.in | 24 +++++++++++++----------- + 1 file changed, 13 insertions(+), 11 deletions(-) + +diff --git a/scripts/plymouth-populate-initrd.in b/scripts/plymouth-populate-initrd.in +index a7919ded..0c391523 100755 +--- a/scripts/plymouth-populate-initrd.in ++++ b/scripts/plymouth-populate-initrd.in +@@ -486,144 +486,146 @@ if [ -d "${X11_DIRECTORY}" ]; then + mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/locale/" + inst ${X11_DIRECTORY}/xkb/compat/accessx $INITRDDIR + inst ${X11_DIRECTORY}/xkb/compat/basic $INITRDDIR + inst ${X11_DIRECTORY}/xkb/compat/caps $INITRDDIR + inst ${X11_DIRECTORY}/xkb/compat/complete $INITRDDIR + inst ${X11_DIRECTORY}/xkb/compat/iso9995 $INITRDDIR + inst ${X11_DIRECTORY}/xkb/compat/ledcaps $INITRDDIR + inst ${X11_DIRECTORY}/xkb/compat/lednum $INITRDDIR + inst ${X11_DIRECTORY}/xkb/compat/ledscroll $INITRDDIR + inst ${X11_DIRECTORY}/xkb/compat/level5 $INITRDDIR + inst ${X11_DIRECTORY}/xkb/compat/misc $INITRDDIR + inst ${X11_DIRECTORY}/xkb/compat/mousekeys $INITRDDIR + inst ${X11_DIRECTORY}/xkb/compat/xfree86 $INITRDDIR + inst ${X11_DIRECTORY}/xkb/keycodes/aliases $INITRDDIR + inst ${X11_DIRECTORY}/xkb/keycodes/evdev $INITRDDIR + inst ${X11_DIRECTORY}/xkb/rules/evdev $INITRDDIR + find ${X11_DIRECTORY}/xkb/symbols -maxdepth 1 ! -type d | while read file; do + inst $file $INITRDDIR + done + inst ${X11_DIRECTORY}/xkb/types/basic $INITRDDIR + inst ${X11_DIRECTORY}/xkb/types/complete $INITRDDIR + inst ${X11_DIRECTORY}/xkb/types/extra $INITRDDIR + inst ${X11_DIRECTORY}/xkb/types/iso9995 $INITRDDIR + inst ${X11_DIRECTORY}/xkb/types/level5 $INITRDDIR + inst ${X11_DIRECTORY}/xkb/types/mousekeys $INITRDDIR + inst ${X11_DIRECTORY}/xkb/types/numpad $INITRDDIR + inst ${X11_DIRECTORY}/xkb/types/pc $INITRDDIR + + # In the off chance the user uses their compose key when + # typing their password, install compose sequences +- inst ${X11_DIRECTORY}/locale/compose.dir $INITRDDIR +- grep UTF-8/Compose: ${X11_DIRECTORY}/locale/compose.dir | awk -F: '{ print $1 }' | sort -u | xargs dirname | while read DIR; do +- find ${X11_DIRECTORY}/locale/$DIR -maxdepth 1 ! -type d | while read file; do +- inst $file $INITRDDIR +- done +- done ++ if [ -f "${X11_DIRECTORY}/locale/compose.dir" ]; then ++ inst ${X11_DIRECTORY}/locale/compose.dir $INITRDDIR ++ grep UTF-8/Compose: ${X11_DIRECTORY}/locale/compose.dir | awk -F: '{ print $1 }' | sort -u | xargs dirname | while read DIR; do ++ find ${X11_DIRECTORY}/locale/$DIR -maxdepth 1 ! -type d | while read file; do ++ inst $file $INITRDDIR ++ done ++ done ++ fi + fi + + if [ -z "$PLYMOUTH_THEME_NAME" ]; then + echo "No default plymouth plugin is set" >&2 + exit 1 + fi + + set_theme_dir + mkdir -p ${INITRDDIR}${PLYMOUTH_THEME_DIR} + + if [ $THEME_OVERRIDE ]; then + conf=$INITRDDIR/${PLYMOUTH_CONFDIR}/plymouthd.conf + echo "modifying plymouthd.conf: Theme=$PLYMOUTH_THEME_NAME" >&2 + # 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 + if [ "$THEME_DIR_OVERRIDE" ]; then + echo "modifying plymouthd.conf: ThemeDir=$PLYMOUTH_CONFIGURED_DIR_PATH" >&2 + grep -q "^ *ThemeDir *=" $conf || echo "ThemeDir=/some/path" >> $conf + sed -i "s@^ *ThemeDir *=.*@# theme dir modified by plymouth-populate-initrd\nThemeDir=$PLYMOUTH_CONFIGURED_DIR_PATH@" $conf + PLYMOUTH_THEME_DIR=${PLYMOUTH_CONFIGURED_DIR_PATH} + fi + fi + + PLYMOUTH_MODULE_NAME=$(grep "ModuleName *= *" ${PLYMOUTH_SYSROOT}${PLYMOUTH_THEME_DIR}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/ModuleName *= *//') + PLYMOUTH_IMAGE_DIR=$(grep "ImageDir *= *" ${PLYMOUTH_SYSROOT}${PLYMOUTH_THEME_DIR}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/ImageDir *= *//') + + + PLYMOUTH_FONT_PATH="" + PLYMOUTH_FONT=$(grep "\bFont *= *" ${PLYMOUTH_SYSROOT}${PLYMOUTH_THEME_DIR}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/Font *= *//' | head -1) + if [ ! -z "$PLYMOUTH_FONT" ]; then +- PLYMOUTH_FONT_PATH=$(fc-match -f %{file} "$PLYMOUTH_FONT") ++ PLYMOUTH_FONT_PATH=$(fc-match -f %{file} "$PLYMOUTH_FONT" 2> /dev/null) + if [ ! -z "$PLYMOUTH_FONT_PATH" ]; then + inst "$PLYMOUTH_FONT_PATH" $INITRDDIR + fi + fi + + PLYMOUTH_TITLE_FONT_PATH="" + PLYMOUTH_TITLE_FONT=$(grep "\bTitleFont *= *" ${PLYMOUTH_SYSROOT}${PLYMOUTH_THEME_DIR}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/TitleFont *= *//' | head -1) + if [ ! -z "$PLYMOUTH_TITLE_FONT" ]; then +- PLYMOUTH_TITLE_FONT_PATH=$(fc-match -f %{file} "$PLYMOUTH_TITLE_FONT") ++ PLYMOUTH_TITLE_FONT_PATH=$(fc-match -f %{file} "$PLYMOUTH_TITLE_FONT" 2> /dev/null) + if [ ! -z "$PLYMOUTH_TITLE_FONT_PATH" ]; then + inst "$PLYMOUTH_TITLE_FONT_PATH" $INITRDDIR + fi + fi + + 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") ++ 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}) ++DEFAULT_FONT=$(fc-match -f %{file} 2> /dev/null) + [ ! -z "$DEFAULT_FONT" ] && inst "$DEFAULT_FONT" $INITRDDIR +-DEFAULT_MONOSPACE_FONT=$(fc-match -f %{file} monospace) ++DEFAULT_MONOSPACE_FONT=$(fc-match -f %{file} monospace 2> /dev/null) + [ ! -z "$DEFAULT_MONOSPACE_FONT" ] && inst "$DEFAULT_FONT" $INITRDDIR + 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 + 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 +-- +2.43.0 + diff --git a/plymouth.spec b/plymouth.spec index 9878318..32cf0b0 100644 --- a/plymouth.spec +++ b/plymouth.spec @@ -10,6 +10,10 @@ Source2: charge.plymouth Patch: 0001-plymouth-populate-initrd-Fix-usage-message.patch Patch: 0001-meson-Fix-PLY_ENABLE_SYSTEMD_INTEGRATION-define.patch +Patch: 0001-plymouth-populate-initrd-Handle-xkb-and-fontconfig-n.patch +Patch: 0001-plymouth-populate-initrd-More-dependency-softificati.patch +Patch: 0001-ply-device-manager-Fall-back-to-text-plugin-if-no-re.patch +Patch: 0001-Fix-checks-for-existence-of-vars-set-by-fc-match.patch BuildRequires: meson BuildRequires: fedora-logos