summaryrefslogtreecommitdiffhomepage
path: root/modules/freifunk/root/etc/rc.local.d/01-config-migration
blob: 11f1ad60bc1c3e0d56d879da8e9ffaf5cbe2614b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Fixup various configurations to remove quirks
# from former versions.

_log() {
	logger -t "Config Migration" "$1"
}

_uci() {
	uci ${2:+-c $2} get "$1" 2>/dev/null
}


# Splash redirector had a wrong virtual url match
# which resulted in "No such handler"

[ "$(_uci lucid.splashredir.virtual)" == "/" ] && {
	_log "Fix splash redirector configuration"
	uci set lucid.splashredir.virtual=''
	uci commit lucid
	/etc/init.d/lucid restart
}


# Newer OLSR versions have the MinTCVtime hack active,
# ensure proper timings or olsrd won't start

FIX=0
for i in 0 1 2 3 4; do
	[ -z "$(_uci olsrd.@Interface[$i].TcInterval)" ] && \
	[ -z "$(_uci olsrd.@Interface[$i].TcValidityTime)" ] || {
		uci delete olsrd.@Interface[$i].TcInterval
		uci delete olsrd.@Interface[$i].TcValidityTime
		FIX=1
	}
done

[ "$FIX" == 1 ] && {
	_log "Fix olsrd configuration for MinTCVTime hack"
	uci commit olsrd
	/etc/init.d/olsrd restart
}


# Ensure that the community definitions are in the
# new format

[ -z "$(_uci freifunk.leipzig.mesh_network)" ] && \
[ -n "$(_uci freifunk.leipzig.mesh_network /rom/etc/config)" ] && {
	_log "Converting freifunk configuration to new format"
	cp /rom/etc/config/freifunk /etc/config/freifunk
}