Skip to content
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

fix: fix syntax error in net module #191

Merged
merged 11 commits into from
Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions src/modules/net/config
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# shellcheck disable=all

# Use disable power save for wifi module
[ -n "$NETWORK_DISABLE_PWRSAVE" ] || NETWORK_DISABLE_PWRSAVE=yes
[ -n "$NET_DISABLE_PWRSAVE" ] || NET_DISABLE_PWRSAVE=yes

# Type of power save rclocal/service/udev
# rclocal - backwards compatibility, runs via rc.local
# service - will add an systemd.service to enable or disable behavior
# on reboots
# udev - creates a udev rules that should affect all wifi devices.

[ -n "$NETWORK_PWRSAVE_TYPE" ] || NETWORK_PWRSAVE_TYPE=udev
[ -n "$NET_PWRSAVE_TYPE" ] || NET_PWRSAVE_TYPE=udev
13 changes: 6 additions & 7 deletions src/modules/net/start_chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
# Last modification: August/2022
#
########
set -x
set -e
set -Ee

export LC_ALL=C

Expand Down Expand Up @@ -56,32 +55,32 @@ echo '/sbin/iptables -t mangle -I POSTROUTING 1 -o wlan0 -p udp --dport 123 -j T
echo 'exit 0' >> /etc/rc.local

# Install powersave option
if [ "$NETWORK_DISABLE_PWRSAVE" == "yes" ]; then
if [ "$NET_DISABLE_PWRSAVE" == "yes" ]; then

# Copy pwrsave script
unpack filesystem/usr/local/bin /usr/local/bin root

# Use rc.local
if [ "$NETWORK_PWRSAVE_TYPE" == "rclocal" ]; then
if [ "$NET_PWRSAVE_TYPE" == "rclocal" ]; then
echo_green "Modifying /etc/rc.local ..."
sed -i 's@exit 0@@' /etc/rc.local
(echo "# Disable WiFi Power Management"; \
echo 'echo "Disabling power management for wlan0 ..."' ; \
echo "/usr/local/bin/pwrsave off"; echo "exit 0") >> /etc/rc.local
fi
# Use service
if [ "$NETWORK_PWRSAVE_TYPE" == "service" ]; then
if [ "$NET_PWRSAVE_TYPE" == "service" ]; then
echo_green "Installing disable-wifi-pwr-mgmt service ..."
unpack filesystem/etc/systemd/system /etc/systemd/system root
systemctl_if_exists enable disable-wifi-pwr-mgmt.service
fi
# Use udev rule
if [ "$NETWORK_PWRSAVE_TYPE" == "udev" ]; then
if [ "$NET_PWRSAVE_TYPE" == "udev" ]; then
echo_green "Installing WiFi Power Management udev rule ..."
unpack filesystem/etc/udev/rules.d /etc/udev/rules.d root
fi
# strip out unneeded script, depending on choose
if [ "$NETWORK_PWRSAVE_TYPE" != "udev" ]; then
if [ "$NET_PWRSAVE_TYPE" != "udev" ]; then
rm -f /usr/local/bin/pwrsave-udev
else
rm -f /usr/local/bin/pwrsave
Expand Down