allow setting mac address from argument

This commit is contained in:
Felix Van der Jeugt 2022-09-20 15:54:02 +02:00
parent 99b4abc9b1
commit 83a949ecc3

View File

@ -2,7 +2,7 @@
# Reading our private mac # Reading our private mac
here="$(dirname "$0")" here="$(dirname "$0")"
mac="$(cat "$here/macaddress")" mac="${1:-$(cat "$here/macaddress")}"
enp="$(basename /sys/class/net/enp*)" enp="$(basename /sys/class/net/enp*)"
wlp="$(basename /sys/class/net/wlp*)" wlp="$(basename /sys/class/net/wlp*)"
@ -12,8 +12,10 @@ sudo ip link set "$enp" address "$mac"
sudo ip link set "$enp" up sudo ip link set "$enp" up
# No more wireless # No more wireless
sudo sv stop /var/service/iwd if [ -e /var/service/iwd ]; then
sudo ip link set "$wlp" down sudo sv stop /var/service/iwd
sudo ip link set "$wlp" down
fi
# Restart tor on network change # Restart tor on network change
sudo sv restart tor sudo sv restart tor