Package: plymouth
Version: 0.9.2-3

Here is a couple of patches to minimize debian and ubuntu difference. In
both distros, we can configure multiple themes. Debian hardcodes the
"text" one as a text alternative and duplicate some logic to copy the
module and such.
The first patch aims at removing that duplication and introduce a more
flexible way to configure a "text" based theme (and not harcode modules
which can be fetched from the .plymouth file)

The second patch is only for the sake of minimizing debian-ubuntu diff,
as we don't ship the plymouth defaults file but use 2 alternatives. This
one is less useful to debian.

Tell me if anything needs to be modified or if you have any question!
Cheers,
Didier
>From 663501a200edc9c515bbc918e74808870d0a47cd Mon Sep 17 00:00:00 2001
From: Didier Roche <didro...@ubuntu.com>
Date: Wed, 16 Dec 2015 15:13:12 +0100
Subject: [PATCH 1/2] Enable installation multiple plymouth themes

We do not harcode as per say the text plugin. This will enable to lessen
the diff between debian and ubuntu (where the later has multiple themes
configures), and use the Modules= grep and other cp -a for the text theme
itself, instead of harcoding modules and path to copy.
---
 debian/local/plymouth.hook | 96 +++++++++++++++++++++++++++++++---------------
 1 file changed, 65 insertions(+), 31 deletions(-)

diff --git a/debian/local/plymouth.hook b/debian/local/plymouth.hook
index f63a49b..315da53 100644
--- a/debian/local/plymouth.hook
+++ b/debian/local/plymouth.hook
@@ -19,59 +19,93 @@ esac
 . /usr/share/initramfs-tools/hook-functions
 
 THEME="$(/usr/sbin/plymouth-set-default-theme || true)"
+THEME="$(basename ${THEME:-none} .plymouth || true)"
 THEMES="/usr/share/plymouth/themes"
 
-if [ -n "${THEME}" ]
+mkdir -p "${DESTDIR}/${THEMES}"
+
+if [ -n "${THEME}" ] && [ "${THEME}" != "none" ]
 then
 	THEME_NAME="${THEME}"
 	THEME="${THEMES}/${THEME}/${THEME}.plymouth"
-else
-	exit 0
 fi
 
 PLUGIN_PATH="$(plymouth --get-splash-plugin-path)"
 
-case "${THEME_NAME}" in
-	text|details|tribar)
-		PLUGINS="text.so details.so"
-		;;
-
-	*)
-		PLUGINS="text.so details.so label.so"
-		;;
-esac
-
-MODULE="${PLUGIN_PATH}/$(sed -n 's/^ModuleName=\(.*\)/\1/p' ${THEME}).so"
+# default text theme alternative
+TEXTTHEME="text"
+TEXTTHEME="$(basename ${TEXTTHEME:-none} .plymouth || true)"
 
-if [ ! -e "$MODULE" ]
+if [ -n "${TEXTTHEME}" ] & [ "${TEXTTHEME}" != "none" ]
 then
-	echo "W: plymouth module ($MODULE) missing, skipping plymouth."
-	exit 0
+	TEXTTHEME_NAME="${TEXTTHEME}"
+	TEXTTHEME="${THEMES}/${TEXTTHEME}/${TEXTTHEME}.plymouth"
 fi
 
-# copy plugin and images for current theme
-copy_exec "${MODULE}"
-mkdir -p "${DESTDIR}/${THEMES}"
-cp -r "${THEMES}/${THEME_NAME}" "${DESTDIR}/${THEMES}"
+# ensure we at least have one theme configured
+if [ ! -r "${THEME}" ] && [ ! -r "${TEXTTHEME}" ]
+then
+    exit 0
+fi
 
-# copy binaries and base plugins
-copy_exec /bin/plymouth
-copy_exec /sbin/plymouthd
+# also, if both are set to same text theme, deduplicate
+if [ "${THEME_NAME}" = "${TEXTTHEME_NAME}" ]
+then
+	TEXTTHEME_NAME = ""
+fi
 
-for PLUGIN in ${PLUGINS}
+# copy base themes content
+currthemes="${THEME_NAME} ${TEXTTHEME_NAME}"
+for currtheme in $currthemes
 do
-	if [ -f ${PLUGIN_PATH}/${PLUGIN} ]
+	case "${currtheme}" in
+		tribar)
+			PLUGINS="text.so details.so"
+			;;
+		details)
+			PLUGINS="text.so"
+			;;
+		text)
+			PLUGINS=""
+			;;
+
+		*)
+			PLUGINS="label.so"
+			;;
+	esac
+
+	MODULE="${PLUGIN_PATH}/$(sed -n 's/^ModuleName=\(.*\)/\1/p' ${THEMES}/${currtheme}/${currtheme}.plymouth).so"
+
+	if [ ! -e "$MODULE" ]
 	then
-		copy_exec ${PLUGIN_PATH}/${PLUGIN}
-	else
-		echo "W: plymouth: The plugin ${PLUGIN} is missing, the selected theme might not work as expected."
-		echo "W: plymouth: You might want to install the plymouth-themes package to fix this."
+		echo "W: plymouth module ($MODULE) missing, skipping that theme."
+		continue
 	fi
+
+	# copy plugin and images for current theme
+	copy_exec "${MODULE}"
+	cp -a "${THEMES}/${currtheme}" "${DESTDIR}/${THEMES}"
+
+	# copy base plugins if any
+	for PLUGIN in ${PLUGINS}
+	do
+		if [ -f ${PLUGIN_PATH}/${PLUGIN} ]
+		then
+			copy_exec ${PLUGIN_PATH}/${PLUGIN}
+		else
+			echo "W: plymouth: The plugin ${PLUGIN} is missing, the selected theme might not work as expected."
+			echo "W: plymouth: You might want to install the plymouth-themes and plymouth-label package to fix this."
+		fi
+	done
+
 done
 
+# copy binaries and base plugins
+copy_exec /bin/plymouth
+copy_exec /sbin/plymouthd
+
 # copy base themes and logo
 cp -a "${THEMES}/details" "${DESTDIR}/${THEMES}"
-cp -a "${THEMES}/text" "${DESTDIR}/${THEMES}"
 
 if [ -f /etc/os-release ]
 then
-- 
2.6.4

>From 6df3749852d674f92f6b3b9438b04ee4fe639aaf Mon Sep 17 00:00:00 2001
From: Didier Roche <didro...@ubuntu.com>
Date: Wed, 16 Dec 2015 15:18:43 +0100
Subject: [PATCH 2/2] Copy defaults only if it exists.

This enables as well to reduce debian-ubuntu diff.
---
 debian/local/plymouth.hook | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/debian/local/plymouth.hook b/debian/local/plymouth.hook
index 315da53..5602834 100644
--- a/debian/local/plymouth.hook
+++ b/debian/local/plymouth.hook
@@ -172,7 +172,11 @@ then
 	cp -a /etc/plymouth/plymouthd.conf "${DESTDIR}/etc/plymouth/"
 fi
 
-cp -a /usr/share/plymouth/plymouthd.defaults "${DESTDIR}/usr/share/plymouth/"
+# copy defaults file if exist
+if [ -r /usr/share/plymouth/plymouthd.defaults ]
+then
+	cp -a /usr/share/plymouth/plymouthd.defaults "${DESTDIR}/usr/share/plymouth/"
+fi
 
 # temporarily include dummy root account lookup (#691598)
 if ! grep -qs '^root:' "${DESTDIR}/etc/passwd"
-- 
2.6.4

Reply via email to