Skip to content

Commit

Permalink
v9.7
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
MichaIng committed Aug 22, 2024
1 parent 81b0a52 commit c47fef4
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions .update/patches
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit c47fef4

Please sign in to comment.