From d52d48e52319e08b9a79ba6c6a167d960738477b Mon Sep 17 00:00:00 2001 From: "Jason D. McCormick" Date: Mon, 9 Dec 2024 17:39:00 -0500 Subject: [PATCH 1/3] Create NETWORK_ENABLE_NTP_QUIRKS option --- src/modules/network/config | 5 ++++- src/modules/network/start_chroot_script | 20 +++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/modules/network/config b/src/modules/network/config index 9b8923fd..24871766 100755 --- a/src/modules/network/config +++ b/src/modules/network/config @@ -16,4 +16,7 @@ [ -n "$NETWORK_WPA_SUPPLICANT" ] || NETWORK_WPA_SUPPLICANT=no # Enable Network Manager boot folder support (bookworm) -[ -n "$NETWORK_NETWORK_MANAGER" ] || NETWORK_NETWORK_MANAGER=yes \ No newline at end of file +[ -n "$NETWORK_NETWORK_MANAGER" ] || NETWORK_NETWORK_MANAGER=yes + +# Enable/Disable rc.local/NTP quirks code +[ -n "$NETWORK_ENABLE_NTP_QUIRKS" ] || NETWORK_ENABLE_NTP_QUIRKS=no diff --git a/src/modules/network/start_chroot_script b/src/modules/network/start_chroot_script index 2b086a08..bcb08977 100755 --- a/src/modules/network/start_chroot_script +++ b/src/modules/network/start_chroot_script @@ -49,17 +49,19 @@ fi [ -f /etc/ifplugd/action.d/ifupdown ] && mv /etc/ifplugd/action.d/ifupdown /etc/ifplugd/action.d/ifupdown.original [ -f /etc/wpa_supplicant/ifupdown.sh ] && ln -s /etc/wpa_supplicant/ifupdown.sh /etc/ifplugd/action.d/ifupdown -if [ ! -f "/etc/rc.local" ];then - echo 'exit 0' >> /etc/rc.local +if [ "$NETWORK_ENABLE_NTP_QUIRKS" == "yes" ]; then + if [ ! -f "/etc/rc.local" ];then + echo 'exit 0' >> /etc/rc.local + fi + + # prevent ntp updates from failing due to some Rpi3 weirdness, see also "Fix SSH" further below + apt-get update --allow-releaseinfo-change + apt-get install -y iptables + sed -i 's@exit 0@@' /etc/rc.local + echo '/sbin/iptables -t mangle -I POSTROUTING 1 -o wlan0 -p udp --dport 123 -j TOS --set-tos 0x00' >> /etc/rc.local + echo 'exit 0' >> /etc/rc.local fi -# prevent ntp updates from failing due to some Rpi3 weirdness, see also "Fix SSH" further below -apt-get update --allow-releaseinfo-change -apt-get install -y iptables -sed -i 's@exit 0@@' /etc/rc.local -echo '/sbin/iptables -t mangle -I POSTROUTING 1 -o wlan0 -p udp --dport 123 -j TOS --set-tos 0x00' >> /etc/rc.local -echo 'exit 0' >> /etc/rc.local - # Install powersave option if [ "$NETWORK_DISABLE_PWRSAVE" == "yes" ]; then From d368dbef4acc1103f2d45dd1ea92a85112049e0a Mon Sep 17 00:00:00 2001 From: "Jason D. McCormick" Date: Sat, 28 Dec 2024 09:59:35 -0500 Subject: [PATCH 2/3] fix rc.local --- src/modules/network/start_chroot_script | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/network/start_chroot_script b/src/modules/network/start_chroot_script index dbeb18dd..21e31534 100755 --- a/src/modules/network/start_chroot_script +++ b/src/modules/network/start_chroot_script @@ -61,8 +61,8 @@ if [ "${BASE_DISTRO}" == "raspbian" ]; then fi if [ "$NETWORK_ENABLE_NTP_QUIRKS" == "yes" ]; then - if [ ! -f "/etc/rc.local" ];then - echo 'exit 0' >> /etc/rc.local + if [ ! -f "/etc/rc.local" ]; then + echo '#!/bin/sh -e' > /etc/rc.local fi # prevent ntp updates from failing due to some Rpi3 weirdness, see also "Fix SSH" further below From c011f25bfa63dcbd046049cdcef3fcc983c21b3e Mon Sep 17 00:00:00 2001 From: "Jason D. McCormick" Date: Sat, 28 Dec 2024 10:07:11 -0500 Subject: [PATCH 3/3] more rc.local cleanups --- src/modules/network/start_chroot_script | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/network/start_chroot_script b/src/modules/network/start_chroot_script index 21e31534..76f280d6 100755 --- a/src/modules/network/start_chroot_script +++ b/src/modules/network/start_chroot_script @@ -82,6 +82,9 @@ if [ "$NETWORK_DISABLE_PWRSAVE" == "yes" ]; then # Use rc.local if [ "$NETWORK_PWRSAVE_TYPE" == "rclocal" ]; then echo_green "Modifying /etc/rc.local ..." + if [ ! -f "/etc/rc.local" ]; then + echo '#!/bin/sh -e' > /etc/rc.local + fi sed -i 's@exit 0@@' /etc/rc.local (echo "# Disable WiFi Power Management"; \ echo 'echo "Disabling power management for wlan0 ..."' ; \