diff options
author | Simon Rettberg | 2020-10-13 16:02:42 +0200 |
---|---|---|
committer | Your Name | 2020-10-13 16:02:42 +0200 |
commit | d5d13c2053414b39d9e297edf3f9ef021b69d924 (patch) | |
tree | c9fd1401e79f282787a4d3b42df88db0cf49c47f /core/rootfs | |
parent | [vmware-common] Hard-coded lookup table for hwversion (diff) | |
download | mltk-d5d13c2053414b39d9e297edf3f9ef021b69d924.tar.gz mltk-d5d13c2053414b39d9e297edf3f9ef021b69d924.tar.xz mltk-d5d13c2053414b39d9e297edf3f9ef021b69d924.zip |
[splashtool] Finish first working implementation
Adds icons, triggers their display at appropriate times.
Diffstat (limited to 'core/rootfs')
5 files changed, 49 insertions, 45 deletions
diff --git a/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig b/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig index c93d6e0d..61359374 100644 --- a/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig +++ b/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig @@ -47,6 +47,7 @@ SLX_PXE_SERVER_IP='$SERVERIP' SLX_PXE_GATEWAY='$router' SLX_PXE_DNS='$dns' SLX_PXE_MAC='$MAC' +SLX_SPLASH='$MUTED_OUTPUT' HEREEND return 0 } diff --git a/core/rootfs/rootfs-stage31/data/inc/network.functions b/core/rootfs/rootfs-stage31/data/inc/network.functions index a9edb5bc..00f27159 100644 --- a/core/rootfs/rootfs-stage31/data/inc/network.functions +++ b/core/rootfs/rootfs-stage31/data/inc/network.functions @@ -3,12 +3,18 @@ wait_for_iface() { local DEVICE=$1 local TIMEOUT=10 - local state laststate current relax + local state laststate current relax img in local want= local ret=1 # error [ -n "$2" ] && TIMEOUT="$2" echo -n "Waiting ${TIMEOUT}s for interface $DEVICE: " TIMEOUT="$(( TIMEOUT * 2 ))" + if [ "$DEVICE" = "br0" ]; then + img="??-bridge" + else + img="??-nic" + fi + showicon --icon "/opt/openslx/icons/inactive/${img}.ppm" # Some systems don't have operstate. Seems to be hardware dependent [ -e "/sys/class/net/${DEVICE}/operstate" ] || sleep 1 [ -e "/sys/class/net/${DEVICE}/operstate" ] && want="up" @@ -40,6 +46,9 @@ wait_for_iface() { # else echo -n "." usleep 500000 + in= + [ "$(( current % 2 ))" = 0 ] && in="in" + showicon --icon "/opt/openslx/icons/${in}active/${img}.ppm" & done else # we really don't have a operstate .. then just wait a sec and hope for the best. @@ -47,6 +56,11 @@ wait_for_iface() { echo -n "... no operstate or carrier, let's hope for the best..." fi echo + if [ "$ret" = 0 ]; then + showicon --icon "/opt/openslx/icons/active/${img}.ppm" + else + showicon --icon "/opt/openslx/icons/inactive/${img}.ppm" + fi return "$ret" } true diff --git a/core/rootfs/rootfs-stage31/data/init b/core/rootfs/rootfs-stage31/data/init index 7e1bcf21..fa51cc5c 100755 --- a/core/rootfs/rootfs-stage31/data/init +++ b/core/rootfs/rootfs-stage31/data/init @@ -17,7 +17,7 @@ ############################################################################# # set PATH correctly -export PATH=/bin:/sbin:/usr/bin:/usr/sbin +export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/openslx/bin # import common functions . "/inc/functions" @@ -94,47 +94,23 @@ modprobe -a -b $(cat /etc/modules) 2>/dev/null # Load drm gfx drivers, if successful, check if splash screen should be shown, and do so . "/inc/drm.functions" SD_CMDLINE= +showicon() { + : +} if [ "$SPLASH" -eq 1 ]; then if setup_gfx; then echo "1 1 0 1" > /proc/sys/kernel/printk exec 4>&1 5>&2 > /dev/null 2>&1 - MUTED_OUTPUT=1 clear echo -e "\033[?25l" >&4 - 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)" + if splashtool --center "/etc/splash.ppm" -b; then + MUTED_OUTPUT=1 + showicon() { + splashtool "$@" + } + showicon --reset "/opt/openslx/icons" else - fbsplash_ppm="/etc/splash.ppm" - if [ -s "$fbsplash_ppm" ]; then - ppm_size="$(sed -n 2p "$fbsplash_ppm")" - else - echo "Splash screen requested, but not found in initramfs..." >&4 - MUTED_OUTPUT= - 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 -b -i "$fbsplash_cfg" -s "$fbsplash_ppm" || MUTED_OUTPUT= - else - # otherwise just use top left and be done with it - fbsplash -b -s "$fbsplash_ppm" || MUTED_OUTPUT= - fi - if [ -z "$MUTED_OUTPUT" ]; then + MUTED_OUTPUT= exec 1>&4 2>&5 fi fi @@ -163,6 +139,7 @@ bench_event "NETWORK" "Network up and running" . "/inc/activate_sysconfig" || drop_shell "Could not source /inc/activate_sysconfig" bench_event "CONFIG" "Downloaded config" +showicon --icon "/opt/openslx/icons/active/??-config.ppm" # From here on, we have all the vars from /opt/openslx/config # Sync time via NTP @@ -172,6 +149,7 @@ bench_event "CONFIG" "Downloaded config" . "/inc/setup_stage32" || drop_shell "Problem setting up stage3.2" bench_event "STAGE32" "Downloaded stage 3.2" +showicon --icon "/opt/openslx/icons/active/??-rootfs.ppm" # copy files needed for stage3.2 to FUTURE_ROOT echo "Copying busybox etc. to stage32..." @@ -197,9 +175,7 @@ fi # Exam mode if [ -n "$SLX_EXAM" ]; then # Visual: Move splash screen to upper left corner - if [ -s "$fbsplash_ppm" ]; then - fbsplash -b -s "$fbsplash_ppm" & - fi + showicon --tl "/etc/splash.ppm" fi # Merge freshly generated config to stage32 @@ -224,8 +200,12 @@ bench_event "PRESWITCH" "Switching to stage 3.2" for mnt in run tmp; do busybox umount -f -l "/$mnt" 2>/dev/null done -mkdir -p /mnt/dev -busybox mount -o move /dev /mnt/dev +mkdir -p "${FUTURE_ROOT}/dev" +busybox mount -o move /dev "${FUTURE_ROOT}/dev" + +# Copy splashtool and icons +cp /opt/openslx/bin/splashtool "${FUTURE_ROOT}/opt/openslx/bin/" +cp -r /opt/openslx/icons "${FUTURE_ROOT}/opt/openslx/" echo "Waiting for async processes..." wait diff --git a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-download_slx_addons b/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-download_slx_addons index 0fed8342..73e0efb1 100755 --- a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-download_slx_addons +++ b/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-download_slx_addons @@ -38,10 +38,18 @@ mkdir -p "$DOWNLOAD_DEST" || { echo "Failed to create $DOWNLOAD_DEST"; exit 1; } # DOWNLOAD ALL ADDONS # if [ $# -eq 0 ]; then - [ -z "${SLX_ADDONS}" ] && { echo "No addons configured. Nothing to do :-)."; exit 0; } - for ADDON in ${SLX_ADDONS}; do - systemctl --no-block start "download-slx-addon@$ADDON.service" - done + if [ -z "${SLX_ADDONS}" ]; then + echo "No addons configured. Nothing to do :-)." + else + for ADDON in ${SLX_ADDONS}; do + # Use bg not --no-block so we can wait below + systemctl start "download-slx-addon@$ADDON.service" & + done + echo "Waiting for addon downloads to finish" + wait + fi + [ -n "$SLX_SPLASH" ] && splashtool --icon "/opt/openslx/icons/active/??-puzzle.ppm" + exit 0 fi ## # DOWNLOAD SINGLE ADDON diff --git a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions b/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions index 097c7fcc..fcf41149 100755 --- a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions +++ b/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions @@ -347,5 +347,6 @@ if [ "$HAVE_SWAP" = "no" ]; then fi fi +[ -n "$SLX_SPLASH" ] && splashtool --icon "/opt/openslx/icons/active/??-hdd.ppm" exit 0 |