mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
hostmngr: uci-defaults: convert old hosts config to new format
This commit is contained in:
parent
cf8b29665c
commit
adfaa19180
1 changed files with 22 additions and 0 deletions
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/sh
|
||||
|
||||
uci -q get hosts.global.ageing_timer || exit 1
|
||||
|
||||
|
||||
# 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
|
||||
Loading…
Add table
Reference in a new issue