01-config-migration 1.2 KB

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