I have OpenWrt installed on an 8GB SDHC card in an RPi2, and it only uses 280MB of space.
How do I expand the rootfs to use up all the space?
I remember when installing Raspbian a while ago that on first boot there was an option to use all the available space, but I don't know how that was achieved.
I'm completely lost by your inquiry. I've never heard of an offline Operating System re-partitioning itself, nor an online one able to do so with root (/).
What is your question?
The partitions already exist in OpenWrt, if you use that, you'll have to re-copy each one, or re-write the script....WHY???
You cannot expand a partition containing root while the partition is mounted and in-use, so what you describe is not possible. If you're going to use another computer to run the script anyway, you could just run a GUI and use a program like Gnome Partition Editor (GParted) to accomplish your task.