modules/freifunk: Move profiles and common files into seperate packages, this will...
[project/luci.git] / contrib / package / freifunk-common / files / 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 ${2:+-c $2} 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 }
42
43
44 # Ensure that the community definitions are in the
45 # new format
46
47 [ -z "$(_uci freifunk.leipzig.mesh_network)" ] && \
48 [ -n "$(_uci freifunk.leipzig.mesh_network /rom/etc/config)" ] && {
49         _log "Converting freifunk configuration to new format"
50         cp /rom/etc/config/freifunk /etc/config/freifunk
51 }