1ab7239c862e565b0c917d1622135d7e094a68d1
[project/luci.git] / modules / freifunk / root / etc / rc.local.d / 01-config-migration
1 # Fixup various configurations to remove quirks
2 # from former versions.
3
4 _log() {
5         logger -t "Config Migration" "$1"
6 }
7
8 _uci() {
9         uci get "$1" 2>/dev/null
10 }
11
12
13 # Splash redirector had a wrong virtual url match
14 # which resulted in "No such handler"
15
16 [ "$(_uci lucid.splashredir.virtual)" == "/" ] && {
17         _log "Fix splash redirector configuration"
18         uci set lucid.splashredir.virtual=''
19         uci commit lucid
20         /etc/init.d/lucid restart
21 }
22
23
24 # Newer OLSR versions have the MinTCVtime hack active,
25 # ensure proper timings or olsrd won't start
26
27 FIX=0
28 for i in 0 1 2 3 4; do
29         [ -z "$(_uci olsrd.@Interface[$i].TcInterval)" ] && \
30         [ -z "$(_uci olsrd.@Interface[$i].TcValidityTime)" ] || {
31                 uci delete olsrd.@Interface[$i].TcInterval
32                 uci delete olsrd.@Interface[$i].TcValidityTime
33                 FIX=1
34         }
35 done
36
37 [ "$FIX" == 1 ] && {
38         _log "Fix olsrd configuration for MinTCVTime hack"
39         uci commit olsrd
40         /etc/init.d/olsrd restart
41 }