Script to build 4M firmware with LuCI and OpenVPN

Hi all!
The last few weeks I've been seeing if I could fit LuCI and OpenVPN into a TP-Link MR3220v1, a classic 4M flash 32M RAM device. After some wrangling, I'm there: the killer optimization was to include LuCI in the openwrt tree and enable Minify Lua Sources, for a whopping 262K extra free space.
Anyway, here's the script. Just install the few tools it needs (listed in the first paragraphs of commentary), make sure you have 8GB free space and run it. It takes about a hour on a 2.4GHz CPU, then flashes the firmware to the device on 192.168.1.1
Just when it was working nicely I managed to interrupt the flashing of the new firmware, so now have a door stop waiting for a 3.3V serial adapter. In the meantime, enjoy!
Repo: https://github.com/martinwguy/openwrt
Just the script: https://github.com/martinwguy/openwrt/raw/master/MR3220.sh

Comments/improvements are welcome

M