|
| 1 | +# Upgrade Guide |
| 2 | + |
| 3 | + |
| 4 | +All commands are executed on the host running the OpenWrt container |
| 5 | +unless otherwise specified. |
| 6 | + |
| 7 | +Make a list of installed packages using the script provided in |
| 8 | +`etc/list-user-installed.sh`: |
| 9 | + |
| 10 | + $ source openwrt.conf |
| 11 | + $ docker cp ./etc/list-user-installed.sh ${CONTAINER}:/tmp/ |
| 12 | + $ docker exec $CONTAINER /tmp/list-user-installed.sh > packages |
| 13 | + |
| 14 | +Make changes to `openwrt.conf` as necessary (refer to example). |
| 15 | +Some parameters may have changed. |
| 16 | + |
| 17 | +Pull (or build) the latest image for your architecture: |
| 18 | + |
| 19 | + $ docker pull $IMAGE:$TAG |
| 20 | + |
| 21 | +OpenWrt contains a backup / restore utility called `sysupgrade`. |
| 22 | +Use it to make a configuration backup archive: |
| 23 | + |
| 24 | + $ docker exec $CONTAINER sysupgrade --create-backup - > backup.tar.gz |
| 25 | + |
| 26 | +Docker manages `/etc/hosts` as a bind mount. We need to ingore this file |
| 27 | +upon restore to avoid errors, so remove it from the archive: |
| 28 | + |
| 29 | + $ gzip -cd backup.tar.gz | \ |
| 30 | + tar --delete etc/hosts | \ |
| 31 | + gzip > backup1.tar.gz |
| 32 | + $ mv backup1.tar.gz backup.tar.gz |
| 33 | + |
| 34 | +**Confirm that all expected files are present in the archive before proceeding!** |
| 35 | + |
| 36 | +At this point you may stop the old container: |
| 37 | + |
| 38 | + docker stop $CONTAINER |
| 39 | + |
| 40 | +As a precaution, it's recommended to rename the old container |
| 41 | +before deleting it outright: |
| 42 | + |
| 43 | + $ docker rename $CONTAINER ${CONTAINER}-backup |
| 44 | + |
| 45 | +Run the `make clean` target to ensure the new container gets created properly. |
| 46 | + |
| 47 | +If using `systemd`, start the OpenWrt service with `systemctl start openwrt`. |
| 48 | +Otherwise, `make run`. |
| 49 | + |
| 50 | +Restore the configuration: |
| 51 | + |
| 52 | + $ cat backup.tar.gz | \ |
| 53 | + docker exec -i $CONTAINER sysupgrade -v --restore-backup - |
| 54 | + |
| 55 | +Install packages: |
| 56 | + |
| 57 | + $ docker exec -t $CONTAINER opkg install $(cat packages) |
| 58 | + |
| 59 | +Log in to your new OpenWrt instance and make sure everything is working. You may need to restart some services. |
| 60 | + |
| 61 | +Once everything is confirmed working, it's safe to delete the backup container: |
| 62 | + |
| 63 | + $ docker rm ${CONTAINER}-backup |
0 commit comments