plymouth/plymouth-watermark-config.patch
Cliff Zhao 5e839f5d00 Accepting request 977401 from home:frispete:Tumbleweed
- Add code to plymouth-watermark-config.patch in order to install
  the Watermark image file to initrd
- Refresh patches to apply cleanly

OBS-URL: https://build.opensuse.org/request/show/977401
OBS-URL: https://build.opensuse.org/package/show/Base:System/plymouth?expand=0&rev=323
2022-05-16 02:49:42 +00:00

77 lines
4.0 KiB
Diff

Index: b/src/plugins/splash/two-step/plugin.c
===================================================================
--- a/src/plugins/splash/two-step/plugin.c
+++ b/src/plugins/splash/two-step/plugin.c
@@ -1055,7 +1055,6 @@ create_plugin (ply_key_file_t *key_file)
plugin = calloc (1, sizeof(ply_boot_splash_plugin_t));
image_dir = ply_key_file_get_value (key_file, "two-step", "ImageDir");
-
ply_trace ("Using '%s' as working directory", image_dir);
asprintf (&image_path, "%s/lock.png", image_dir);
@@ -1078,9 +1077,23 @@ create_plugin (ply_key_file_t *key_file)
plugin->background_tile_image = ply_image_new (image_path);
free (image_path);
- asprintf (&image_path, "%s/watermark.png", image_dir);
- plugin->watermark_image = ply_image_new (image_path);
- free (image_path);
+ char *release_watermark_path, *theme_watermark_path;
+ release_watermark_path = ply_key_file_get_value (key_file, "two-step", "WatermarkPath");
+ asprintf (&theme_watermark_path, "%s/watermark.png", image_dir);
+ if (release_watermark_path != NULL && access(release_watermark_path, R_OK) == 0 )
+ {
+ ply_trace ("openSUSE's Watermark path: '%s'", release_watermark_path);
+ plugin->watermark_image = ply_image_new (release_watermark_path);
+ free (release_watermark_path);
+ }
+ else if( access(theme_watermark_path, R_OK) == 0)
+ {
+ ply_trace ("Theme's Watermark path: '%s'", theme_watermark_path);
+ plugin->watermark_image = ply_image_new (theme_watermark_path);
+ free (theme_watermark_path);
+ }
+ else
+ plugin->watermark_image = NULL;
plugin->animation_dir = image_dir;
Index: b/themes/bgrt/bgrt.plymouth.desktop
===================================================================
--- a/themes/bgrt/bgrt.plymouth.desktop
+++ b/themes/bgrt/bgrt.plymouth.desktop
@@ -7,6 +7,7 @@ ModuleName=two-step
Font=Cantarell 12
TitleFont=Cantarell Light 30
ImageDir=@PLYMOUTH_THEME_PATH@/spinner
+WatermarkPath=/usr/share/pixmaps/distribution-logos/light-inline.png
DialogHorizontalAlignment=.5
DialogVerticalAlignment=.382
TitleHorizontalAlignment=.5
Index: b/scripts/plymouth-populate-initrd.in
===================================================================
--- a/scripts/plymouth-populate-initrd.in
+++ b/scripts/plymouth-populate-initrd.in
@@ -491,6 +491,7 @@ 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_WATERMARK_PATH=$(grep "WatermarkPath *= *" ${PLYMOUTH_SYSROOT}${PLYMOUTH_THEME_DIR}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/WatermarkPath *= *//')
PLYMOUTH_Font_PATH=$(fc-list |grep $(fc-match "$(echo $(grep "^Font *= *" ${PLYMOUTH_SYSROOT}${PLYMOUTH_DATADIR}/plymouth/themes/`plymouth-set-default-theme`/`plymouth-set-default-theme`.plymouth | sed -e 's/^Font *= *//'| awk 'NF{NF--};1'))" |awk -F : {'print $1'}) |awk -F : {'print $1'} | sort -u | head -n 1)
PLYMOUTH_TitleFont_PATH=$(fc-list |grep $(fc-match "$(echo $(grep "^TitleFont *= *" ${PLYMOUTH_SYSROOT}${PLYMOUTH_DATADIR}/plymouth/themes/`plymouth-set-default-theme`/`plymouth-set-default-theme`.plymouth | sed -e 's/^TitleFont *= *//'| awk 'NF{NF--};1'))" |awk -F : {'print $1'}) |awk -F : {'print $1'} | sort -u | head -n 1)
@@ -516,6 +517,12 @@ if [ "${PLYMOUTH_IMAGE_DIR}" != "${PLYMO
inst_recur "${PLYMOUTH_IMAGE_DIR}"
fi
+# WatermarkPath is either an image file or a symlink to it
+[ -f "${PLYMOUTH_WATERMARK_PATH}" ] && inst "${PLYMOUTH_WATERMARK_PATH}" $INITRDDIR
+if [ -L "${PLYMOUTH_WATERMARK_PATH}" ]; then
+ inst_symlink "${PLYMOUTH_WATERMARK_PATH}"
+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