postmarketos-initramfs: support running in CI (MR 4420)

Enable using the postmarketOS initramfs for boot-testing devices, in
this scenario we don't care about some components like the splash, mdev,
or subpartitions, instead we want to run full udev (to load all devices)
and then run hooks. The ci hook will deadloop after running tests.

Signed-off-by: Caleb Connolly <caleb@connolly.tech>
This commit is contained in:
Caleb Connolly 2023-09-25 15:39:50 +01:00
parent ac1d78a246
commit 69832ab121
No known key found for this signature in database
GPG key ID: 7930459FB9303217
2 changed files with 24 additions and 9 deletions

View file

@ -1,7 +1,7 @@
# Maintainer: Oliver Smith <ollieparanoid@postmarketos.org> # Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
# Co-Maintainer: Clayton Craft <clayton@craftyguy.net> # Co-Maintainer: Clayton Craft <clayton@craftyguy.net>
pkgname=postmarketos-initramfs pkgname=postmarketos-initramfs
pkgver=2.0.3 pkgver=2.1.0
pkgrel=0 pkgrel=0
pkgdesc="Base files for the postmarketOS initramfs / initramfs-extra" pkgdesc="Base files for the postmarketOS initramfs / initramfs-extra"
url="https://postmarketos.org" url="https://postmarketos.org"
@ -79,7 +79,7 @@ bed319179bcd0b894d6267c7e73f2890db07bc07df71542936947dfb3bdb17fade8a7b4e7b577f27
5b364300f31c91fd0591eb0715f67cbf5383f45246a5fb9f34b79f7cb2e3b15768b2130e5f32f816cc169950f988c1beabc879ba31645c58ce131a288dbc071d 00-initramfs-base.dirs 5b364300f31c91fd0591eb0715f67cbf5383f45246a5fb9f34b79f7cb2e3b15768b2130e5f32f816cc169950f988c1beabc879ba31645c58ce131a288dbc071d 00-initramfs-base.dirs
ab41b45b0613f25a61114ed8c8b92bc53c60838f6e2e0ba18c76e5369b2984e6023a0661887692673aca3f647f268c468a468f6b1ac424cfee609017a89481dd 00-initramfs-base.files ab41b45b0613f25a61114ed8c8b92bc53c60838f6e2e0ba18c76e5369b2984e6023a0661887692673aca3f647f268c468a468f6b1ac424cfee609017a89481dd 00-initramfs-base.files
8a4adad3785af474b36a09a05f6a3b2c4b4f43aac331a53b903abfa51ea12be1e3d1d807b7a6e66a1346815f3b0044daf8cd62e21e2dc75d2db13ee265a72985 00-initramfs-extra-base.files 8a4adad3785af474b36a09a05f6a3b2c4b4f43aac331a53b903abfa51ea12be1e3d1d807b7a6e66a1346815f3b0044daf8cd62e21e2dc75d2db13ee265a72985 00-initramfs-extra-base.files
f4cf21601cc9aad8545a8d5e8f5287dcd2284bf077b4c42b3604fe7f874dd9a9f6974ff8f84e6e0acaf15f7a307db604d84d3e8598d33e9112738748e58915e4 init.sh 0db45596accd92712498da1a3fcc6a6a006444446bdf3444c3925bf00acf14ee020a71b9c0931a7031812c98f87ee640d054a0394b44b76fa8200e6b21519cb1 init.sh
182e15e979adbab9a4964831174f01989e828557300c60232df2d42d6730d5b14b901d01148ea5f332fe0a69354f9840bed8d6d7bd12864499944dad5f91d018 init_functions.sh 182e15e979adbab9a4964831174f01989e828557300c60232df2d42d6730d5b14b901d01148ea5f332fe0a69354f9840bed8d6d7bd12864499944dad5f91d018 init_functions.sh
ba3275a9af788c7c782322a22a0f144d5e50e3498ea6886486a29331f23ae89cd32d500a3635cfa7cab369afba92edc18aeca64ccbf0cd589061cce23d15b46c unudhcpd.conf ba3275a9af788c7c782322a22a0f144d5e50e3498ea6886486a29331f23ae89cd32d500a3635cfa7cab369afba92edc18aeca64ccbf0cd589061cce23d15b46c unudhcpd.conf
675e7d5bee39b2df7d322117f8dcaccc274d61beaf4d50ead19bbf2109446d64b1c0aa0c5b4f9846eb6c1c403418f28f6364eff4537ba41120fbfcbc484b7da7 mdev.conf 675e7d5bee39b2df7d322117f8dcaccc274d61beaf4d50ead19bbf2109446d64b1c0aa0c5b4f9846eb6c1c403418f28f6364eff4537ba41120fbfcbc484b7da7 mdev.conf

View file

@ -1,8 +1,12 @@
#!/bin/sh #!/bin/sh
# shellcheck disable=SC1091 # shellcheck disable=SC1091
IN_CI="false"
[ -e /hooks/10-verbose-initfs.sh ] && set -x [ -e /hooks/10-verbose-initfs.sh ] && set -x
[ -e /hooks/05-ci.sh ] && IN_CI="true"
[ -e /etc/unudhcpd.conf ] && . /etc/unudhcpd.conf [ -e /etc/unudhcpd.conf ] && . /etc/unudhcpd.conf
. ./init_functions.sh . ./init_functions.sh
. /usr/share/misc/source_deviceinfo . /usr/share/misc/source_deviceinfo
@ -15,16 +19,27 @@ export PATH=/usr/bin:/bin:/usr/sbin:/sbin
mount_proc_sys_dev mount_proc_sys_dev
setup_log setup_log
setup_firmware_path setup_firmware_path
if [ "$IN_CI" = "false" ]; then
# shellcheck disable=SC2154 # shellcheck disable=SC2154
load_modules /lib/modules/initramfs.load "usb_f_rndis" load_modules /lib/modules/initramfs.load "usb_f_rndis"
setup_framebuffer setup_framebuffer
show_splash "Loading..." show_splash "Loading..."
setup_mdev setup_mdev
setup_dynamic_partitions "${deviceinfo_super_partitions:=}" setup_dynamic_partitions "${deviceinfo_super_partitions:=}"
mount_subpartitions mount_subpartitions
else
# loads all modules
setup_udev
fi
run_hooks /hooks run_hooks /hooks
if [ "$IN_CI" = "true" ]; then
echo "PMOS: CI tests done, disabling console and looping forever"
dmesg -n 1
loop_forever
fi
# Always run dhcp daemon/usb networking for now (later this should only # Always run dhcp daemon/usb networking for now (later this should only
# be enabled, when having the debug-shell hook installed for debugging, # be enabled, when having the debug-shell hook installed for debugging,
# or get activated after the initramfs is done with an OpenRC service). # or get activated after the initramfs is done with an OpenRC service).