From c47fef4cb007abfce12421d5ad21d44b869db296 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Thu, 22 Aug 2024 03:24:55 +0200 Subject: [PATCH] v9.7 - DietPi-Patches | Switch to sfdisk for removing root partition, as it is nearly impossible to do this with parted non-interactively. Avoid sfdisk error, since the kernel cannot re-read the root partition table. --- .update/patches | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.update/patches b/.update/patches index 8f211100ce..3506f35a8b 100755 --- a/.update/patches +++ b/.update/patches @@ -1833,10 +1833,11 @@ Patch_9_7() /boot/dietpi/func/dietpi-set_hardware flash-u-boot-mmc G_EXEC apt-mark auto firmware-nanopi5 # Redo partitioning - G_DIETPI-NOTIFY 1 'Rewriting partition table to have root filesystem in partition 1' + G_DIETPI-NOTIFY 2 'Rewriting partition table to have root filesystem in partition 1' local rootdrive=$(lsblk -npo PKNAME "$G_ROOTFS_DEV") - G_EXEC parted "$rootdrive" rm 1 rm 2 rm 3 rm 4 rm 5 rm 6 rm 7 rm 8 - G_EXEC_OUTPUT=1 G_EXEC sfdisk "$rootdrive" <<< '286720,+' # somehow needed, since above command and '286720,+' somehow create the partition 2015 sectors smaller, resulting in too large filesystem size. Only a subsequent ',+' expands it to the true end of the drive. + G_EXEC_OUTPUT=1 G_EXEC sfdisk --no-reread --delete "$rootdrive" 1 2 3 4 5 6 7 8 + G_EXEC_OUTPUT=1 G_EXEC sfdisk --no-reread -N1 "$rootdrive" <<< '286720' + G_EXEC_OUTPUT=1 G_EXEC sfdisk --no-reread -N1 "$rootdrive" <<< ',+' # somehow needed, since above command and '286720,+' somehow create the partition 2015 sectors smaller, resulting in too large filesystem size. Only a subsequent ',+' expands it to the true end of the drive. fi elif [[ $G_HW_MODEL == 79 ]] && dpkg-query -s 'firmware-nanopi6' &> /dev/null @@ -1899,11 +1900,11 @@ Patch_9_7() /boot/dietpi/func/dietpi-set_hardware flash-u-boot-mmc G_EXEC apt-mark auto firmware-nanopi6 # Redo partitioning - G_DIETPI-NOTIFY 1 'Rewriting partition table to have root filesystem in partition 1' + G_DIETPI-NOTIFY 2 'Rewriting partition table to have root filesystem in partition 1' local rootdrive=$(lsblk -npo PKNAME "$G_ROOTFS_DEV") - G_EXEC parted "$rootdrive" rm 1 rm 2 rm 3 rm 4 rm 5 rm 6 rm 7 rm 8 - G_EXEC_OUTPUT=1 G_EXEC sfdisk -N1 "$rootdrive" <<< '286720' - G_EXEC_OUTPUT=1 G_EXEC sfdisk -N1 "$rootdrive" <<< ',+' # somehow needed, since above command and '286720,+' somehow create the partition 2015 sectors smaller, resulting in too large filesystem size. Only a subsequent ',+' expands it to the true end of the drive. + G_EXEC_OUTPUT=1 G_EXEC sfdisk --no-reread --delete "$rootdrive" 1 2 3 4 5 6 7 8 + G_EXEC_OUTPUT=1 G_EXEC sfdisk --no-reread -N1 "$rootdrive" <<< '286720' + G_EXEC_OUTPUT=1 G_EXEC sfdisk --no-reread -N1 "$rootdrive" <<< ',+' # somehow needed, since above command and '286720,+' somehow create the partition 2015 sectors smaller, resulting in too large filesystem size. Only a subsequent ',+' expands it to the true end of the drive. fi fi