From 38ccc2ac8a57ee50d1dfc2e34ea354d5a55a89dc Mon Sep 17 00:00:00 2001 From: Aster Boese Date: Wed, 22 Apr 2026 19:32:24 +0200 Subject: [PATCH] main/postmarketos-mkinitfs-hook: merge mkinitfs-hook packages into one Having many separate mkinitfs-hook packages makes it harder to add new hooks and makes maintaining the hooks very fragmented and challenging. Merging them all into one package and splitting them out by subpackage makes them much more maintainable and makes adding new hooks as easy as adding files and a subpackage. Signed-off-by: Aster Boese Part-of: --- main/postmarketos-mkinitfs-hook-apx/APKBUILD | 24 ---- main/postmarketos-mkinitfs-hook-ci/APKBUILD | 26 ---- .../APKBUILD | 20 --- .../APKBUILD | 19 --- .../APKBUILD | 20 --- .../APKBUILD | 26 ---- .../APKBUILD | 19 --- .../00-apx.files | 0 .../00-apx.sh | 0 .../00-kernel-panic.sh | 0 .../00-maximum-attention.sh | 20 +-- .../00-netboot.sh} | 0 .../05-ci.files | 0 .../05-ci.sh | 3 +- .../10-verbose-initfs.sh | 0 .../20-debug-shell.files | 0 .../30-netboot.modules} | 0 main/postmarketos-mkinitfs-hook/APKBUILD | 119 ++++++++++++++++++ 18 files changed, 131 insertions(+), 165 deletions(-) delete mode 100644 main/postmarketos-mkinitfs-hook-apx/APKBUILD delete mode 100644 main/postmarketos-mkinitfs-hook-ci/APKBUILD delete mode 100644 main/postmarketos-mkinitfs-hook-debug-shell/APKBUILD delete mode 100644 main/postmarketos-mkinitfs-hook-kernel-panic/APKBUILD delete mode 100644 main/postmarketos-mkinitfs-hook-maximum-attention/APKBUILD delete mode 100644 main/postmarketos-mkinitfs-hook-netboot/APKBUILD delete mode 100644 main/postmarketos-mkinitfs-hook-verbose-initfs/APKBUILD rename main/{postmarketos-mkinitfs-hook-apx => postmarketos-mkinitfs-hook}/00-apx.files (100%) rename main/{postmarketos-mkinitfs-hook-apx => postmarketos-mkinitfs-hook}/00-apx.sh (100%) rename main/{postmarketos-mkinitfs-hook-kernel-panic => postmarketos-mkinitfs-hook}/00-kernel-panic.sh (100%) rename main/{postmarketos-mkinitfs-hook-maximum-attention => postmarketos-mkinitfs-hook}/00-maximum-attention.sh (69%) rename main/{postmarketos-mkinitfs-hook-netboot/netboot.sh => postmarketos-mkinitfs-hook/00-netboot.sh} (100%) rename main/{postmarketos-mkinitfs-hook-ci => postmarketos-mkinitfs-hook}/05-ci.files (100%) rename main/{postmarketos-mkinitfs-hook-ci => postmarketos-mkinitfs-hook}/05-ci.sh (90%) rename main/{postmarketos-mkinitfs-hook-verbose-initfs => postmarketos-mkinitfs-hook}/10-verbose-initfs.sh (100%) rename main/{postmarketos-mkinitfs-hook-debug-shell => postmarketos-mkinitfs-hook}/20-debug-shell.files (100%) rename main/{postmarketos-mkinitfs-hook-netboot/netboot.modules => postmarketos-mkinitfs-hook/30-netboot.modules} (100%) create mode 100644 main/postmarketos-mkinitfs-hook/APKBUILD diff --git a/main/postmarketos-mkinitfs-hook-apx/APKBUILD b/main/postmarketos-mkinitfs-hook-apx/APKBUILD deleted file mode 100644 index c2798f8fc..000000000 --- a/main/postmarketos-mkinitfs-hook-apx/APKBUILD +++ /dev/null @@ -1,24 +0,0 @@ -# Documentation: https://wiki.postmarketos.org/wiki/Nvidia_Tegra#APX -maintainer="" -pkgname=postmarketos-mkinitfs-hook-apx -pkgver=1 -pkgrel=2 -pkgdesc="Enter APX on boot for NVIDIA Tegra devices" -url="https://postmarketos.org" -depends="postmarketos-mkinitfs devmem2" -source="00-apx.sh 00-apx.files" -arch="aarch64 armv7" -license="GPL-2.0-or-later" -options="!check" - -package() { - install -Dm644 "$srcdir"/00-apx.sh \ - "$pkgdir"/usr/share/mkinitfs/hooks/00-apx.sh - install -Dm644 "$srcdir"/00-apx.files \ - "$pkgdir"/usr/share/mkinitfs/files/00-apx.files -} - -sha512sums=" -9dba7ac8266ed3bd74895a7f1d0353d3a01e6b63c78e9eb6bf33a23a4a86fef647858e2069e7d82f3dac4e9b3f4d7b6239373018212f0dd6dc01ad9f15e18d2a 00-apx.sh -3fbe0463aa08e7a1ed8141c2d1d84e0e2ced53dc9b0d3a06dbca4a302bf5d96bc1a2e5c9a9600efc19b57c178326f4f0194a8839bb50de3192d8f19cc92fb980 00-apx.files -" diff --git a/main/postmarketos-mkinitfs-hook-ci/APKBUILD b/main/postmarketos-mkinitfs-hook-ci/APKBUILD deleted file mode 100644 index e538e09b1..000000000 --- a/main/postmarketos-mkinitfs-hook-ci/APKBUILD +++ /dev/null @@ -1,26 +0,0 @@ -# Co-Maintainer: Pablo Correa Gomez -maintainer="Casey Connolly " -pkgname=postmarketos-mkinitfs-hook-ci -pkgver=3 -pkgrel=0 -pkgdesc="Hook for doing automated CI tests in the initramfs" -url="https://postmarketos.org" -source=" - 05-ci.sh - 05-ci.files -" -arch="noarch" -license="GPL2" -options="!check" - -package() { - install -Dm755 "$srcdir"/05-ci.sh \ - "$pkgdir"/usr/share/mkinitfs/hooks/05-ci.sh - install -Dm644 "$srcdir"/05-ci.files \ - "$pkgdir"/usr/share/mkinitfs/files/05-ci.files -} - -sha512sums=" -1fed0452581f0384c5fa1178e800f8d8aa1a3af8ecb2626006a3b284d7983d772c6abf3cf23c5cbca105344915224377059dcf6784e9cf70ca54720e6d5fa896 05-ci.sh -26d665b817a4978dca44e0c697d98e12c58fa7941da86b9e3bfef6ecb0791d55859c0b671c00d7f88cfca688acf0dcc3e593ca5d8dd3cc094f582b49dabea645 05-ci.files -" diff --git a/main/postmarketos-mkinitfs-hook-debug-shell/APKBUILD b/main/postmarketos-mkinitfs-hook-debug-shell/APKBUILD deleted file mode 100644 index c6a8bb19c..000000000 --- a/main/postmarketos-mkinitfs-hook-debug-shell/APKBUILD +++ /dev/null @@ -1,20 +0,0 @@ -maintainer="" -pkgname=postmarketos-mkinitfs-hook-debug-shell -pkgver=0.8.1 -pkgrel=0 -pkgdesc="Root shell in the initramfs (security hole, for debugging only)" -url="https://postmarketos.org" -depends="postmarketos-mkinitfs devicepkg-utils fbdebug evtest linuxconsoletools reboot-mode libinput libinput-tools" -source="20-debug-shell.files" -arch="noarch" -license="GPL2" -options="!check" - -package() { - install -Dm644 "$srcdir"/20-debug-shell.files \ - "$pkgdir"/usr/share/mkinitfs/files/20-debug-shell.files -} - -sha512sums=" -793760737487d0034d93dd0ff526959cda9cd639f489d417cdd69bc49576b709a37f57cd496afca1fa91d3fd3a3e24a0cf641aeaa4ff2a2bbb27434eca0be1ce 20-debug-shell.files -" diff --git a/main/postmarketos-mkinitfs-hook-kernel-panic/APKBUILD b/main/postmarketos-mkinitfs-hook-kernel-panic/APKBUILD deleted file mode 100644 index 7349d0c2c..000000000 --- a/main/postmarketos-mkinitfs-hook-kernel-panic/APKBUILD +++ /dev/null @@ -1,19 +0,0 @@ -maintainer="" -pkgname=postmarketos-mkinitfs-hook-kernel-panic -pkgver=0.1.0 -pkgrel=1 -pkgdesc="Script to cause a kernel panic after 30s from the initramfs (for debugging only)" -url="https://postmarketos.org" -depends="postmarketos-mkinitfs" -source="00-kernel-panic.sh" -arch="noarch" -license="GPL2" -# no tests -options="!check" - -package() { - install -Dm644 "$srcdir"/00-kernel-panic.sh \ - -t "$pkgdir"/usr/share/mkinitfs/hooks/ -} - -sha512sums="39be4de98daf4306c15dc8196bcd7649a149e5babccf9860c753d40f1e17ef550556444f65238d30d9dbc3d8610319b0d00f9ff99f128fd8a6bd4cdfb3b38dbe 00-kernel-panic.sh" diff --git a/main/postmarketos-mkinitfs-hook-maximum-attention/APKBUILD b/main/postmarketos-mkinitfs-hook-maximum-attention/APKBUILD deleted file mode 100644 index 45ad4dffc..000000000 --- a/main/postmarketos-mkinitfs-hook-maximum-attention/APKBUILD +++ /dev/null @@ -1,20 +0,0 @@ -maintainer="" -pkgname=postmarketos-mkinitfs-hook-maximum-attention -pkgver=0.2.0 -pkgrel=0 -pkgdesc="Script to activate all user-visible outputs from the initramfs (to confirm working kernel, for debugging only)" -url="https://postmarketos.org" -depends="postmarketos-mkinitfs" -source="00-maximum-attention.sh" -arch="noarch" -license="GPL2" -# no tests -options="!check" - -package() { - install -Dm644 "$srcdir"/00-maximum-attention.sh \ - -t "$pkgdir"/usr/share/mkinitfs/hooks/ -} -sha512sums=" -ca3ef48e76e21fdb67fdf7477fb4739e329ce6ea04a52ac14e9365adb92058b21e08fcbc4020519c61ba20cd3c91d254118ece3d1818cb46f86e86f5ffa1b90a 00-maximum-attention.sh -" diff --git a/main/postmarketos-mkinitfs-hook-netboot/APKBUILD b/main/postmarketos-mkinitfs-hook-netboot/APKBUILD deleted file mode 100644 index 35792fb0f..000000000 --- a/main/postmarketos-mkinitfs-hook-netboot/APKBUILD +++ /dev/null @@ -1,26 +0,0 @@ -maintainer="" -pkgname=postmarketos-mkinitfs-hook-netboot -pkgver=4.2.0 -pkgrel=1 -pkgdesc="Netboot postmarketOS using nbd feature" -url="https://postmarketos.org" -depends="devicepkg-utils postmarketos-mkinitfs !usb-moded" -source=" - netboot.sh - netboot.modules - " -arch="noarch" -license="GPL-2.0-or-later" -options="!check" # No tests - -package() { - install -Dm644 "$srcdir"/netboot.sh \ - "$pkgdir"/usr/share/mkinitfs/hooks/netboot.sh - install -Dm644 "$srcdir"/netboot.modules \ - "$pkgdir"/usr/share/mkinitfs/modules/30-netboot.modules -} - -sha512sums=" -c681d0c39eecd9fe5d284e07f9c6f79e41085628abe1c645b8ea3cc4e621fd603fca9db4a555fa689a3268925cb6d23c12baa98986baed452375acd1e3fe26b1 netboot.sh -3c9c812a6cd25640e6cf4d722cff6c6356d5666ec6009b4c65f89e62211cc406d2cd09e0fdda6b1c1906ee32c3854988ab701cee8811208e3ef666f09e638568 netboot.modules -" diff --git a/main/postmarketos-mkinitfs-hook-verbose-initfs/APKBUILD b/main/postmarketos-mkinitfs-hook-verbose-initfs/APKBUILD deleted file mode 100644 index 9d81c94ef..000000000 --- a/main/postmarketos-mkinitfs-hook-verbose-initfs/APKBUILD +++ /dev/null @@ -1,19 +0,0 @@ -maintainer="" -pkgname=postmarketos-mkinitfs-hook-verbose-initfs -pkgver=0.1.0 -pkgrel=1 -pkgdesc="Print all shell commands executed by initramfs to the console" -url="https://postmarketos.org" -depends="postmarketos-mkinitfs" -source="10-verbose-initfs.sh" -arch="noarch" -license="GPL2" -# no tests -options="!check" - -package() { - install -Dm644 "$srcdir"/10-verbose-initfs.sh \ - -t "$pkgdir"/usr/share/mkinitfs/hooks/ -} - -sha512sums="97d92de64dc870e293a47bb2959877b63f20692030277083e56e499022fc643c1f199a65bd11f8dce9634ac3b80a43dd6934e29de4cf0b53fb2e663f46675a0f 10-verbose-initfs.sh" diff --git a/main/postmarketos-mkinitfs-hook-apx/00-apx.files b/main/postmarketos-mkinitfs-hook/00-apx.files similarity index 100% rename from main/postmarketos-mkinitfs-hook-apx/00-apx.files rename to main/postmarketos-mkinitfs-hook/00-apx.files diff --git a/main/postmarketos-mkinitfs-hook-apx/00-apx.sh b/main/postmarketos-mkinitfs-hook/00-apx.sh similarity index 100% rename from main/postmarketos-mkinitfs-hook-apx/00-apx.sh rename to main/postmarketos-mkinitfs-hook/00-apx.sh diff --git a/main/postmarketos-mkinitfs-hook-kernel-panic/00-kernel-panic.sh b/main/postmarketos-mkinitfs-hook/00-kernel-panic.sh similarity index 100% rename from main/postmarketos-mkinitfs-hook-kernel-panic/00-kernel-panic.sh rename to main/postmarketos-mkinitfs-hook/00-kernel-panic.sh diff --git a/main/postmarketos-mkinitfs-hook-maximum-attention/00-maximum-attention.sh b/main/postmarketos-mkinitfs-hook/00-maximum-attention.sh similarity index 69% rename from main/postmarketos-mkinitfs-hook-maximum-attention/00-maximum-attention.sh rename to main/postmarketos-mkinitfs-hook/00-maximum-attention.sh index 671c7bc4b..e9b711444 100644 --- a/main/postmarketos-mkinitfs-hook-maximum-attention/00-maximum-attention.sh +++ b/main/postmarketos-mkinitfs-hook/00-maximum-attention.sh @@ -1,4 +1,6 @@ #!/bin/sh + +# shellcheck disable=SC1091 . ./init_functions.sh BLINK_INTERVAL=2 # seconds @@ -6,7 +8,7 @@ VIBRATION_DURATION=400 #ms VIBRATION_INTERVAL=2 #s find_leds() { - find /sys -name "max_brightness" | xargs -I{} dirname {} + find /sys -name "max_brightness" -print0 | xargs -0 -I{} dirname {} } find_vibrator() { @@ -20,13 +22,13 @@ find_vibrator() { blink_leds() { state=false # false = off, true=on while true; do - for led in $@; do + for led in "$@"; do if [ "$state" = true ]; then - cat $led/max_brightness > $led/brightness + cat "$led"/max_brightness > "$led"/brightness else - echo 0 > $led/brightness + echo 0 > "$led"/brightness fi - echo blinking LED: $led + echo blinking LED: "$led" done sleep ${BLINK_INTERVAL}s if [ "$state" = true ]; then @@ -40,17 +42,17 @@ blink_leds() { # vibrate_loop vibrates each VIBRATION_INTERVAL for VIBRATION_DURATION # it takes a timed_device path to the vibrator as $1 vibrate_loop() { - if [ ! -f $1/enable ]; then + if [ ! -f "$1"/enable ]; then return; fi while true; do - echo $VIBRATION_DURATION > $1/enable + echo $VIBRATION_DURATION > "$1"/enable sleep ${VIBRATION_INTERVAL}s done } -blink_leds $(find_leds) & -vibrate_loop $(find_vibrator) & +blink_leds "$(find_leds)" & +vibrate_loop "$(find_vibrator)" & fail_halt_boot diff --git a/main/postmarketos-mkinitfs-hook-netboot/netboot.sh b/main/postmarketos-mkinitfs-hook/00-netboot.sh similarity index 100% rename from main/postmarketos-mkinitfs-hook-netboot/netboot.sh rename to main/postmarketos-mkinitfs-hook/00-netboot.sh diff --git a/main/postmarketos-mkinitfs-hook-ci/05-ci.files b/main/postmarketos-mkinitfs-hook/05-ci.files similarity index 100% rename from main/postmarketos-mkinitfs-hook-ci/05-ci.files rename to main/postmarketos-mkinitfs-hook/05-ci.files diff --git a/main/postmarketos-mkinitfs-hook-ci/05-ci.sh b/main/postmarketos-mkinitfs-hook/05-ci.sh similarity index 90% rename from main/postmarketos-mkinitfs-hook-ci/05-ci.sh rename to main/postmarketos-mkinitfs-hook/05-ci.sh index 792208d12..dd520a307 100644 --- a/main/postmarketos-mkinitfs-hook-ci/05-ci.sh +++ b/main/postmarketos-mkinitfs-hook/05-ci.sh @@ -1,9 +1,8 @@ #!/bin/sh # shellcheck shell=busybox -# shellcheck source=../postmarketos-initramfs/init_functions.sh +# shellcheck disable=SC1091 . ./init_functions.sh -# shellcheck source=../devicepkg-utils/source_deviceinfo . /usr/share/misc/source_deviceinfo # Prints a given string a couple of times, over a span of time diff --git a/main/postmarketos-mkinitfs-hook-verbose-initfs/10-verbose-initfs.sh b/main/postmarketos-mkinitfs-hook/10-verbose-initfs.sh similarity index 100% rename from main/postmarketos-mkinitfs-hook-verbose-initfs/10-verbose-initfs.sh rename to main/postmarketos-mkinitfs-hook/10-verbose-initfs.sh diff --git a/main/postmarketos-mkinitfs-hook-debug-shell/20-debug-shell.files b/main/postmarketos-mkinitfs-hook/20-debug-shell.files similarity index 100% rename from main/postmarketos-mkinitfs-hook-debug-shell/20-debug-shell.files rename to main/postmarketos-mkinitfs-hook/20-debug-shell.files diff --git a/main/postmarketos-mkinitfs-hook-netboot/netboot.modules b/main/postmarketos-mkinitfs-hook/30-netboot.modules similarity index 100% rename from main/postmarketos-mkinitfs-hook-netboot/netboot.modules rename to main/postmarketos-mkinitfs-hook/30-netboot.modules diff --git a/main/postmarketos-mkinitfs-hook/APKBUILD b/main/postmarketos-mkinitfs-hook/APKBUILD new file mode 100644 index 000000000..a48efc417 --- /dev/null +++ b/main/postmarketos-mkinitfs-hook/APKBUILD @@ -0,0 +1,119 @@ +# Co-Maintainer: Casey Connolly +# Co-Maintainer: Pablo Correa Gomez +maintainer="Aster Boese " +pkgname=postmarketos-mkinitfs-hook +pkgver=1 +pkgrel=0 +pkgdesc="Meta package for mkinitfs hooks" +url="https://postmarketos.org" +arch="noarch" +license="GPL-3.0-or-later" +depends="postmarketos-mkinitfs" +subpackages=" + $pkgname-apx + $pkgname-ci + $pkgname-debug-shell:debug_shell + $pkgname-kernel-panic:kernel_panic + $pkgname-maximum-attention:maximum_attention + $pkgname-netboot + $pkgname-verbose-initfs:verbose_initfs + " +_hooks=" + 00-apx.sh + 00-kernel-panic.sh + 00-maximum-attention.sh + 00-netboot.sh + 05-ci.sh + 10-verbose-initfs.sh + " +_files=" + 00-apx.files + 05-ci.files + 20-debug-shell.files + " +source="$_hooks $_files 30-netboot.modules" +# check: no tests +options="!check" + +package() { + for hook in $_hooks; do + install -Dm755 "$srcdir"/"$hook" \ + "$pkgdir"/usr/share/mkinitfs/hooks/"$hook" + done + for file in $_files; do + install -Dm644 "$srcdir"/"$hook" \ + "$pkgdir"/usr/share/mkinitfs/files/"$file" + done + install -Dm644 "$srcdir"/30-netboot.modules \ + -t "$pkgdir"/usr/share/mkinitfs/modules/ +} + +apx() { + pkgdesc="Hook for entering APX on boot for NVIDIA Tegra devices" + depends="$depends devmem2" + + amove usr/share/mkinitfs/hooks/00-apx.sh + amove usr/share/mkinitfs/files/00-apx.files +} + +ci() { + pkgdesc="Hook for doing automated CI tests in the initramfs" + + amove usr/share/mkinitfs/hooks/05-ci.sh + amove usr/share/mkinitfs/files/05-ci.files +} + +debug_shell() { + pkgdesc="Files for root shell in the initramfs (testing only)" + depends=" + $depends + devicepkg-utils + evtest + fbdebug + libinput + libinput-tools + linuxconsoletools + reboot-mode + " + + amove usr/share/mkinitfs/files/20-debug-shell.files +} + +kernel_panic() { + pkgdesc="Hook to cause a kernel panic after 30 seconds in the initramfs" + + amove usr/share/mkinitfs/hooks/00-kernel-panic.sh +} + +maximum_attention() { + pkgdesc="Hook to activate all user-visible outputs in the initramfs" + + amove usr/share/mkinitfs/hooks/00-maximum-attention.sh +} + +netboot() { + pkgdesc="Hook to netboot a rootfs using nbd" + depends="$depends devicepkg-utils nbd !usb-moded" + + amove usr/share/mkinitfs/hooks/00-netboot.sh + amove usr/share/mkinitfs/modules/30-netboot.modules +} + +verbose_initfs() { + pkgdesc="Hook to print all shell commands executed by the initramfs to the console" + + amove usr/share/mkinitfs/hooks/10-verbose-initfs.sh +} + +sha512sums=" +9dba7ac8266ed3bd74895a7f1d0353d3a01e6b63c78e9eb6bf33a23a4a86fef647858e2069e7d82f3dac4e9b3f4d7b6239373018212f0dd6dc01ad9f15e18d2a 00-apx.sh +39be4de98daf4306c15dc8196bcd7649a149e5babccf9860c753d40f1e17ef550556444f65238d30d9dbc3d8610319b0d00f9ff99f128fd8a6bd4cdfb3b38dbe 00-kernel-panic.sh +9c3ec5bee3bcdd79c8996bf8ee39067121873d705db6e8aa96212bd41c5b9db854e10d9c105e515ed1a5dcc29ac37fa726aa5bd910feb00b5024b76c1dd70059 00-maximum-attention.sh +c681d0c39eecd9fe5d284e07f9c6f79e41085628abe1c645b8ea3cc4e621fd603fca9db4a555fa689a3268925cb6d23c12baa98986baed452375acd1e3fe26b1 00-netboot.sh +9c2958c3e7d9c103249308eeebb0476b1a24a0a6f6e841ac7442a9b0d1897e14268bef391ae66cf17b4ac5c45caa046426fee0624d6517ee5830615518ba46be 05-ci.sh +97d92de64dc870e293a47bb2959877b63f20692030277083e56e499022fc643c1f199a65bd11f8dce9634ac3b80a43dd6934e29de4cf0b53fb2e663f46675a0f 10-verbose-initfs.sh +3fbe0463aa08e7a1ed8141c2d1d84e0e2ced53dc9b0d3a06dbca4a302bf5d96bc1a2e5c9a9600efc19b57c178326f4f0194a8839bb50de3192d8f19cc92fb980 00-apx.files +26d665b817a4978dca44e0c697d98e12c58fa7941da86b9e3bfef6ecb0791d55859c0b671c00d7f88cfca688acf0dcc3e593ca5d8dd3cc094f582b49dabea645 05-ci.files +793760737487d0034d93dd0ff526959cda9cd639f489d417cdd69bc49576b709a37f57cd496afca1fa91d3fd3a3e24a0cf641aeaa4ff2a2bbb27434eca0be1ce 20-debug-shell.files +3c9c812a6cd25640e6cf4d722cff6c6356d5666ec6009b4c65f89e62211cc406d2cd09e0fdda6b1c1906ee32c3854988ab701cee8811208e3ef666f09e638568 30-netboot.modules +"