From 40d6d2df03311ebfe50b37a848a50ce745e3be92 Mon Sep 17 00:00:00 2001 From: William Petit Date: Fri, 14 Apr 2023 17:37:12 +0200 Subject: [PATCH] fix(turris,omnia): reboot after disk resize --- misc/turris/omnia/uci-defaults/99-resize-disk.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/misc/turris/omnia/uci-defaults/99-resize-disk.sh b/misc/turris/omnia/uci-defaults/99-resize-disk.sh index 10dc924..d54d720 100644 --- a/misc/turris/omnia/uci-defaults/99-resize-disk.sh +++ b/misc/turris/omnia/uci-defaults/99-resize-disk.sh @@ -2,6 +2,12 @@ set -eo pipefail +FLAG_FILE=/root/.disk_resized + +if [ -f "$FLAG_FILE" ]; then + exit +fi + DISK=/dev/mmcblk0 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)" LOOP_DEVICE="$(losetup -f --show -o "$FS_OFFSET" "$PARTITION")" -e2fsck -fy "$LOOP_DEVICE" +e2fsck -y -f "$LOOP_DEVICE" resize2fs "$LOOP_DEVICE" + +touch "$FLAG_FILE" + +reboot \ No newline at end of file