-
Notifications
You must be signed in to change notification settings - Fork 120
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
Conversation
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
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>
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why deleting dhcpcd
?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not something like?
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
I want to adapt this to a clean way |