Repository files navigation openwrt_expand_root.sh — changes compared to the original-script (20260712)
This installation script requires ash or bash.
The generated boot scripts remain POSIX-/bin/sh compatible.
Clean code / improved reusability
Code reorganized into functions
Added shebang (#!/bin/ash) and set -eu
Added comments
Improved code readability
Use of local variables
Paths are defined centrally and passed to functions
Replaced deprecated backticks with $(...)
Improved robustness
Idempotent registration for sysupgrade
Improved argument handling (-h|--help, error reporting for invalid options)
Removed non-portable awk -e usage (BusyBox-compatible)
New feature
Optional size specification for the root partition (auto, %, M/MB, G/GB, GiB)
Input is validated and converted into a parted-compatible format
Strict size validation prevents command injection
Bug fix
Instead of using a PARTUUID, the stable device name (e.g. /dev/mmcblk0p2) is now used in cmdline.txt
This ensures the system remains bootable after re-imaging or restoring OpenWrt backups
You can’t perform that action at this time.