Compare commits

...

1 Commits

Author SHA1 Message Date
Christian Dresel 38e7dc18e0 fff-layer3: Autoconfigure layer3 Router after update
This adds a script to init.d to automatically call
the appropriate configure-layer3 commands after an upgrade,
so the configuration of the device is restored.

The changes are applied if configure-layer3 is successful.
Otherwise, they are reverted. Due to this, no additional checks for
the configuration are necessary: The configure-layer3 script
will fail if the config version is wrong or no configuration exists at all.

After executing the script destroys itself. With START=99,
the execution happens _after_ uci-defaults and configurenetwork,
and no interference is expected.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
[convert to init.d, extend commit message, rebase]
Signed-off-by: Christian Dresel <freifunk@dresel.systems>
2020-12-28 17:30:44 +01:00
2 changed files with 18 additions and 1 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-layer3-config
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_BUILD_DIR:=$(BUILD_DIR)/fff-layer3-config

View File

@ -0,0 +1,17 @@
#!/bin/sh /etc/rc.common
START=99
boot() {
# Reapply gateway settings, if configuration succeeds
if yes | configure-layer3 -c; then
configure-layer3 -a
else
configure-layer3 -r
fi
# first we disable the init.d
/etc/init.d/fff-layer3-update disable
# we must delete the symlink manually
rm -f /etc/rc.d/S99fff-layer3-update
}