From 49fba6567aa1736c6931c2533e272a5ba04c9699 Mon Sep 17 00:00:00 2001 From: Aaron Murray Date: Sat, 10 Feb 2024 07:57:59 -0600 Subject: [PATCH] only make changes when raspberrypi.org repos exist --- preinstall | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/preinstall b/preinstall index 39ee118..a5df09d 100755 --- a/preinstall +++ b/preinstall @@ -6,16 +6,17 @@ export LANG=C.UTF-8 export LANGUAGE=C export LC_ALL=C.UTF-8 -apt-get --yes --no-install-recommends install jq - -mac="$(ip -j a show dev eth0 | jq -r .[].address | head -n1)" -if [ -z "${mac}" ]; then - mac="$(ip -j a show dev end0 | jq -r .[].address | head -n1)" -fi -if [ -n "${mac}" ]; then - echo "mac - ${mac}" - echo -e "[Match]\nMACAddress=${mac}\n[Link]\nName=eth0" > /etc/systemd/network/10-persistent-eth0.link - echo "Please reboot the system now." +if grep -rq raspberrypi.org /etc/apt/*; then + apt-get --yes --no-install-recommends install jq + mac="$(ip -j a show dev eth0 | jq -r .[].address | head -n1)" + if [ -z "${mac}" ]; then + mac="$(ip -j a show dev end0 | jq -r .[].address | head -n1)" + fi + if [ -n "${mac}" ]; then + echo "mac - ${mac}" + echo -e "[Match]\nMACAddress=${mac}\n[Link]\nName=eth0" > /etc/systemd/network/10-persistent-eth0.link + echo "Please reboot the system now." + fi fi exit 0