1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-03-09 23:38:56 +00:00

config udev tag

relates to #36
This commit is contained in:
albfan 2015-07-29 20:14:41 +02:00
parent 30459133ed
commit 80aefc1611
2 changed files with 57 additions and 5 deletions

52
res/write-udev-rule.sh Executable file
View file

@ -0,0 +1,52 @@
#!/bin/bash
./kill-wpa.sh
. miracle-utils.sh
ETHER_NAMES=$(find_choosable_networknames)
ETHER_COUNT=$(echo "$ETHER_NAMES" | wc -l)
if [ 0 = $ETHER_COUNT ]
then
echo There is no net devices avaliable
exit 1
elif [ 1 = $ETHER_COUNT ]
then
ETHERNAME="$ETHER_NAMES"
elif [ 2 -le $ETHER_COUNT ]
then
echo choose device for normal connection:
QUIT="exit"
select et_name in $ETHER_NAMES $QUIT
do
case $et_name
in
"$QUIT")
exit
;;
"")
if [ "$REPLY" = $QUIT ]
then
exit
else
echo unknow $REPLY
fi
;;
*)
ETHERNAME=$et_name
break
;;
esac
done
fi
# default path for config file
CONFIG_FILE=${1:-/run/network/wpa_supplicant_${ETHERNAME}.conf}
NUMBER=10
cat > /etc/udev/rules.d/${NUMBER}-network.rules << EOF
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="$(cat /sys/class/net/${ETHERNAME}/address)", NAME="${ETHERNAME}", TAGS+="miracle"
EOF