Newer
Older
uci -q get hosts.global.ageing_timer || exit 0
# Old hosts UCI config is detected; Convert to new format
ageing_timer="$(uci -q get hosts.global.ageing_timer)"
history_timeout=$((ageing_timer*60))
uci -q set hosts.global.enabled=1
uci -q delete hosts.global.ageing_timer
uci -q set hosts.global.history_timeout="$history_timeout"
uci -q rename hosts.global.reboot_persistent=history
uci -q set hosts.global.history_file="/etc/hosts_history.json"
uci -q add hosts interface
for ifname in $(uci -q get hosts.global.ifname); do
uci -q add_list hosts.@interface[-1].ifname="$ifname"
done
uci -q delete hosts.global.ifname