2023-12-05 03:02:57 +01:00
|
|
|
# Copied from https://openwrt.org/docs/guide-user/advanced/expand_root
|
|
|
|
|
|
|
|
if [ ! -e /etc/rootpt-resize ] \
|
|
|
|
&& type parted > /dev/null \
|
|
|
|
&& lock -n /var/lock/root-resize
|
|
|
|
then
|
|
|
|
ROOT_BLK="$(readlink -f /sys/dev/block/"$(awk -e \
|
|
|
|
'$9=="/dev/root"{print $3}' /proc/self/mountinfo)")"
|
2023-12-06 00:35:30 +01:00
|
|
|
DEV_NAME=$(basename "${ROOT_BLK%/*}")
|
|
|
|
[ ${DEV_NAME%%[0-9]*} == mmcblk ] || exit 1
|
|
|
|
ROOT_DISK="/dev/${DEV_NAME}"
|
2023-12-05 03:02:57 +01:00
|
|
|
ROOT_PART="${ROOT_BLK##*[^0-9]}"
|
|
|
|
parted -l ---pretend-input-tty << EOI
|
|
|
|
ok
|
|
|
|
fix
|
|
|
|
EOI
|
|
|
|
parted -s "${ROOT_DISK}" resizepart "${ROOT_PART}" 100%
|
|
|
|
mount_root done
|
|
|
|
touch /etc/rootpt-resize
|
|
|
|
reboot
|
|
|
|
fi
|
|
|
|
exit 1
|