summaryrefslogtreecommitdiffstats
path: root/net/zerotier/files/etc/uci-defaults/80-zt-migration
blob: 1cfedb58384c84cc3879eed23d610f14308b0a3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Convert the join list into networks
nets=$(uci -q get zerotier.@zerotier[0].join)

if [ -n "$nets" ]; then
  for net in ${nets}; do
    sid=$(uci add zerotier network)
    uci set zerotier.${sid}.id=${net}
  done
  uci delete zerotier.@zerotier[0].join

  # Rename local conf (only if defined)
  uci -q rename zerotier.@zerotier[0].local_conf='local_conf_path' || true

  # Rename configuration to global
  uci rename zerotier.@zerotier[0]='global'

  # Commit all changes
  uci commit zerotier
fi