From 9f6600ba182c4a5c023781470db2cf0eba6dccef Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Mon, 20 Jul 2020 11:40:45 +0200 Subject: [PATCH] main/postmarketos-mkinitfs: rm pmOS_deleteme (MR 1428) Remove the "pmOS_deleteme" partition left behind by the on-device installer, if it exists. Let the existing resize_root_partition() extend the root partition over the newly gained space (and rest of the storage device) right afterwards. --- main/postmarketos-mkinitfs/APKBUILD | 6 +++--- main/postmarketos-mkinitfs/init.sh.in | 1 + main/postmarketos-mkinitfs/init_functions.sh | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/main/postmarketos-mkinitfs/APKBUILD b/main/postmarketos-mkinitfs/APKBUILD index 479532136..e4a5a4112 100644 --- a/main/postmarketos-mkinitfs/APKBUILD +++ b/main/postmarketos-mkinitfs/APKBUILD @@ -1,5 +1,5 @@ pkgname=postmarketos-mkinitfs -pkgver=0.13.2 +pkgver=0.14.0 pkgrel=0 pkgdesc="Tool to generate initramfs images for postmarketOS" url="https://postmarketos.org" @@ -39,8 +39,8 @@ check() { } sha512sums="5037cb7285bb7c0c40ca9e6df332d882ef9a8b379756c785f921e062dab1b7e7f3139d00897f69323a916d709ced4297fea8cbd3a13ebae575b873ec9e2cbfae 00-default.modules -995b4d15e6b248d55d53221ec52674e62d74f0be539ac2ab26d4279544e2bece7aa58810dd831e1b2f08f0520fc9a8dff3ad4df52a46ef73f61e462f74f68c48 init.sh.in -c8164e0cc902b63e6dc9950c19828ec6bdb91248b48552f3504e2763be12a4d7a5b240f4e6a0100dce2eb8e9004502a05aefb354f02e4b06092a1ea6fc9abd8c init_functions.sh +7fc6ba96419628850984df3322b73bcf655cba03fe3e97ec7425e66e90f4b2a4de106b5cb2e3d46785a92557334288011334104285e2050c7a8e823b8fa5668c init.sh.in +8237cfa4c7aabd6a71fcf2541a9d3f74269b5c00f3c0519c97b801da8b280527a0a8c3e1eff2a67b46859ee604a3e4519329cbfb58defe9739df249eb8646c1e init_functions.sh 7201d4640a3e9ead8a47ffd9916b068476b7d950760a84c37e02268c942d49896bc986da6bdee27e832639c90775354d68046a6475205d8d1da995b068120d8f mkinitfs.sh d593b921bd6c0204af874266060667d78a232c0131ce7f0ad4124f9b240fcbb6ac2a8a2b8ee30d27d78bed8c1a506c4e6cb13b57c33cee3a00a7d96eca45a7f3 mkinitfs_functions.sh c7a3c33daeb12b33ac72207191941c4d634f15c22958273b52af381a70ebaba1d3a9299483f0c447d9e66c560151fe7b9588bb4bbef2c8914f83185984ee4622 mkinitfs_test.sh" diff --git a/main/postmarketos-mkinitfs/init.sh.in b/main/postmarketos-mkinitfs/init.sh.in index 64737a851..aa2e75405 100644 --- a/main/postmarketos-mkinitfs/init.sh.in +++ b/main/postmarketos-mkinitfs/init.sh.in @@ -39,6 +39,7 @@ mount_boot_partition /boot extract_initramfs_extra @INITRAMFS_EXTRA@ start_charging_mode wait_root_partition +delete_old_install_partition resize_root_partition unlock_root_partition resize_root_filesystem diff --git a/main/postmarketos-mkinitfs/init_functions.sh b/main/postmarketos-mkinitfs/init_functions.sh index 16d474bda..4ba0ba963 100644 --- a/main/postmarketos-mkinitfs/init_functions.sh +++ b/main/postmarketos-mkinitfs/init_functions.sh @@ -211,6 +211,21 @@ wait_root_partition() { done } +delete_old_install_partition() { + # The on-device installer leaves a "pmOS_deleteme" (p3) partition after + # successful installation, located after "pmOS_root" (p2). Delete it, + # so we can use the space. + partition="$(find_root_partition | sed 's/2$/3/')" + if ! blkid "$partition" | grep -q pmOS_deleteme; then + return + fi + + device="$(echo "$partition" | sed -E 's/3$//')" + echo "First boot after running on-device installer - deleting old" \ + "install partition: $partition" + parted -s "$device" rm 3 +} + # $1: path to device has_unallocated_space() { # Check if there is unallocated space at the end of the device