From 115ce65bef141a324da4cbcbc63b9e47f291fe24 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Fri, 7 Aug 2020 14:28:48 +0200 Subject: [busybox/slx-splash] update busybox/splash --- modules.d/busybox/module-setup.sh | 4 +-- modules.d/slx-splash/module-setup.sh | 2 +- modules.d/slx-splash/scripts/slx-splash-exam.sh | 18 +++++++---- modules.d/slx-splash/scripts/slx-splash.sh | 41 ++++++++++++++++++++----- 4 files changed, 48 insertions(+), 17 deletions(-) diff --git a/modules.d/busybox/module-setup.sh b/modules.d/busybox/module-setup.sh index cbe34c87..e2d9c2ba 100644 --- a/modules.d/busybox/module-setup.sh +++ b/modules.d/busybox/module-setup.sh @@ -1,6 +1,6 @@ #!/bin/bash [ -z "$BB_GIT" ] && declare -rg BB_GIT="git://git.busybox.net/busybox" -[ -z "$BB_BRANCH" ] && declare -rg BB_BRANCH="1_32_0" +[ -z "$BB_BRANCH" ] && declare -rg BB_BRANCH="1_31_1" build() { local base_url="https://git.openslx.org/openslx-ng/mltk.git/plain/core/modules/busybox/" @@ -9,7 +9,7 @@ build() { git clone --depth 1 "$BB_GIT" --branch "$BB_BRANCH" "${moddir}/src" # apply patches cd "${moddir}/src" - for _patch in "$base_url"{fbsplash-center,fbsplash-fillbg,rtcwake-compat}.patch ; do + for _patch in "$base_url"/{fbsplash-fillbg,1_31_1-stime}.patch ; do curl "$_patch" | git apply - || derror "Failed to apply: $_patch" done diff --git a/modules.d/slx-splash/module-setup.sh b/modules.d/slx-splash/module-setup.sh index 29a85648..e1282d5d 100755 --- a/modules.d/slx-splash/module-setup.sh +++ b/modules.d/slx-splash/module-setup.sh @@ -5,7 +5,7 @@ check() { return 255 } depends() { - echo slx-drm + echo slx-drm busybox } install() { cp "$moddir/data/splash.ppm.gz" "$initdir/etc/splash.ppm.gz" 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() { -- cgit v1.2.3-55-g7522