Blame SOURCES/ship-label-plugin-in-initrd.patch

2836bb
From aa56c9bab334f6c97204e83e578c000db274a3c0 Mon Sep 17 00:00:00 2001
2836bb
From: Ray Strode <rstrode@redhat.com>
2836bb
Date: Mon, 17 Jun 2019 13:54:42 -0400
2836bb
Subject: [PATCH] ship-label-plugin-in-initrd.patch
2836bb
2836bb
---
2836bb
 scripts/plymouth-populate-initrd.in | 19 +++++++++++++++++++
2836bb
 1 file changed, 19 insertions(+)
2836bb
2836bb
diff --git a/scripts/plymouth-populate-initrd.in b/scripts/plymouth-populate-initrd.in
2836bb
index 5f3bb85..36600a7 100755
2836bb
--- a/scripts/plymouth-populate-initrd.in
2836bb
+++ b/scripts/plymouth-populate-initrd.in
2836bb
@@ -1,47 +1,48 @@
2836bb
 #!/bin/bash
2836bb
 #
2836bb
 # inst bits ruthlessly and viciously stolen from dracut
2836bb
 
2836bb
 [ -z "$DESTDIR" ] || exit 0
2836bb
 
2836bb
 [ -z "$PLYMOUTH_LIBEXECDIR" ] && PLYMOUTH_LIBEXECDIR="@PLYMOUTH_LIBEXECDIR@"
2836bb
 [ -z "$PLYMOUTH_DATADIR" ] && PLYMOUTH_DATADIR="@PLYMOUTH_DATADIR@"
2836bb
 [ -z "$PLYMOUTH_PLUGIN_PATH" ] && PLYMOUTH_PLUGIN_PATH="$(plymouth --get-splash-plugin-path)"
2836bb
 [ -z "$PLYMOUTH_LOGO_FILE" ] && PLYMOUTH_LOGO_FILE="@PLYMOUTH_LOGO_FILE@"
2836bb
 [ -n "$PLYMOUTH_THEME_NAME" ] && THEME_OVERRIDE=1
2836bb
 [ -z "$PLYMOUTH_THEME_NAME" ] && PLYMOUTH_THEME_NAME=$(plymouth-set-default-theme)
2836bb
 [ -z "$PLYMOUTH_CONFDIR" ] && PLYMOUTH_CONFDIR="@PLYMOUTH_CONF_DIR@"
2836bb
 [ -z "$PLYMOUTH_POLICYDIR" ] && PLYMOUTH_POLICYDIR="@PLYMOUTH_POLICY_DIR@"
2836bb
 [ -z "$PLYMOUTH_DAEMON_PATH" ] && PLYMOUTH_DAEMON_PATH="@PLYMOUTH_DAEMON_DIR@/plymouthd"
2836bb
 [ -z "$PLYMOUTH_CLIENT_PATH" ] && PLYMOUTH_CLIENT_PATH="@PLYMOUTH_CLIENT_DIR@/plymouth"
2836bb
 [ -z "$SYSTEMD_UNIT_DIR" ] && SYSTEMD_UNIT_DIR="@SYSTEMD_UNIT_DIR@"
2836bb
+[ -z "$SUPPORTED_LANGUAGES" ] && SUPPORTED_LANGUAGES="pt fr de it ru es en zh ja ko zh as bn gu hi kn ml mr or pa ta te"
2836bb
 
2836bb
 # Generic substring function.  If $2 is in $1, return 0.
2836bb
 strstr() { [ "${1#*$2*}" != "$1" ]; }
2836bb
 
2836bb
 ddebug() {
2836bb
     [ "$verbose" = "true" ] && echo "$@"
2836bb
 }
2836bb
 
2836bb
 # normalize_path <path>
2836bb
 # Prints the normalized path, where it removes any duplicated
2836bb
 # and trailing slashes.
2836bb
 # Example:
2836bb
 # $ normalize_path ///test/test//
2836bb
 # /test/test
2836bb
 normalize_path() {
2836bb
     shopt -q -s extglob
2836bb
     set -- "${1//+(\/)//}"
2836bb
     shopt -q -u extglob
2836bb
     echo "${1%/}"
2836bb
 }
2836bb
 
2836bb
 # convert_abs_rel <from> <to>
2836bb
 # Prints the relative path, when creating a symlink to <to> from <from>.
2836bb
 # Example:
2836bb
 # $ convert_abs_rel /usr/bin/test /bin/test-2
2836bb
 # ../../bin/test-2
2836bb
 # $ ln -s $(convert_abs_rel /usr/bin/test /bin/test-2) /usr/bin/test
