From 78762563c20d1c649dd8fb68debc9e9a418e5bb7 Mon Sep 17 00:00:00 2001 From: Caleb Connolly Date: Tue, 17 Oct 2023 00:02:01 +0100 Subject: [PATCH] postmarketos-initramfs: use blkid (MR 4487) Explicitly pull in the blkid package (we already added it to 00-initramfs-base.files), and replace uses of busybox findfs. Full fat blkid supports PARTLABEL (so the /dev/disk/by-partlabel symlinks will work consistently now), and has some nice optimisations that make the lookup times a lot faster than busybox findfs. [ci:skip-build]: already built successfully in CI --- main/postmarketos-initramfs/APKBUILD | 5 +++-- main/postmarketos-initramfs/init_functions.sh | 14 +++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/main/postmarketos-initramfs/APKBUILD b/main/postmarketos-initramfs/APKBUILD index d17f8ca66..2dbc7d796 100644 --- a/main/postmarketos-initramfs/APKBUILD +++ b/main/postmarketos-initramfs/APKBUILD @@ -1,12 +1,13 @@ # Maintainer: Oliver Smith # Co-Maintainer: Clayton Craft pkgname=postmarketos-initramfs -pkgver=2.0.2 +pkgver=2.0.3 pkgrel=0 pkgdesc="Base files for the postmarketOS initramfs / initramfs-extra" url="https://postmarketos.org" options="!check" # no tests depends=" + blkid btrfs-progs busybox-extras bzip2 @@ -79,7 +80,7 @@ bed319179bcd0b894d6267c7e73f2890db07bc07df71542936947dfb3bdb17fade8a7b4e7b577f27 ab41b45b0613f25a61114ed8c8b92bc53c60838f6e2e0ba18c76e5369b2984e6023a0661887692673aca3f647f268c468a468f6b1ac424cfee609017a89481dd 00-initramfs-base.files 8a4adad3785af474b36a09a05f6a3b2c4b4f43aac331a53b903abfa51ea12be1e3d1d807b7a6e66a1346815f3b0044daf8cd62e21e2dc75d2db13ee265a72985 00-initramfs-extra-base.files f4cf21601cc9aad8545a8d5e8f5287dcd2284bf077b4c42b3604fe7f874dd9a9f6974ff8f84e6e0acaf15f7a307db604d84d3e8598d33e9112738748e58915e4 init.sh -d1dace51f4fadb2846fc660f8cbd41e10c901c14c05cfc0e571c889f6f9d7a7164c72a0a1e402e3a6a8dbd7af9d3b32a1065ba46f1069158c9c6d5e2bd9d7b24 init_functions.sh +182e15e979adbab9a4964831174f01989e828557300c60232df2d42d6730d5b14b901d01148ea5f332fe0a69354f9840bed8d6d7bd12864499944dad5f91d018 init_functions.sh ba3275a9af788c7c782322a22a0f144d5e50e3498ea6886486a29331f23ae89cd32d500a3635cfa7cab369afba92edc18aeca64ccbf0cd589061cce23d15b46c unudhcpd.conf 675e7d5bee39b2df7d322117f8dcaccc274d61beaf4d50ead19bbf2109446d64b1c0aa0c5b4f9846eb6c1c403418f28f6364eff4537ba41120fbfcbc484b7da7 mdev.conf " diff --git a/main/postmarketos-initramfs/init_functions.sh b/main/postmarketos-initramfs/init_functions.sh index 3506530fe..cc01fe328 100644 --- a/main/postmarketos-initramfs/init_functions.sh +++ b/main/postmarketos-initramfs/init_functions.sh @@ -175,7 +175,7 @@ find_root_partition() { if [ "$ROOT_PARTITION_UNLOCKED" = 0 ]; then for x in $(cat /proc/cmdline); do if ! [ "$x" = "${x#pmos_root_uuid=}" ]; then - path="$(findfs UUID="${x#pmos_root_uuid=}")" + path="$(blkid --uuid "${x#pmos_root_uuid=}")" if [ -n "$path" ]; then PMOS_ROOT="$path" break @@ -217,7 +217,7 @@ find_root_partition() { if [ -z "$PMOS_ROOT" ]; then for id in pmOS_install pmOS_root; do - PMOS_ROOT="$(findfs LABEL="$id")" + PMOS_ROOT="$(blkid --label "$id")" [ -n "$PMOS_ROOT" ] && break done fi @@ -243,8 +243,8 @@ find_boot_partition() { # shellcheck disable=SC2013 for x in $(cat /proc/cmdline); do if ! [ "$x" = "${x#pmos_boot_uuid=}" ]; then - # For the UUID, we validate if findfs returns a path - path="$(findfs UUID="${x#pmos_boot_uuid=}")" + # Check if there is a partition with a matching UUID + path="$(blkid --uuid "${x#pmos_boot_uuid=}")" if [ -n "$path" ]; then PMOS_BOOT="$path" break @@ -268,13 +268,13 @@ find_boot_partition() { done fi - # Finally fall back to findfs by label + # Finally fall back to searching by label if [ -z "$PMOS_BOOT" ]; then # * "pmOS_i_boot" installer boot partition (fits 11 chars for fat32) # * "pmOS_inst_boot" old installer boot partition (backwards compat) # * "pmOS_boot" boot partition after installation for p in pmOS_i_boot pmOS_inst_boot pmOS_boot; do - PMOS_BOOT="$(findfs LABEL="$p")" + PMOS_BOOT="$(blkid --label "$p")" [ -n "$PMOS_BOOT" ] && break done fi @@ -379,7 +379,7 @@ resize_root_partition() { partition=$(find_root_partition) # Do not resize the installer partition - if blkid "$partition" | grep -q pmOS_install; then + if [ "$(blkid --label pmOS_install)" = "$partition" ]; then echo "Resize root partition: skipped (on-device installer)" return fi