Skip to content

Create NETWORK_ENABLE_NTP_QUIRKS option #241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/modules/network/config
Original file line number Diff line number Diff line change
Expand Up @@ -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
[ -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
23 changes: 14 additions & 9 deletions src/modules/network/start_chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 ..."' ; \
Expand Down