2836bb
 convert_abs_rel() {
2836bb
     local __current __absolute __abssize __cursize __newpath
2836bb
     local -i __i __level
2836bb
@@ -390,59 +391,77 @@ if [ -z "$PLYMOUTH_THEME_NAME" ]; then
2836bb
 fi
2836bb
 
2836bb
 if [ $THEME_OVERRIDE ]; then
2836bb
     conf=$INITRDDIR/${PLYMOUTH_CONFDIR}/plymouthd.conf
2836bb
     echo "modifying plymouthd.conf: Theme=$PLYMOUTH_THEME_NAME" > /dev/stderr
2836bb
     # make sure the section and key exist so we can modify them
2836bb
     grep -q "^ *\[Daemon\]" $conf || echo "[Daemon]" >> $conf
2836bb
     grep -q "^ *Theme *=" $conf || echo "Theme=fade-in" >> $conf
2836bb
     sed -i "s/^ *Theme *=.*/# theme modified by plymouth-populate-initrd\nTheme=$PLYMOUTH_THEME_NAME/" $conf
2836bb
 fi
2836bb
 
2836bb
 PLYMOUTH_MODULE_NAME=$(grep "ModuleName *= *" ${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/ModuleName *= *//')
2836bb
 
2836bb
 if [ ! -f ${PLYMOUTH_PLUGIN_PATH}/${PLYMOUTH_MODULE_NAME}.so ]; then
2836bb
     echo "The default plymouth plugin (${PLYMOUTH_MODULE_NAME}) doesn't exist" > /dev/stderr
2836bb
     exit 1
2836bb
 fi
2836bb
 
2836bb
 inst ${PLYMOUTH_PLUGIN_PATH}/${PLYMOUTH_MODULE_NAME}.so $INITRDDIR
2836bb
 
2836bb
 [ -f "${PLYMOUTH_PLUGIN_PATH}/renderers/drm.so" ] && inst ${PLYMOUTH_PLUGIN_PATH}/renderers/drm.so $INITRDDIR
2836bb
 inst ${PLYMOUTH_PLUGIN_PATH}/renderers/frame-buffer.so $INITRDDIR
2836bb
 
2836bb
 if [ -d ${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME} ]; then
2836bb
     for x in ${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME}/* ; do
2836bb
         [ ! -f "$x" ] && continue
2836bb
         inst $x $INITRDDIR
2836bb
     done
2836bb
 fi
2836bb
 
2836bb
+fonts=""
2836bb
+needs_graphics="$(find ${INITRDDIR} -name 'libply-splash-graphics.so*' -print -quit | grep -q libply-splash-graphics.so && echo -n 1)"
2836bb
+
2836bb
+if [ -n "$needs_graphics" ]; then
2836bb
+    for lang in $SUPPORTED_LANGUAGES; do
2836bb
+        font=$(fc-match "":lang="$lang" file | awk -F= '{ print $2}')
2836bb
+        echo $fonts | grep -q "$font" && continue
2836bb
+        fonts="$fonts $font"
2836bb
+    done
2836bb
+
2836bb
+    if [ -n "$fonts" ]; then
2836bb
+        inst ${PLYMOUTH_PLUGIN_PATH}/label.so $INITRDDIR
2836bb
+        for font in $fonts; do
2836bb
+            inst $font $INITRDDIR
2836bb
+        done
2836bb
+    fi
2836bb
+fi
2836bb
+
2836bb
 if [ -L ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth ]; then
2836bb
     cp -a ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth $INITRDDIR${PLYMOUTH_DATADIR}/plymouth/themes
2836bb
 fi
2836bb
 
2836bb
 if [ -n "$SYSTEMD_UNIT_DIR" -a -d "$SYSTEMD_UNIT_DIR" ]; then
2836bb
     inst $SYSTEMD_UNIT_DIR/systemd-ask-password-plymouth.path $INITRDDIR
2836bb
     inst $SYSTEMD_UNIT_DIR/systemd-ask-password-plymouth.service $INITRDDIR
2836bb
 
2836bb
     inst $SYSTEMD_UNIT_DIR/plymouth-switch-root.service $INITRDDIR
2836bb
     inst $SYSTEMD_UNIT_DIR/plymouth-start.service $INITRDDIR
2836bb
     inst $SYSTEMD_UNIT_DIR/plymouth-quit.service $INITRDDIR
2836bb
     inst $SYSTEMD_UNIT_DIR/plymouth-quit-wait.service $INITRDDIR
2836bb
     inst $SYSTEMD_UNIT_DIR/plymouth-reboot.service $INITRDDIR
2836bb
     inst $SYSTEMD_UNIT_DIR/plymouth-kexec.service $INITRDDIR
2836bb
     inst $SYSTEMD_UNIT_DIR/plymouth-poweroff.service $INITRDDIR
2836bb
     inst $SYSTEMD_UNIT_DIR/plymouth-halt.service $INITRDDIR
2836bb
 
2836bb
     inst $SYSTEMD_UNIT_DIR/initrd-switch-root.target.wants/plymouth-switch-root.service $INITRDDIR
2836bb
     inst $SYSTEMD_UNIT_DIR/initrd-switch-root.target.wants/plymouth-start.service $INITRDDIR
2836bb
     inst $SYSTEMD_UNIT_DIR/sysinit.target.wants/plymouth-start.service $INITRDDIR
2836bb
     inst $SYSTEMD_UNIT_DIR/multi-user.target.wants/plymouth-quit.service $INITRDDIR
2836bb
     inst $SYSTEMD_UNIT_DIR/multi-user.target.wants/plymouth-quit-wait.service $INITRDDIR
2836bb
     inst $SYSTEMD_UNIT_DIR/reboot.target.wants/plymouth-reboot.service $INITRDDIR
2836bb
     inst $SYSTEMD_UNIT_DIR/kexec.target.wants/plymouth-kexec.service $INITRDDIR
2836bb
     inst $SYSTEMD_UNIT_DIR/poweroff.target.wants/plymouth-poweroff.service $INITRDDIR
2836bb
     inst $SYSTEMD_UNIT_DIR/halt.target.wants/plymouth-halt.service $INITRDDIR
2836bb
 fi
2836bb
 
2836bb
 # vim:ts=8:sw=4:sts=4:et
2836bb
-- 
2836bb
2.21.0
2836bb