#!/bin/bash
init="# USB device 0x:0x (rtl8723bu)"
sudo echo $init > "/etc/udev/rules.d/70-persistent-net.rules"
ii=0
if [ -f "/sys/class/net/wlan0/address" ];
then
wlan_addr=$(</sys/class/net/wlan0/address)
else
while true
do
if [ -f "/sys/class/net/rename$ii/address" ];
then
wlan_addr=$(</sys/class/net/rename$ii/address)
break
fi
ii=$(($ii+1))
done
fi
rule=SUBSYSTEM=="\"net\", ACTION==\"add\", DRIVERS==\"?*\", ATTR{address}==\"$wlan_addr\", ATTR{dev_id}==\"0x0\", ATTR{type}==\"1\", KERNEL==\"wlan*\", NAME=\"wlan0\""
echo $rule
sudo echo $rule >> "/etc/udev/rules.d/70-persistent-net.rules"
if [ -f "/sys/class/net/wlan1/address" ];
then
wlan_addr=$(</sys/class/net/wlan1/address)
else
wlan_addr=$(</sys/class/net/p2p0/address)
fi
rule=SUBSYSTEM=="\"net\", ACTION==\"add\", DRIVERS==\"?*\", ATTR{address}==\"$wlan_addr\", ATTR{dev_id}==\"0x0\", ATTR{type}==\"1\", KERNEL==\"wlan*\", NAME=\"p2p0\""
echo $rule
sudo echo $rule >> "/etc/udev/rules.d/70-persistent-net.rules"
2020年5月11日 星期一
overwrite 70-persistent-net.rules
標籤:
Linux Script
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言