From 32fc24cd4a9dddb31a3f282e90a20d003a592d2a Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Mon, 23 Jan 2023 08:38:48 +0100 Subject: [PATCH] main/postmarketos-mkinitfs: upgrade to 1.6 (MR 3821) Add support for hook scripts in initramfs-extra to the shell scripts. Related: https://gitlab.com/postmarketOS/postmarketos-mkinitfs/-/merge_requests/27 --- main/postmarketos-mkinitfs/APKBUILD | 10 +++++----- main/postmarketos-mkinitfs/init.sh | 9 +++------ main/postmarketos-mkinitfs/init_functions.sh | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/main/postmarketos-mkinitfs/APKBUILD b/main/postmarketos-mkinitfs/APKBUILD index 635cca818..21396ea04 100644 --- a/main/postmarketos-mkinitfs/APKBUILD +++ b/main/postmarketos-mkinitfs/APKBUILD @@ -1,8 +1,8 @@ # Maintainer: Oliver Smith # Co-Maintainer: Clayton Craft pkgname=postmarketos-mkinitfs -pkgver=1.5.1 -pkgrel=4 +pkgver=1.6 +pkgrel=0 pkgdesc="Tool to generate initramfs images for postmarketOS" url="https://postmarketos.org" depends=" @@ -65,8 +65,8 @@ check() { } sha512sums=" -d28802b17d7912a58d23c02fbdddfdb6f74489e712d61a59472f7f000a4429786f69ba2fca59d321c55c277ff79edb6f47c939a9e973b31f694aeca0167354ff postmarketos-mkinitfs-1.5.1.tar.gz +ff5548fa4a6e2cf6326a43c23d13f36c9abb40d131e61f5b8ed544260e0b319d362a68878fc38abd011bc036e5e669a13c57a39479f6672721b7bf70c20bad2e postmarketos-mkinitfs-1.6.tar.gz 20f110337113e8de8999cf2a064a93fea36821d5c216bfa4ba46ec1f83825638262b92fd7be29eee0a85a54a108b7315a96cbe30da8ae4419f54c2ed53bb08c7 00-default.modules -92397322bea64ab5e4dfcd572ddad361b55bd5b59cfb34d5e143416a2ae80182b2d14cdeb0b8b25216792495827922cd5ab6bfa8ed720a79359975293a662630 init.sh -bf9787338df2ad90f1f9c80d88b91bbd5f394fef27cf588ed9a2b7a1e5550cc6b89ea8755c789dd182b23b8d86cbcf8f9b76b12e126a5a67f0b0ba1c315c1850 init_functions.sh +f9a3ebf7f116df5f50c047d99d9353ea97965522d6d80a039d4f79316c5152f49499fab654f8b12b54dd247f1497957e5c3d957292b09c3d449f3d1fa7d43d9a init.sh +57ad4267c97153c9ca606c5422de887cc62ec44faafacaf24923fa524068e6103a2de9ad50b70320f75e105e8b82ab65cde7f5efac3c27f0155b3086bc4f3431 init_functions.sh " diff --git a/main/postmarketos-mkinitfs/init.sh b/main/postmarketos-mkinitfs/init.sh index 23604fee5..1e6a35924 100644 --- a/main/postmarketos-mkinitfs/init.sh +++ b/main/postmarketos-mkinitfs/init.sh @@ -22,12 +22,7 @@ setup_mdev setup_dynamic_partitions "${deviceinfo_super_partitions:=}" mount_subpartitions setup_framebuffer - -# Hooks -for hook in /etc/postmarketos-mkinitfs/hooks/*.sh; do - [ -e "$hook" ] || continue - sh "$hook" -done +run_hooks /etc/postmarketos-mkinitfs/hooks # Always run dhcp daemon/usb networking for now (later this should only # be enabled, when having the debug-shell hook installed for debugging, @@ -39,6 +34,8 @@ mount_boot_partition /boot show_splash_loading extract_initramfs_extra /boot/initramfs-extra setup_udev +run_hooks /etc/postmarketos-mkinitfs/hooks-extra + # charging-sdl does not work properly at the moment, so skip it. # See also https://gitlab.com/postmarketOS/pmaports/-/issues/1064 # start_charging_mode diff --git a/main/postmarketos-mkinitfs/init_functions.sh b/main/postmarketos-mkinitfs/init_functions.sh index 5ff499026..963aff0b3 100644 --- a/main/postmarketos-mkinitfs/init_functions.sh +++ b/main/postmarketos-mkinitfs/init_functions.sh @@ -450,6 +450,20 @@ mount_root_partition() { fi } +# $1: path to the hooks dir +run_hooks() { + scriptsdir="$1" + + if ! [ -d "$scriptsdir" ]; then + return + fi + + for hook in "$scriptsdir"/*.sh; do + echo "Running initramfs hook: $hook" + sh "$hook" + done +} + setup_usb_network_android() { # Only run, when we have the android usb driver SYS=/sys/class/android_usb/android0