forked from freifunk-franken/firmware
fff-layer3-config: 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> Reviewed-by: Robert Langhammer <rlanghammer@web.de> Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
parent
4f76367b5a
commit
6fe053bcf7
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-layer3-config
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/fff-layer3-config
|
||||
|
||||
|
|
17
src/packages/fff/fff-layer3-config/files/etc/init.d/fff-layer3-update
Executable file
17
src/packages/fff/fff-layer3-config/files/etc/init.d/fff-layer3-update
Executable 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user