fix(turris,omnia): reboot after disk resize
arcad/emissary-firmware/pipeline/head This commit looks good Details

This commit is contained in:
wpetit 2023-04-14 17:37:12 +02:00
parent f70763aed7
commit 40d6d2df03
1 changed files with 11 additions and 1 deletions

View File

@ -2,6 +2,12 @@
set -eo pipefail set -eo pipefail
FLAG_FILE=/root/.disk_resized
if [ -f "$FLAG_FILE" ]; then
exit
fi
DISK=/dev/mmcblk0 DISK=/dev/mmcblk0
PARTITION="${DISK}p2" PARTITION="${DISK}p2"
@ -11,5 +17,9 @@ FS_SIZE="$(unsquashfs -s "$PARTITION" | grep -o 'Filesystem size [0-9]* bytes' |
FS_OFFSET="$(expr '(' "$FS_SIZE" + 65535 ')' / 65536 '*' 65536)" FS_OFFSET="$(expr '(' "$FS_SIZE" + 65535 ')' / 65536 '*' 65536)"
LOOP_DEVICE="$(losetup -f --show -o "$FS_OFFSET" "$PARTITION")" LOOP_DEVICE="$(losetup -f --show -o "$FS_OFFSET" "$PARTITION")"
e2fsck -fy "$LOOP_DEVICE" e2fsck -y -f "$LOOP_DEVICE"
resize2fs "$LOOP_DEVICE" resize2fs "$LOOP_DEVICE"
touch "$FLAG_FILE"
reboot