From ac1d78a24636934ca6a071babc57011cc7b8cc0f Mon Sep 17 00:00:00 2001 From: Caleb Connolly Date: Fri, 20 Oct 2023 02:16:43 +0100 Subject: [PATCH] devicepkg-dev: add pmtest helper (MR 4420) Add a helper to generate a post-install script for device pmtest subpackages. This script configures the console and enables logging in the initramfs for images running in CI. [ci:ignore-count] --- main/devicepkg-dev/APKBUILD | 6 ++++- .../devicepkg_pmtest_post_install.sh | 23 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 main/devicepkg-dev/devicepkg_pmtest_post_install.sh diff --git a/main/devicepkg-dev/APKBUILD b/main/devicepkg-dev/APKBUILD index 3a6ec5f32..cfa194474 100644 --- a/main/devicepkg-dev/APKBUILD +++ b/main/devicepkg-dev/APKBUILD @@ -1,5 +1,5 @@ pkgname=devicepkg-dev -pkgver=0.16.0 +pkgver=0.17.0 pkgrel=0 pkgdesc="Provides default device package functions" url="https://postmarketos.org" @@ -9,6 +9,7 @@ source=" compiler-gcc.h devicepkg_build.sh devicepkg_package.sh + devicepkg_pmtest_post_install.sh downstreamkernel_prepare.sh downstreamkernel_package.sh devicepkg_subpackage_kernel.sh @@ -62,6 +63,8 @@ package() { "$pkgdir/usr/bin/devicepkg_build" install -Dm755 "$srcdir/devicepkg_package.sh" \ "$pkgdir/usr/bin/devicepkg_package" + install -Dm755 "$srcdir/devicepkg_pmtest_post_install.sh" \ + "$pkgdir"/usr/bin/devicepkg_pmtest_post_install install -Dm755 "$srcdir/downstreamkernel_prepare.sh" \ "$pkgdir/usr/bin/downstreamkernel_prepare" install -Dm755 "$srcdir/downstreamkernel_package.sh" \ @@ -75,6 +78,7 @@ sha512sums=" d69930dd790b00fb39760a37d95a10899f0d167e10e2804feb05d9ce04f94185dc32d36edc90214aba2ea2aa09bf18f7dab93f1d2eff23f67beb2cc83be30e7c compiler-gcc.h 54b369ff87e017114edae03986dec79742280c55a156a98ea8c6a1c740632e904e51c01810e7dac99add0d9d06c0fcebb040fed595348f180233b3ec810443ba devicepkg_build.sh 5b83255dabd2019ea07a589d185bee5dad6760e28ab02de3480a0adfd1cf20d0c2e0b4a978e56757899ef683819091cee99d168a48e24a3f604b725e1ba26849 devicepkg_package.sh +3b997a00e76be7d4540290275585026c5b83832c0b9a7214346763f03ec196b3f1bea9f50a9928a5cab0bc22dc557af136ffe146bd45d3666b5c05589891047d devicepkg_pmtest_post_install.sh f81e74e45ae8e55686ae459f550e229e7398daeafa72bd023c2d8c3a0d50e60bf53d5bbdfec931e9fbabe1cd71de57b2192805aaef091ab90bc7203cbaf66ba6 downstreamkernel_prepare.sh 107242a3da38a574c46cb779e0c75afbeef4cfe659e1b85971973ac55843df06f70f53a5985ca623d4123f05f2984f5dace4a53a3509ecefd7dfdc3c8b705cfe downstreamkernel_package.sh ece2e6352c61c5764b2502d05b388880f53f2cded3056aed003c9cf5245328627c0b0fb08a3102e7064acdcba8715b8d5bf4c07a7b87e9f635b87e2450e75fc0 devicepkg_subpackage_kernel.sh diff --git a/main/devicepkg-dev/devicepkg_pmtest_post_install.sh b/main/devicepkg-dev/devicepkg_pmtest_post_install.sh new file mode 100644 index 000000000..add8661ae --- /dev/null +++ b/main/devicepkg-dev/devicepkg_pmtest_post_install.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +console=$1 +subpkgname=${subpkgname:-ERROR} + +if [ "$subpkgname" = "ERROR" ]; then + echo "ERROR: devicepkg_pmtest_post_install should only be called" >&2 + echo "from an APKBUILD subpackage function" >&2 +fi + +# Install a trigger so that mkinitfs will run when this package is installed +# shellcheck disable=SC2154 +mkdir -p "$subpkgdir/usr/share/mkinitfs-triggers/" +touch "$subpkgdir/usr/share/mkinitfs-triggers/$subpkgname" + +# Echo out the .post-install data for the calling package to pipe to their +# .post-install file +cat <> /etc/deviceinfo +echo 'deviceinfo_kernel_cmdline_append="console=$console PMOS_NO_OUTPUT_REDIRECT"' >> /etc/deviceinfo +EOF