|
|
862bc8 |
From 68f14b8a0163d688ca36541bc1e28173b0b62317 Mon Sep 17 00:00:00 2001
|
|
|
862bc8 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
862bc8 |
Date: Mon, 20 Jul 2015 09:24:27 -0400
|
|
|
862bc8 |
Subject: [PATCH] populate-initrd: ship label plugin / font in initrd
|
|
|
862bc8 |
|
|
|
862bc8 |
Some customers require showing text in the initrd, so
|
|
|
862bc8 |
this commit goes ahead and ships label.so (and all its
|
|
|
862bc8 |
dependencies) and one font in the initrd.
|
|
|
862bc8 |
---
|
|
|
862bc8 |
scripts/plymouth-populate-initrd.in | 19 +++++++++++++++++++
|
|
|
862bc8 |
1 file changed, 19 insertions(+)
|
|
|
862bc8 |
|
|
|
862bc8 |
diff --git a/scripts/plymouth-populate-initrd.in b/scripts/plymouth-populate-initrd.in
|
|
|
862bc8 |
index d25ab07..da55318 100755
|
|
|
862bc8 |
--- a/scripts/plymouth-populate-initrd.in
|
|
|
862bc8 |
+++ b/scripts/plymouth-populate-initrd.in
|
|
|
862bc8 |
@@ -1,47 +1,48 @@
|
|
|
862bc8 |
#!/bin/bash
|
|
|
862bc8 |
#
|
|
|
862bc8 |
# inst bits ruthlessly and viciously stolen from dracut
|
|
|
862bc8 |
|
|
|
862bc8 |
[ -z "$DESTDIR" ] || exit 0
|
|
|
862bc8 |
|
|
|
862bc8 |
[ -z "$PLYMOUTH_LIBEXECDIR" ] && PLYMOUTH_LIBEXECDIR="@PLYMOUTH_LIBEXECDIR@"
|
|
|
862bc8 |
[ -z "$PLYMOUTH_DATADIR" ] && PLYMOUTH_DATADIR="@PLYMOUTH_DATADIR@"
|
|
|
862bc8 |
[ -z "$PLYMOUTH_PLUGIN_PATH" ] && PLYMOUTH_PLUGIN_PATH="$(plymouth --get-splash-plugin-path)"
|
|
|
862bc8 |
[ -z "$PLYMOUTH_LOGO_FILE" ] && PLYMOUTH_LOGO_FILE="@PLYMOUTH_LOGO_FILE@"
|
|
|
862bc8 |
[ -n "$PLYMOUTH_THEME_NAME" ] && THEME_OVERRIDE=1
|
|
|
862bc8 |
[ -z "$PLYMOUTH_THEME_NAME" ] && PLYMOUTH_THEME_NAME=$(plymouth-set-default-theme)
|
|
|
862bc8 |
[ -z "$PLYMOUTH_CONFDIR" ] && PLYMOUTH_CONFDIR="@PLYMOUTH_CONF_DIR@"
|
|
|
862bc8 |
[ -z "$PLYMOUTH_POLICYDIR" ] && PLYMOUTH_POLICYDIR="@PLYMOUTH_POLICY_DIR@"
|
|
|
862bc8 |
[ -z "$PLYMOUTH_DAEMON_PATH" ] && PLYMOUTH_DAEMON_PATH="@PLYMOUTH_DAEMON_DIR@/plymouthd"
|
|
|
862bc8 |
[ -z "$PLYMOUTH_CLIENT_PATH" ] && PLYMOUTH_CLIENT_PATH="@PLYMOUTH_CLIENT_DIR@/plymouth"
|
|
|
862bc8 |
[ -z "$SYSTEMD_UNIT_DIR" ] && SYSTEMD_UNIT_DIR="@SYSTEMD_UNIT_DIR@"
|
|
|
862bc8 |
+[ -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"
|
|
|
862bc8 |
|
|
|
862bc8 |
# Generic substring function. If $2 is in $1, return 0.
|
|
|
862bc8 |
strstr() { [ "${1#*$2*}" != "$1" ]; }
|
|
|
862bc8 |
|
|
|
862bc8 |
ddebug() {
|
|
|
862bc8 |
[ "$verbose" = "true" ] && echo "$@"
|
|
|
862bc8 |
}
|
|
|
862bc8 |
|
|
|
862bc8 |
# normalize_path <path>
|
|
|
862bc8 |
# Prints the normalized path, where it removes any duplicated
|
|
|
862bc8 |
# and trailing slashes.
|
|
|
862bc8 |
# Example:
|
|
|
862bc8 |
# $ normalize_path ///test/test//
|
|
|
862bc8 |
# /test/test
|
|
|
862bc8 |
normalize_path() {
|
|
|
862bc8 |
shopt -q -s extglob
|
|
|
862bc8 |
set -- "${1//+(\/)//}"
|
|
|
862bc8 |
shopt -q -u extglob
|
|
|
862bc8 |
echo "${1%/}"
|
|
|
862bc8 |
}
|
|
|
862bc8 |
|
|
|
862bc8 |
# convert_abs_rel <from> <to>
|
|
|
862bc8 |
# Prints the relative path, when creating a symlink to <to> from <from>.
|
|
|
862bc8 |
# Example:
|
|
|
862bc8 |
# $ convert_abs_rel /usr/bin/test /bin/test-2
|
|
|
862bc8 |
# ../../bin/test-2
|
|
|
862bc8 |
# $ ln -s $(convert_abs_rel /usr/bin/test /bin/test-2) /usr/bin/test
|
|
|
862bc8 |
convert_abs_rel() {
|
|
|
862bc8 |
local __current __absolute __abssize __cursize __newpath
|
|
|
862bc8 |
local -i __i __level
|
|
|
862bc8 |
@@ -387,59 +388,77 @@ inst ${PLYMOUTH_CONFDIR}/plymouthd.conf $INITRDDIR
|
|
|
862bc8 |
if [ -z "$PLYMOUTH_THEME_NAME" ]; then
|
|
|
862bc8 |
echo "No default plymouth plugin is set" > /dev/stderr
|
|
|
862bc8 |
exit 1
|
|
|
862bc8 |
fi
|
|
|
862bc8 |
|
|
|
862bc8 |
if [ $THEME_OVERRIDE ]; then
|
|
|
862bc8 |
conf=$INITRDDIR/${PLYMOUTH_CONFDIR}/plymouthd.conf
|
|
|
862bc8 |
echo "modifying plymouthd.conf: Theme=$PLYMOUTH_THEME_NAME" > /dev/stderr
|
|
|
862bc8 |
sed -i "s/^ *Theme *=.*/# theme modified by plymouth-populate-initrd\nTheme=$PLYMOUTH_THEME_NAME/" $conf
|
|
|
862bc8 |
fi
|
|
|
862bc8 |
|
|
|
862bc8 |
PLYMOUTH_MODULE_NAME=$(grep "ModuleName *= *" ${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/ModuleName *= *//')
|
|
|
862bc8 |
|
|
|
862bc8 |
if [ ! -f ${PLYMOUTH_PLUGIN_PATH}/${PLYMOUTH_MODULE_NAME}.so ]; then
|
|
|
862bc8 |
echo "The default plymouth plugin (${PLYMOUTH_MODULE_NAME}) doesn't exist" > /dev/stderr
|
|
|
862bc8 |
exit 1
|
|
|
862bc8 |
fi
|
|
|
862bc8 |
|
|
|
862bc8 |
inst ${PLYMOUTH_PLUGIN_PATH}/${PLYMOUTH_MODULE_NAME}.so $INITRDDIR
|
|
|
862bc8 |
|
|
|
862bc8 |
[ -f "${PLYMOUTH_PLUGIN_PATH}/renderers/drm.so" ] && inst ${PLYMOUTH_PLUGIN_PATH}/renderers/drm.so $INITRDDIR
|
|
|
862bc8 |
inst ${PLYMOUTH_PLUGIN_PATH}/renderers/frame-buffer.so $INITRDDIR
|
|
|
862bc8 |
|
|
|
862bc8 |
if [ -d ${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME} ]; then
|
|
|
862bc8 |
for x in ${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME}/* ; do
|
|
|
862bc8 |
[ ! -f "$x" ] && continue
|
|
|
862bc8 |
inst $x $INITRDDIR
|
|
|
862bc8 |
done
|
|
|
862bc8 |
fi
|
|
|
862bc8 |
|
|
|
862bc8 |
+fonts=""
|
|
|
862bc8 |
+needs_graphics="$(find ${INITRDDIR} -name 'libply-splash-graphics.so*' -print -quit | grep -q libply-splash-graphics.so && echo -n 1)"
|
|
|
862bc8 |
+
|
|
|
862bc8 |
+if [ -n "$needs_graphics" ]; then
|
|
|
862bc8 |
+ for lang in $SUPPORTED_LANGUAGES; do
|
|
|
862bc8 |
+ font=$(fc-match "":lang="$lang" file | awk -F= '{ print $2}')
|
|
|
862bc8 |
+ echo $fonts | grep -q "$font" && continue
|
|
|
862bc8 |
+ fonts="$fonts $font"
|
|
|
862bc8 |
+ done
|
|
|
862bc8 |
+
|
|
|
862bc8 |
+ if [ -n "$fonts" ]; then
|
|
|
862bc8 |
+ inst ${PLYMOUTH_PLUGIN_PATH}/label.so $INITRDDIR
|
|
|
862bc8 |
+ for font in $fonts; do
|
|
|
862bc8 |
+ inst $font $INITRDDIR
|
|
|
862bc8 |
+ done
|
|
|
862bc8 |
+ fi
|
|
|
862bc8 |
+fi
|
|
|
862bc8 |
+
|
|
|
862bc8 |
if [ -L ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth ]; then
|
|
|
862bc8 |
cp -a ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth $INITRDDIR${PLYMOUTH_DATADIR}/plymouth/themes
|
|
|
862bc8 |
fi
|
|
|
862bc8 |
|
|
|
862bc8 |
if [ -n "$SYSTEMD_UNIT_DIR" -a -d "$SYSTEMD_UNIT_DIR" ]; then
|
|
|
862bc8 |
inst $SYSTEMD_UNIT_DIR/systemd-ask-password-plymouth.path $INITRDDIR
|
|
|
862bc8 |
inst $SYSTEMD_UNIT_DIR/systemd-ask-password-plymouth.service $INITRDDIR
|
|
|
862bc8 |
|
|
|
862bc8 |
inst $SYSTEMD_UNIT_DIR/plymouth-switch-root.service $INITRDDIR
|
|
|
862bc8 |
inst $SYSTEMD_UNIT_DIR/plymouth-start.service $INITRDDIR
|
|
|
862bc8 |
inst $SYSTEMD_UNIT_DIR/plymouth-quit.service $INITRDDIR
|
|
|
862bc8 |
inst $SYSTEMD_UNIT_DIR/plymouth-quit-wait.service $INITRDDIR
|
|
|
862bc8 |
inst $SYSTEMD_UNIT_DIR/plymouth-reboot.service $INITRDDIR
|
|
|
862bc8 |
inst $SYSTEMD_UNIT_DIR/plymouth-kexec.service $INITRDDIR
|
|
|
862bc8 |
inst $SYSTEMD_UNIT_DIR/plymouth-poweroff.service $INITRDDIR
|
|
|
862bc8 |
inst $SYSTEMD_UNIT_DIR/plymouth-halt.service $INITRDDIR
|
|
|
862bc8 |
|
|
|
862bc8 |
inst $SYSTEMD_UNIT_DIR/initrd-switch-root.target.wants/plymouth-switch-root.service $INITRDDIR
|
|
|
862bc8 |
inst $SYSTEMD_UNIT_DIR/initrd-switch-root.target.wants/plymouth-start.service $INITRDDIR
|
|
|
862bc8 |
inst $SYSTEMD_UNIT_DIR/sysinit.target.wants/plymouth-start.service $INITRDDIR
|
|
|
862bc8 |
inst $SYSTEMD_UNIT_DIR/multi-user.target.wants/plymouth-quit.service $INITRDDIR
|
|
|
862bc8 |
inst $SYSTEMD_UNIT_DIR/multi-user.target.wants/plymouth-quit-wait.service $INITRDDIR
|
|
|
862bc8 |
inst $SYSTEMD_UNIT_DIR/reboot.target.wants/plymouth-reboot.service $INITRDDIR
|
|
|
862bc8 |
inst $SYSTEMD_UNIT_DIR/kexec.target.wants/plymouth-kexec.service $INITRDDIR
|
|
|
862bc8 |
inst $SYSTEMD_UNIT_DIR/poweroff.target.wants/plymouth-poweroff.service $INITRDDIR
|
|
|
862bc8 |
inst $SYSTEMD_UNIT_DIR/halt.target.wants/plymouth-halt.service $INITRDDIR
|
|
|
862bc8 |
fi
|
|
|
862bc8 |
|
|
|
862bc8 |
# vim:ts=8:sw=4:sts=4:et
|
|
|
862bc8 |
--
|
|
|
862bc8 |
2.3.7
|
|
|
862bc8 |
|