Advertisement
Guest User

Untitled

a guest
Apr 4th, 2013
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. target/linux/lantiq/base-files/etc/uci-defaults/04_network-switchX-migration
  2.  
  3. #!/bin/sh
  4. #
  5. # Copyright (C) 2013 OpenWrt.org
  6. #
  7.  
  8. SWITCH_NAME_CHANGED=
  9.  
  10. do_change_switch_name() {
  11. local config="$1"
  12. local option=$2
  13. local oldname=$3
  14. local newname=$4
  15. local val
  16.  
  17. config_get val "$config" $option
  18. [ "$val" != "$oldname" ] && return 0
  19.  
  20. uci_set network "$config" $option $newname
  21. SWITCH_NAME_CHANGED=1
  22.  
  23. return 0
  24. }
  25.  
  26. migrate_switch_name() {
  27. local oldname=$1
  28. local newname=$2
  29.  
  30. . /lib/functions.sh
  31.  
  32. config_load network
  33.  
  34. logger -t migrate-switchX "Updating switch names in network configuration"
  35.  
  36. config_foreach do_change_switch_name switch name $oldname $newname
  37. config_foreach do_change_switch_name switch_vlan device $oldname $newname
  38.  
  39. [ "$SWITCH_NAME_CHANGED" == "1" ] && {
  40. logger -t migrate-switchX "Switch names updated, saving network configuration"
  41. uci commit network
  42. }
  43. }
  44.  
  45. . /lib/functions/lantiq.sh
  46.  
  47. board=$(lantiq_board_id)
  48.  
  49. case "$board" in
  50. WBMR|ARV4519PW|ARV7518PW)
  51. migrate_switch_name "eth0" "switch0"
  52. ;;
  53. esac
  54.  
  55. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement