gluon-packages/gluon/gluon-legacy/generate/lib/gluon/upgrade/mesh-vpn-fastd/legacy/010-reset-fastd-config

29 lines
450 B
Bash
Executable File

#!/bin/sh
. /lib/functions.sh
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"
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