#!/bin/bash if (( $EUID != 0 )); then echo "This must be run as root. Try 'sudo bash $0'." exit 1 fi echo "Swap wlan0 and wlan1" IFACE=wlan0 read MAC install it.." echo "" else echo "file exist => remove it and install it again..." echo "" rm /etc/udev/rules.d/70-my_network_interfaces.rules fi cat <<'EOF'>> /etc/udev/rules.d/70-my_network_interfaces.rules # Built-in wifi interface used in hostapd - identify device by MAC address SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="XXX", NAME="wlan1" EOF sudo sed -i -e "s/XXX/$MAC/g" /etc/udev/rules.d/70-my_network_interfaces.rules echo "Actuel wlan0 MAC address is : $MAC" echo "After reboot wlan0 will swapped to wlan1 and wlan1 to wlan0" echo "check the config file and double check is what you want:" echo "" cat /etc/udev/rules.d/70-my_network_interfaces.rules echo "" echo "if it's ok, reboot...otherwize edit the file /etc/udev/rules.d/70-my_network_interfaces.rules" echo