diff options
author | Simon Rettberg | 2024-02-09 14:58:50 +0100 |
---|---|---|
committer | Simon Rettberg | 2024-02-09 14:58:50 +0100 |
commit | 24d1000bc05d6f1ae03350cb95044e3432334f92 (patch) | |
tree | a252f160ddce7301f262f51c8f2c9e073570447a | |
parent | Avoid using shopt (diff) | |
download | systemd-init-24d1000bc05d6f1ae03350cb95044e3432334f92.tar.gz systemd-init-24d1000bc05d6f1ae03350cb95044e3432334f92.tar.xz systemd-init-24d1000bc05d6f1ae03350cb95044e3432334f92.zip |
[slx-splash] Adapt to servicified new stuff
-rwxr-xr-x | modules.d/slx-splash/hooks/s3-splash-init.sh | 36 | ||||
-rwxr-xr-x | modules.d/slx-splash/module-setup.sh | 34 | ||||
-rwxr-xr-x | modules.d/slx-splash/scripts/slx-splash-exam.sh | 4 | ||||
-rwxr-xr-x | modules.d/slx-splash/scripts/slx-splash-icon-hdd.sh | 4 | ||||
-rwxr-xr-x | modules.d/slx-splash/scripts/slx-splash-init.sh | 42 | ||||
-rwxr-xr-x | modules.d/slx-splash/scripts/slx-splash-stage4.sh (renamed from modules.d/slx-splash/scripts/restore-cursor.sh) | 18 |
6 files changed, 78 insertions, 60 deletions
diff --git a/modules.d/slx-splash/hooks/s3-splash-init.sh b/modules.d/slx-splash/hooks/s3-splash-init.sh new file mode 100755 index 00000000..d64f6396 --- /dev/null +++ b/modules.d/slx-splash/hooks/s3-splash-init.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +grep -qw 'splash' "/proc/cmdline" || exit 0 + +# taken from dracut's plymouth module +# first trigger graphics subsystem +udevadm trigger --action=add --attr-match=class=0x030000 &> /dev/null +# first trigger graphics and tty subsystem +udevadm trigger --action=add \ +--subsystem-match=graphics \ + --subsystem-match=drm \ + --subsystem-match=tty \ + --subsystem-match=acpi \ + &> /dev/null +# Wait for it.... +udevadm settle --timeout=180 2>&1 + +# disable non-critical kernel messages +echo "1 1 0 1" > /proc/sys/kernel/printk +# disable systemd's status message on console +# See: https://www.freedesktop.org/software/systemd/man/systemd.html#Signals +kill -55 1 +# clear console +busybox clear +# disable cursor +echo -e "\033[?25l" > /dev/console +# finally: +if splashtool --center /etc/splash.ppm -b; then + splashtool --reset /opt/openslx/icons +else + # fbsplash failed, most likely due to missing /dev/fb0 + # -> reactivate systemd status messages + kill -54 1 +fi + +exit 0 diff --git a/modules.d/slx-splash/module-setup.sh b/modules.d/slx-splash/module-setup.sh index 58fd9561..00b51f5a 100755 --- a/modules.d/slx-splash/module-setup.sh +++ b/modules.d/slx-splash/module-setup.sh @@ -7,19 +7,35 @@ check() { depends() { echo slx-drm busybox } +slx_execpost() { + local _conf="/tmp/dracut-execpost-$RANDOM" + local _script="/usr/local/slx-scripts/${1##*/}" + inst_simple "${moddir}/scripts/${1}" "${_script}" || exit 10 + cat > "$_conf" <<-EXECPOST +[Service] +ExecStartPost=-${_script} + EXECPOST + inst_simple "$_conf" "/etc/systemd/system/${2}.d/${1##*/}.conf" || exit 10 + unlink "$_conf" +} install() { mkdir -p "${initdir}/opt/openslx" - cp -r "${moddir}/data/icons" "${initdir}/opt/openslx" - cp "${moddir}/data/splash.ppm" "${initdir}/etc/splash.ppm" - cp "${moddir}/scripts/splashtool" "${initdir}/usr/local/bin/splashtool" + cp -r "${moddir}/data/icons" "${initdir}/opt/openslx" || exit 1 + cp "${moddir}/data/splash.ppm" "${initdir}/etc/splash.ppm" || exit 1 + cp "${moddir}/scripts/splashtool" "${initdir}/usr/local/bin/splashtool" || exit 1 + + slx_service "s3-splash-init" "Initialize bootsplash" \ + --wafter "dracut-pre-trigger.service" - inst_hook pre-trigger 10 "${moddir}/scripts/slx-splash-init.sh" + # Change boot splash depending on boot mode = exam inst_hook pre-pivot 00 "${moddir}/scripts/slx-splash-exam.sh" - inst_hook pre-pivot 20 "${moddir}/scripts/restore-cursor.sh" + # Copy splashtool and icons to stage4, add service drop-in to reset console + inst_hook pre-pivot 20 "${moddir}/scripts/slx-splash-stage4.sh" - inst_hook pre-mount 00 "${moddir}/scripts/slx-splash-icon-hdd.sh" - inst_hook pre-mount 99 "${moddir}/scripts/slx-splash-icon-config.sh" - inst_hook pre-pivot 00 "${moddir}/scripts/slx-splash-icon-rootfs.sh" - inst_hook pre-pivot 99 "${moddir}/scripts/slx-splash-icon-puzzle.sh" + # Done in stage 4 by setup-partitions + #inst_hook pre-mount 00 "${moddir}/scripts/slx-splash-icon-hdd.sh" + slx_execpost "slx-splash-icon-config.sh" "s3-fetch-config.service" + slx_execpost "slx-splash-icon-rootfs.sh" "s3-mount-root.service" + slx_execpost "slx-splash-icon-puzzle.sh" "s3-setup-addons.service" # NOTE: network related stuff is in integrated in slx-network } diff --git a/modules.d/slx-splash/scripts/slx-splash-exam.sh b/modules.d/slx-splash/scripts/slx-splash-exam.sh index 79160fc4..251f95c3 100755 --- a/modules.d/slx-splash/scripts/slx-splash-exam.sh +++ b/modules.d/slx-splash/scripts/slx-splash-exam.sh @@ -1,8 +1,6 @@ #!/usr/bin/env bash -type warn &>/dev/null || . /lib/dracut-lib.sh - -. /etc/openslx +[ -n "$SLX_PXE_SERVER_IP" ] || . /etc/openslx # Let's do this even in "no splash" mode to be sure if [ -n "$SLX_EXAM" ]; then diff --git a/modules.d/slx-splash/scripts/slx-splash-icon-hdd.sh b/modules.d/slx-splash/scripts/slx-splash-icon-hdd.sh deleted file mode 100755 index 2b1ff4a3..00000000 --- a/modules.d/slx-splash/scripts/slx-splash-icon-hdd.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/ash - -grep -wq splash /proc/cmdline \ - && splashtool --icon "/opt/openslx/icons/active/??-hdd.ppm" diff --git a/modules.d/slx-splash/scripts/slx-splash-init.sh b/modules.d/slx-splash/scripts/slx-splash-init.sh deleted file mode 100755 index a4c71f88..00000000 --- a/modules.d/slx-splash/scripts/slx-splash-init.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash - -type warn &>/dev/null || source /lib/dracut-lib.sh - -init_drm() { - # taken from dracut's plymouth module - # first trigger graphics subsystem - udevadm trigger --action=add --attr-match=class=0x030000 >/dev/null 2>&1 - # first trigger graphics and tty subsystem - udevadm trigger --action=add \ - --subsystem-match=graphics \ - --subsystem-match=drm \ - --subsystem-match=tty \ - --subsystem-match=acpi \ - >/dev/null 2>&1 - - udevadm settle --timeout=180 2>&1 -} - -if grep -wq 'splash' /proc/cmdline; then - # first init graphics - init_drm - # disable non-critical kernel messages - echo "1 1 0 1" > /proc/sys/kernel/printk - # disable systemd's status message on console - # See: https://www.freedesktop.org/software/systemd/man/systemd.html#Signals - kill -55 1 - # clear console - busybox clear - # disable cursor - echo -e "\033[?25l" > /dev/console - # finally: - if splashtool --center /etc/splash.ppm -b; then - splashtool --reset /opt/openslx/icons - else - # fbsplash failed, most likely due to missing /dev/fb0 - # -> reactivate systemd status messages - kill -54 1 - fi -fi - -true diff --git a/modules.d/slx-splash/scripts/restore-cursor.sh b/modules.d/slx-splash/scripts/slx-splash-stage4.sh index 4ba9880d..b88a6a90 100755 --- a/modules.d/slx-splash/scripts/restore-cursor.sh +++ b/modules.d/slx-splash/scripts/slx-splash-stage4.sh @@ -1,5 +1,11 @@ -#!/usr/bin/env bash -# +#!/bin/bash + +grep -qw 'splash' "/proc/cmdline" || return 0 + +# Set option that we want splash + +echo "SLX_SPLASH='yes'" >> "$NEWROOT/opt/openslx/config" + # The console cursor is disabled when starting the splash screen. # This will add a drop-in to getty@.service to ensure the cursor # is restored when starting gettys. @@ -9,3 +15,11 @@ cat <<- EOF > "$NEWROOT/etc/systemd/system/getty@.service.d/restore-cursor.conf" [Service] ExecStartPre=-/usr/bin/env bash -c "echo -en '\033c' > /dev/%I" EOF + +# Copy icons and tools, so we can trigger the HDD icon in +# setup-partitions.service + +cp -n "$( which splashtool )" "$NEWROOT/opt/openslx/bin/splashtool" +cp -n -r "/opt/openslx/icons" -t "$NEWROOT/opt/openslx/" + +: |