From c4f050ffcdcab834a8d692aac267b4e76b1ff4b0 Mon Sep 17 00:00:00 2001 From: Bobby The Builder Date: Thu, 8 Apr 2021 13:58:22 -0400 Subject: [PATCH] main/postmarketos-mkinitfs: add f2fs (MR 1850) --- main/postmarketos-mkinitfs/00-default.modules | 1 + main/postmarketos-mkinitfs/APKBUILD | 11 +++--- main/postmarketos-mkinitfs/init_functions.sh | 34 ++++++++++++++++--- .../mkinitfs_functions.sh | 1 + pmaports.cfg | 1 + 5 files changed, 38 insertions(+), 10 deletions(-) diff --git a/main/postmarketos-mkinitfs/00-default.modules b/main/postmarketos-mkinitfs/00-default.modules index 953ee7b10..abd3afa19 100644 --- a/main/postmarketos-mkinitfs/00-default.modules +++ b/main/postmarketos-mkinitfs/00-default.modules @@ -1,3 +1,4 @@ dm_crypt ext4 usb_f_rndis +f2fs diff --git a/main/postmarketos-mkinitfs/APKBUILD b/main/postmarketos-mkinitfs/APKBUILD index 6a3168c1c..674e6ebad 100644 --- a/main/postmarketos-mkinitfs/APKBUILD +++ b/main/postmarketos-mkinitfs/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Oliver Smith pkgname=postmarketos-mkinitfs -pkgver=0.22 -pkgrel=2 +pkgver=0.23 +pkgrel=0 pkgdesc="Tool to generate initramfs images for postmarketOS" url="https://postmarketos.org" depends=" @@ -13,6 +13,7 @@ depends=" device-mapper e2fsprogs e2fsprogs-extra + f2fs-tools kmod lddtree lz4 @@ -53,9 +54,9 @@ check() { /bin/busybox sh ./mkinitfs_test.sh } -sha512sums="5037cb7285bb7c0c40ca9e6df332d882ef9a8b379756c785f921e062dab1b7e7f3139d00897f69323a916d709ced4297fea8cbd3a13ebae575b873ec9e2cbfae 00-default.modules +sha512sums="4717bf24bd13fd4d90f3ab000ab43f7d61529515de224ebc86458ae709ebe0b5065655457e34f5952126bac6ab45143a91cddb09a8ad2d0a55c5cecd564a0135 00-default.modules bafd06286594102b8b3b126c3ae0a77a97f004ab804f03426154310c5107a1acaf3636bdba92626333adfe4fb0df32ff42c6d8d9e7adf35f6da620c6e14407a1 init.sh.in -9a18ccd14ab5a9e2decc3df35c9b489cbb94b57dc180f0919d0cdf003de5f0f4730beb96d5c3d19b13aebc6d6fe046aa9e81846b86a66f794ca1cb59b91eabfe init_functions.sh +c625759e0a3fcfcb00d22e7240edec51df92ebb33a8c0bf2bcb8df549a9dfbab1bd786972c6678c49e9be0d87c56ef4fe42171d2e0b6be8b169e4cfbb7085d65 init_functions.sh dfc01ee0547ea88b7aa45a005e842b636e9e19bbf1705f3dad53a66d57af7c5c513c092b5469a06d9b00322e56a4d25f1b47e4c5324aafa99f5291679968d1f1 mkinitfs.sh -e91007d321b1c26b4505bba7e36da0aed1a5af7d7010ef6a1ac215975054898da3daf883c067cc071ff2c268fa0d57d2b3ca3dce1dc9b9afc4175a7724b4de3a mkinitfs_functions.sh +ee1af97c53d53229eead55a580fad704891c0dd7b678dd3d56822c5a6d9e983559cf8a271abe4f5c144116e5ba507c182aa02a478e3db82d1b689facc0ac6d6b mkinitfs_functions.sh c7a3c33daeb12b33ac72207191941c4d634f15c22958273b52af381a70ebaba1d3a9299483f0c447d9e66c560151fe7b9588bb4bbef2c8914f83185984ee4622 mkinitfs_test.sh" diff --git a/main/postmarketos-mkinitfs/init_functions.sh b/main/postmarketos-mkinitfs/init_functions.sh index 12b0da716..3bb330fa8 100644 --- a/main/postmarketos-mkinitfs/init_functions.sh +++ b/main/postmarketos-mkinitfs/init_functions.sh @@ -288,21 +288,45 @@ unlock_root_partition() { fi } +get_partition_type() { + partition="$1" + blkid "$partition" | sed 's/^.*TYPE="\([a-zA-z0-9_]*\)".*$/\1/' +} + resize_root_filesystem() { if [ "$ROOT_PARTITION_RESIZED" = 1 ]; then partition="$(find_root_partition)" touch /etc/mtab # see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=673323 - echo "Check/repair root filesystem ($partition)" - e2fsck -y "$partition" - echo "Resize root filesystem ($partition)" - resize2fs -f "$partition" + type="$(get_partition_type "$partition")" + case "$type" in + ext4) + echo "Resize 'ext4' root filesystem ($partition)" + resize2fs -f "$partition" + ;; + f2fs) + echo "Resize 'f2fs' root filesystem ($partition)" + resize.f2fs "$partition" + ;; + *) echo "WARNING: Can not resize '$type' filesystem ($partition)." ;; + esac fi } mount_root_partition() { partition="$(find_root_partition)" echo "Mount root partition ($partition) to /sysroot (read-only)" - mount -t ext4 -o ro "$partition" /sysroot + type="$(get_partition_type "$partition")" + case "$type" in + ext4) + echo "Detected ext4 filesystem" + mount -t ext4 -o ro "$partition" /sysroot + ;; + f2fs) + echo "Detected f2fs filesystem" + mount -t f2fs -o ro "$partition" /sysroot + ;; + *) echo "WARNING: Detected '$type' filesystem ($partition)." ;; + esac if ! [ -e /sysroot/usr ]; then echo "ERROR: unable to mount root partition!" show_splash /splash-mounterror.ppm.gz diff --git a/main/postmarketos-mkinitfs/mkinitfs_functions.sh b/main/postmarketos-mkinitfs/mkinitfs_functions.sh index a96a66f46..bd0581adb 100644 --- a/main/postmarketos-mkinitfs/mkinitfs_functions.sh +++ b/main/postmarketos-mkinitfs/mkinitfs_functions.sh @@ -225,6 +225,7 @@ get_binaries_extra() /usr/lib/ts/* /usr/sbin/parted /usr/sbin/resize2fs + /usr/sbin/resize.f2fs /usr/sbin/thd " diff --git a/pmaports.cfg b/pmaports.cfg index b3a193f73..99cab9410 100644 --- a/pmaports.cfg +++ b/pmaports.cfg @@ -3,3 +3,4 @@ version=7 pmbootstrap_min_version=1.29.0 channel=edge +supported_root_filesystems=ext4,f2fs