summaryrefslogtreecommitdiffstats
path: root/modules.d/slx-splash/scripts
diff options
context:
space:
mode:
authorJonathan Bauer2020-08-07 14:28:48 +0200
committerJonathan Bauer2020-08-07 14:28:48 +0200
commit115ce65bef141a324da4cbcbc63b9e47f291fe24 (patch)
tree2afac1ab13622cbdb2405e111666b1df6cf23557 /modules.d/slx-splash/scripts
parent[busybox] update to 1.32.0 (diff)
downloadsystemd-init-115ce65bef141a324da4cbcbc63b9e47f291fe24.tar.gz
systemd-init-115ce65bef141a324da4cbcbc63b9e47f291fe24.tar.xz
systemd-init-115ce65bef141a324da4cbcbc63b9e47f291fe24.zip
[busybox/slx-splash] update busybox/splash
Diffstat (limited to 'modules.d/slx-splash/scripts')
-rw-r--r--modules.d/slx-splash/scripts/slx-splash-exam.sh18
-rw-r--r--modules.d/slx-splash/scripts/slx-splash.sh41
2 files changed, 45 insertions, 14 deletions
diff --git a/modules.d/slx-splash/scripts/slx-splash-exam.sh b/modules.d/slx-splash/scripts/slx-splash-exam.sh
index 7a833a06..e9de2a61 100644
--- a/modules.d/slx-splash/scripts/slx-splash-exam.sh
+++ b/modules.d/slx-splash/scripts/slx-splash-exam.sh
@@ -1,14 +1,20 @@
#!/usr/bin/env bash
+type warn &>/dev/null || . /lib/dracut-lib.sh
+
. /etc/openslx
if [ -n "$SLX_EXAM" ]; then
- if [ -e "/etc/splash.ppm.gz" ]; then
- /bin/busybox fbsplash -b -s "/etc/splash.ppm.gz" &
- elif [ -e "/etc/splash.ppm" ]; then
- /bin/busybox fbsplash -b -s "/etc/splash.ppm" &
- else
- echo "Splash screen requested, but not found in initramfs..."
+ fbsplash_ppm="/etc/splash.ppm.gz"
+ if ! [ -e "$fbsplash_ppm" ]; then
+ fbsplash_ppm="/etc/splash.ppm"
+ if ! [ -e "$fbsplash_ppm" ]; then
+ fbsplash_ppm=
+ warn "Splash screen requested, but not found in initramfs..."
+ fi
+ fi
+ if [ -n "$fbsplash_ppm" ]; then
+ /bin/busybox fbsplash -b -s "$fbsplash_ppm" &
fi
fi
diff --git a/modules.d/slx-splash/scripts/slx-splash.sh b/modules.d/slx-splash/scripts/slx-splash.sh
index 601f45ce..69e2c4e4 100644
--- a/modules.d/slx-splash/scripts/slx-splash.sh
+++ b/modules.d/slx-splash/scripts/slx-splash.sh
@@ -1,15 +1,40 @@
#!/usr/bin/env bash
+type warn &>/dev/null || source /lib/dracut-lib.sh
+
show_splash() {
- local ret=1
- if [ -e "/etc/splash.ppm.gz" ]; then
- /bin/busybox fbsplash -x -b -s "/etc/splash.ppm.gz"
- ret=$?
- elif [ -e "/etc/splash.ppm" ]; then
- /bin/busybox fbsplash -x -b -s "/etc/splash.ppm"
- ret=$?
+ # first determine where to place the ppm
+ screen_size="$(fbset | awk '$1 = /geometry/ {print $2" "$3}')"
+ screen_width="${screen_size%% *}"
+ screen_height="${screen_size#* }"
+ fbsplash_cfg="/etc/fbsplash.cfg"
+ fbsplash_ppm="/etc/splash.ppm.gz"
+ if [ -s "$fbsplash_ppm" ]; then
+ ppm_size="$(zcat "$fbsplash_ppm" | sed -n 2p)"
+ else
+ fbsplash_ppm="/etc/splash.ppm"
+ if [ -s "$fbsplash_ppm" ]; then
+ ppm_size="$(sed -n 2p "$fbsplash_ppm")"
+ else
+ warn "Splash screen requested, but not found in initramfs..."
+ fi
+ fi
+ ppm_width="${ppm_size%% *}"
+ ppm_height="${ppm_size#* }"
+ ppm_height="${ppm_height%% *}" # make sure nothing weird is trailing
+ img_left="$(( ( screen_width - ppm_width ) / 2 ))"
+ img_top="$(( ( screen_height - ppm_height ) / 2 ))"
+
+ # just checking if nothing too weird is set
+ if [ -n "$img_left" ] && [ -n "$img_top" ] \
+ && [ "$img_left" -ge 0 ] && [ "$img_left" -lt 8096 ] \
+ && [ "$img_top" -ge 0 ] && [ "$img_top" -lt 8096 ]; then
+ printf "IMG_TOP=%d\nIMG_LEFT=%d\n" \
+ "$img_top" "$img_left" \
+ > "$fbsplash_cfg"
+ fbsplash_args+=("-i" "$fbsplash_cfg")
fi
- return $ret
+ fbsplash -b -s "$fbsplash_ppm" "${fbsplash_args[@]}"
}
init_drm() {