Added static mac fix

This commit is contained in:
set 2024-07-27 13:27:30 +00:00
parent f433e79ee7
commit 653837c5b2

View File

@ -1,13 +1,34 @@
#!/bin/bash #!/bin/bash
# Root check
if [ "$UID" != "0" ]; then if [ "$UID" != "0" ]; then
echo "Error: Please run as root" echo "Error: Please run as root"
exit 1 exit 1
fi fi
# Setup
rw rw
git clone https://git.zakscode.com/ztimson/PiKVM.git git clone https://git.zakscode.com/ztimson/PiKVM.git
cd PiKVM cd PiKVM
# Static MAC fix
printf "Enable static MAC (y/n): " && read YN
if [ "$YN" =~ [Yy]$ ]; then
printf "Define vendor ID (defaults to Intel): " && read MAC_PREFIX
if [ -z "$MAC_PREFIX" ]; then MAC_PREFIX="80:86:00"; fi
cat <<EOF >> /etc/systemd/network/
[Link]
MACAddress=$(printf '%02X:%02X:%02X' $((RANDOM % 256)) $((RANDOM % 256)) $((RANDOM % 256)))
EOF
cat <<EOF >> /etc/systemd/network/
[Link]
MACAddress=$(printf '%02X:%02X:%02X' $((RANDOM % 256)) $((RANDOM % 256)) $((RANDOM % 256)))
EOF
fi
pacman -S cronie python-pipx pacman -S cronie python-pipx
pipx install pillow RPI.GPIO spidev pipx install pillow RPI.GPIO spidev