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 21c580b8..76f280d6 100755 --- a/src/modules/network/start_chroot_script +++ b/src/modules/network/start_chroot_script @@ -60,17 +60,19 @@ if [ "${BASE_DISTRO}" == "raspbian" ]; then fi fi -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 '#!/bin/sh -e' > /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_update_skip -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 @@ -80,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 ..."' ; \