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

update to dhcpcd5-7 #25

Closed
wants to merge 8 commits into from
Closed

update to dhcpcd5-7 #25

wants to merge 8 commits into from

Conversation

t0b3
Copy link

@t0b3 t0b3 commented Mar 7, 2021

  • update to buster's dhcpcd5
  • keep wlan country setting
  • make MAC setting portable to other RPi
  • omit auto power off due to power management
  • replace cronjob with call in rc.local to drop the @reboot sleep 30 hack

t0b3 added 8 commits March 7, 2021 10:57
Signed-off-by: t0b3 <thomas.bettler@gmail.com>
Signed-off-by: t0b3 <thomas.bettler@gmail.com>
Signed-off-by: t0b3 <thomas.bettler@gmail.com>
Signed-off-by: t0b3 <thomas.bettler@gmail.com>
Signed-off-by: t0b3 <thomas.bettler@gmail.com>
Signed-off-by: t0b3 <thomas.bettler@gmail.com>
Signed-off-by: t0b3 <thomas.bettler@gmail.com>
Signed-off-by: t0b3 <thomas.bettler@gmail.com>
Copy link
Owner

@lukicdarkoo lukicdarkoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic, thank you!

There are two things I am not sure about


# Install dependencies
sudo apt -y update
sudo apt -y upgrade
sudo apt -y install dnsmasq dhcpcd hostapd cron
sudo apt -y install dnsmasq hostapd
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why deleting dhcpcd?

Copy link
Author

@t0b3 t0b3 Mar 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cron: omit as it's no longer needed
dhcpcd: dhcpcd and buster's pre-installed dpcpcd5 tend to interfere - thus either we may omit it and go for system default ... or explicitly require dhcpcd5 if you prefer

@@ -188,7 +196,8 @@ sudo chmod +x /bin/rpi-wifi.sh
# EOF
# sudo systemctl daemon-reload
# sudo systemctl enable rpi-wifi.service
crontab -l | { cat; echo "@reboot /bin/rpi-wifi.sh"; } | crontab -
# crontab -l | { cat; echo "@reboot /bin/rpi-wifi.sh"; } | crontab -
sed -i 's:# By default this script does nothing.:# By default this script does nothing.\n\n/bin/rpi-wifi.sh:' /etc/rc.local
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not something like?

Suggested change
sed -i 's:# By default this script does nothing.:# By default this script does nothing.\n\n/bin/rpi-wifi.sh:' /etc/rc.local
sudo bash -c 'cat >> /etc/rc.local' << EOF
/bin/rpi-wifi.sh
EOF

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the script won't finish... look at the last line exit 0

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.


##### restart network interfaces to ensure right startup order ... ###
ifdown --force wlan0 && sudo ifdown --force ap0 && sudo ifup ap0 && sudo ifup wlan0
sysctl -w net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -s 192.168.10.0/24 ! -d 192.168.10.0/24 -j MASQUERADE
systemctl restart dnsmasq
iwconfig wlan0 power off
###


# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

exit 0

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yes, I see. Not a clean way, but I don't see a better solution.

Copy link
Owner

@lukicdarkoo lukicdarkoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@t0b3
Copy link
Author

t0b3 commented Mar 19, 2021

I want to adapt this to a clean way

@t0b3 t0b3 closed this Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants