base-files: upgrade: fix efi partitions size calculation
authorJavier Marcet <javier@marcet.info>
Sat, 4 Apr 2020 15:52:29 +0000 (17:52 +0200)
committerChristian Lamparter <chunkeey@gmail.com>
Mon, 27 Dec 2021 12:51:41 +0000 (13:51 +0100)
We were missing (not using) the last sector of each partition,
compared with the output of gparted.

Signed-off-by: Javier Marcet <javier@marcet.info>
[moved the dot]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
package/base-files/files/lib/upgrade/common.sh

index ec198b2375c28a0405907d6592006065cd9a68db..24ff77a8b3101e0ad1ee0f4b46ff626ecb1ce0f5 100644 (file)
@@ -245,7 +245,7 @@ get_partitions() { # <device> <filename>
                                local type="$1"
                                local lba="$(( $(hex_le32_to_cpu $4) * 0x100000000 + $(hex_le32_to_cpu $3) ))"
                                local end="$(( $(hex_le32_to_cpu $6) * 0x100000000 + $(hex_le32_to_cpu $5) ))"
-                               local num="$(( $end - $lba ))"
+                               local num="$(( $end - $lba + 1 ))"
 
                                [ "$type" = "00000000000000000000000000000000" ] && continue