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

Network autoconfiguration #271

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
6 changes: 6 additions & 0 deletions builder/assets/dhcpcd.exit-hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Start dnsmasq if dhcpcd used static config
if [ "$interface" = "wlan0" ] && [ "x$profile" = "xstatic_wlan0" ] && [ "$reason" = "STATIC" ]; then
echo "Using own network, starting dnsmasq"
# Note: We run systemctl in the background to avoid deadlocking on start
systemctl start dnsmasq &
fi
1 change: 1 addition & 0 deletions builder/image-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ ${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} exec ${SCRIPTS_DIR}'/image-software
# examples
${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/examples' '/home/pi/'
# network setup
${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/dhcpcd.exit-hook' '/etc'
${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} exec ${SCRIPTS_DIR}'/image-network.sh'
# avahi setup
${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/avahi-services/sftp-ssh.service' '/etc/avahi/services'
Expand Down
7 changes: 5 additions & 2 deletions builder/image-network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@ echo_stamp() {
echo -e ${TEXT}
}

echo_stamp "#1 Write STATIC to /etc/dhcpcd.conf"
echo_stamp "#1 Enable fallback profile for wlan0 in /etc/dhcpcd.conf"

cat << EOF >> /etc/dhcpcd.conf
interface wlan0
profile static_wlan0
static ip_address=192.168.11.1/24

interface wlan0
fallback static_wlan0
EOF

echo_stamp "#2 Set wpa_supplicant country"
Expand Down