main/postmarketos-initramfs: stowaway rootfs (MR 4386)

[ci:skip-build]: already built successfully in CI
This commit is contained in:
SSD 2024-04-28 09:17:41 +02:00 committed by Clayton Craft
parent 8a2904d341
commit 089d7cc987
No known key found for this signature in database
GPG key ID: 4A4CED6D7EDF950A
2 changed files with 30 additions and 3 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.5.6 pkgver=2.6.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"
@ -89,7 +89,7 @@ sha512sums="
ab41b45b0613f25a61114ed8c8b92bc53c60838f6e2e0ba18c76e5369b2984e6023a0661887692673aca3f647f268c468a468f6b1ac424cfee609017a89481dd 00-initramfs-base.files ab41b45b0613f25a61114ed8c8b92bc53c60838f6e2e0ba18c76e5369b2984e6023a0661887692673aca3f647f268c468a468f6b1ac424cfee609017a89481dd 00-initramfs-base.files
8a4adad3785af474b36a09a05f6a3b2c4b4f43aac331a53b903abfa51ea12be1e3d1d807b7a6e66a1346815f3b0044daf8cd62e21e2dc75d2db13ee265a72985 00-initramfs-extra-base.files 8a4adad3785af474b36a09a05f6a3b2c4b4f43aac331a53b903abfa51ea12be1e3d1d807b7a6e66a1346815f3b0044daf8cd62e21e2dc75d2db13ee265a72985 00-initramfs-extra-base.files
b1462989633c65a102e7ae7ced9c41a00673b4c7434cd3fe16c229c39bb870d7e850b0d317487191b7d7ca32c75b2eed1561b1facf405bd4d876d32c71badcf3 init.sh b1462989633c65a102e7ae7ced9c41a00673b4c7434cd3fe16c229c39bb870d7e850b0d317487191b7d7ca32c75b2eed1561b1facf405bd4d876d32c71badcf3 init.sh
8ff684e8245217cc9461297bce55dd8b417f0478ef38cdbddf7662f9ecc4324ca09e75978261084e00f5a1f2e36cc3b25a609a9bdca4addc5a60d3c370cbdb90 init_functions.sh fe9fd7ae5bedf393e96a9fa771396a1aa8b17ba97155070789186cd2e2fa32ab8bf7d003cb88bbe620b4c7713f4086affbede816afdc1b47881d31448bad0862 init_functions.sh
ba3275a9af788c7c782322a22a0f144d5e50e3498ea6886486a29331f23ae89cd32d500a3635cfa7cab369afba92edc18aeca64ccbf0cd589061cce23d15b46c unudhcpd.conf ba3275a9af788c7c782322a22a0f144d5e50e3498ea6886486a29331f23ae89cd32d500a3635cfa7cab369afba92edc18aeca64ccbf0cd589061cce23d15b46c unudhcpd.conf
675e7d5bee39b2df7d322117f8dcaccc274d61beaf4d50ead19bbf2109446d64b1c0aa0c5b4f9846eb6c1c403418f28f6364eff4537ba41120fbfcbc484b7da7 mdev.conf 675e7d5bee39b2df7d322117f8dcaccc274d61beaf4d50ead19bbf2109446d64b1c0aa0c5b4f9846eb6c1c403418f28f6364eff4537ba41120fbfcbc484b7da7 mdev.conf
" "

View file

@ -297,6 +297,15 @@ find_boot_partition() {
done done
fi fi
if grep -q "pmos.stowaway" /proc/cmdline; then
mount_root_partition
PMOS_BOOT="/sysroot/boot"
mount --bind /sysroot/boot /boot
echo "$PMOS_BOOT"
return
fi
PMOS_BOOT=$(pretty_dm_path "$PMOS_BOOT") PMOS_BOOT=$(pretty_dm_path "$PMOS_BOOT")
echo "$PMOS_BOOT" echo "$PMOS_BOOT"
} }
@ -314,6 +323,11 @@ get_partition_type() {
mount_boot_partition() { mount_boot_partition() {
partition=$(find_boot_partition) partition=$(find_boot_partition)
# We dont need to do this when using stowaways
if grep -q "pmos.stowaway" /proc/cmdline; then
return
fi
if [ "$2" = "rw" ]; then if [ "$2" = "rw" ]; then
mount_opts="" mount_opts=""
echo "Mount boot partition ($partition) to $1 (read-write)" echo "Mount boot partition ($partition) to $1 (read-write)"
@ -513,6 +527,11 @@ resize_root_filesystem() {
} }
mount_root_partition() { mount_root_partition() {
# Don't mount root if it is already mounted
if mountpoint -q /sysroot; then
return
fi
partition="$(find_root_partition)" partition="$(find_root_partition)"
rootfsopts="" rootfsopts=""
@ -542,7 +561,15 @@ mount_root_partition() {
fail_halt_boot fail_halt_boot
fi fi
if ! [ -e /sysroot/usr ]; then if [ -e /sysroot/.stowaways/pmos/etc/os-release ]; then
umount /sysroot
mkdir /stowaway
mount -t "$type" -o rw"$rootfsopts" "$partition" /stowaway
mount --bind /stowaway/.stowaways/pmos/ /sysroot
fi
if ! [ -e /sysroot/etc/os-release ]; then
echo "ERROR: root partition appeared to mount but does not contain a root filesystem!" echo "ERROR: root partition appeared to mount but does not contain a root filesystem!"
show_splash "ERROR: root partition does not contain a root filesystem\\nhttps://postmarketos.org/troubleshooting" show_splash "ERROR: root partition does not contain a root filesystem\\nhttps://postmarketos.org/troubleshooting"
fail_halt_boot fail_halt_boot