gluon-legacy: gluon-mesh-vpn-fastd: correctly set enabled state

This commit is contained in:
Matthias Schiffer 2014-02-23 17:35:56 +01:00
parent 5315f2126a
commit 69187ec3c2
1 changed files with 6 additions and 0 deletions

View File

@ -4,11 +4,13 @@
SECRET=
ENABLED=
for config in @legacy.fastd_configs@; do
if [ -z "$SECRET" ]; then
SECRET="$(uci_get fastd "$config" secret)"
ENABLED="$(uci_get fastd "$config" enabled)"
fi
uci_remove fastd "$config"
@ -17,6 +19,10 @@ done
if [ -n "$SECRET" ]; then
uci_add fastd fastd 'mesh_vpn'
uci_set fastd 'mesh_vpn' 'secret' "$SECRET"
if [ "$ENABLED" = 1 ]; then
uci_set fastd 'mesh_vpn' 'enabled' '1'
fi
fi
uci_commit fastd