run on any system

Signed-off-by: Aaron Murray <plugins@omv-extras.org>
This commit is contained in:
Aaron Murray 2024-04-09 15:58:47 -05:00
parent a44fce2591
commit 8fe69dba15

View File

@ -6,17 +6,15 @@ export LANG=C.UTF-8
export LANGUAGE=C export LANGUAGE=C
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
if grep -iq raspberry /proc/cpuinfo; then apt-get --yes --no-install-recommends install jq
apt-get --yes --no-install-recommends install jq mac="$(ip -j a show dev eth0 | jq -r .[].address | head -n1)"
mac="$(ip -j a show dev eth0 | jq -r .[].address | head -n1)" if [ -z "${mac}" ]; then
if [ -z "${mac}" ]; then mac="$(ip -j a show dev end0 | jq -r .[].address | head -n1)"
mac="$(ip -j a show dev end0 | jq -r .[].address | head -n1)" fi
fi if [ -n "${mac}" ]; then
if [ -n "${mac}" ]; then echo "mac - ${mac}"
echo "mac - ${mac}" echo -e "[Match]\nMACAddress=${mac}\n[Link]\nName=eth0" > /etc/systemd/network/10-persistent-eth0.link
echo -e "[Match]\nMACAddress=${mac}\n[Link]\nName=eth0" > /etc/systemd/network/10-persistent-eth0.link echo "Please reboot the system now."
echo "Please reboot the system now."
fi
fi fi
exit 0 exit 0