Skip to content

About

cleancode optimized script from https://openwrt.org/docs/guide-user/advanced/expand_root

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

openwrt_expand_root.sh — changes compared to the original-script (20260712)

Note

  • This installation script requires ash or bash.
  • The generated boot scripts remain POSIX-/bin/sh compatible.

changes

  • 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

About

cleancode optimized script from https://openwrt.org/docs/guide-user/advanced/expand_root

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages