mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
23 lines
643 B
Bash
23 lines
643 B
Bash
#!/bin/sh
|
|
|
|
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
|
|
exit 0
|