Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- target/linux/lantiq/base-files/etc/uci-defaults/04_network-switchX-migration
- #!/bin/sh
- #
- # Copyright (C) 2013 OpenWrt.org
- #
- SWITCH_NAME_CHANGED=
- do_change_switch_name() {
- local config="$1"
- local option=$2
- local oldname=$3
- local newname=$4
- local val
- config_get val "$config" $option
- [ "$val" != "$oldname" ] && return 0
- uci_set network "$config" $option $newname
- SWITCH_NAME_CHANGED=1
- return 0
- }
- migrate_switch_name() {
- local oldname=$1
- local newname=$2
- . /lib/functions.sh
- config_load network
- logger -t migrate-switchX "Updating switch names in network configuration"
- config_foreach do_change_switch_name switch name $oldname $newname
- config_foreach do_change_switch_name switch_vlan device $oldname $newname
- [ "$SWITCH_NAME_CHANGED" == "1" ] && {
- logger -t migrate-switchX "Switch names updated, saving network configuration"
- uci commit network
- }
- }
- . /lib/functions/lantiq.sh
- board=$(lantiq_board_id)
- case "$board" in
- WBMR|ARV4519PW|ARV7518PW)
- migrate_switch_name "eth0" "switch0"
- ;;
- esac
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement