feat(turris,omnia): automatically resize partition at startup
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
wpetit 2023-04-07 11:38:27 +02:00
parent 87b15c940f
commit f6df7651da
3 changed files with 20 additions and 1 deletions

3
install/turris-omnia.mk Normal file
View File

@ -0,0 +1,3 @@
install-turris-omnia-uci-defaults:
mkdir -p files/etc/uci-defaults
cp misc/turris/omnia/uci-defaults/* files/etc/uci-defaults/

View File

@ -0,0 +1,15 @@
#!/bin/sh
set -eo pipefail
DISK=/dev/mmcblk0
PARTITION="${DISK}p2"
parted -s -a opt "$DISK" "resizepart 2 100%"
FS_SIZE="$(unsquashfs -s "$PARTITION" | grep -o 'Filesystem size [0-9]* bytes' | grep -o '[0-9][0-9]*')"
FS_OFFSET="$(expr '(' "$FS_SIZE" + 65535 ')' / 65536 '*' 65536)"
LOOP_DEVICE="$(losetup -f --show -o "$FS_OFFSET" "$PARTITION")"
e2fsck -fy "$LOOP_DEVICE"
resize2fs "$LOOP_DEVICE"

View File

@ -4,7 +4,8 @@ turris: omnia
omnia: omnia:
$(MAKE) \ $(MAKE) \
ADDITIONAL_INSTALL="" \ ADDITIONAL_INSTALL="install-turris-omnia-uci-defaults" \
ADDITIONAL_OPENWRT_PACKAGES="losetup squashfs-tools-unsquashfs resize2fs e2fsprogs parted" \
OPENWRT_TARGET="mvebu/cortexa9" \ OPENWRT_TARGET="mvebu/cortexa9" \
EMISSARY_ARCH="armv7" \ EMISSARY_ARCH="armv7" \
OPENWRT_PROFILE="cznic_turris-omnia" \ OPENWRT_PROFILE="cznic_turris-omnia" \