From 287d1ed912ebbb0d0e34e877143647146911c130 Mon Sep 17 00:00:00 2001 From: Dave Hylands Date: Thu, 2 Aug 2018 07:20:27 -0700 Subject: [PATCH] Fixes to prepare-base.sh for the merged wifi setup (#1242) * Fixes to prepare-base.sh for the merged wifi setup * Updated to use HERE documents * Final tweaks for 0.5.0 --- image/add-gateway.sh | 5 +++ image/config/dnsmasq.conf | 52 -------------------------- image/config/hostapd.conf | 6 --- image/prepare-base-root.sh | 75 +++++++++++++++++++++++++++++++------- image/prepare-base.sh | 2 - 5 files changed, 67 insertions(+), 73 deletions(-) delete mode 100644 image/config/dnsmasq.conf delete mode 100644 image/config/hostapd.conf diff --git a/image/add-gateway.sh b/image/add-gateway.sh index fa7a5f696..efb935e1b 100755 --- a/image/add-gateway.sh +++ b/image/add-gateway.sh @@ -206,6 +206,11 @@ main() { sudo mv "${ADDONS_DIR}/package" "${ADDONS_DIR}/thing-url-adapter" rm -rf "${tempdir}" + # Create the .post_upgrade_complete file so that it doesn't try + # to upgrade on the first boot. + + sudo touch ${MOZILLA_IOT_DIR}/gateway/.post_upgrade_complete + # Setup things so that the filesystem gets resized # on the next boot. diff --git a/image/config/dnsmasq.conf b/image/config/dnsmasq.conf deleted file mode 100644 index d3512d71d..000000000 --- a/image/config/dnsmasq.conf +++ /dev/null @@ -1,52 +0,0 @@ - -# Never forward addresses in the non-routed address spaces. -bogus-priv - -# Add other name servers here, with domain specs if they are for -# non-public domains. -server=/local/192.168.220.1 -address=/#/192.168.220.1 - -# Add local-only domains here, queries in these domains are answered -# from /etc/hosts or DHCP only. -local=/local/ - -# If you want dnsmasq to listen for DHCP and DNS requests only on -# specified interfaces (and the loopback) give the name of the -# interface (eg eth0) here. -# Repeat the line for more than one interface. -interface=wlan0 - -# Set the domain for dnsmasq. this is optional, but if it is set, it -# does the following things. -# 1) Allows DHCP hosts to have fully qualified domain names, as long -# as the domain part matches this setting. -# 2) Sets the "domain" DHCP option thereby potentially setting the -# domain of all systems configured by DHCP -# 3) Provides the domain part for "expand-hosts" -domain=local - -# Uncomment this to enable the integrated DHCP server, you need -# to supply the range of addresses available for lease and optionally -# a lease time. If you have more than one network, you will need to -# repeat this for each network on which you want to supply DHCP -# service. -dhcp-range=192.168.220.2,192.168.220.10,2h - -# Override the default route supplied by dnsmasq, which assumes the -# router is the same machine as the one running dnsmasq. -dhcp-option=3,192.168.220.1 - -#DNS Server -dhcp-option=6,192.168.220.1 - -# Set the DHCP server to authoritative mode. In this mode it will barge in -# and take over the lease for any client which broadcasts on the network, -# whether it has a record of the lease or not. This avoids long timeouts -# when a machine wakes up on a new network. DO NOT enable this if there's -# the slightest chance that you might end up accidentally configuring a DHCP -# server for your campus/company accidentally. The ISC server uses -# the same option, and this URL provides more information: -# http://www.isc.org/files/auth.html -dhcp-authoritative - diff --git a/image/config/hostapd.conf b/image/config/hostapd.conf deleted file mode 100644 index 8203b1f88..000000000 --- a/image/config/hostapd.conf +++ /dev/null @@ -1,6 +0,0 @@ -interface=wlan0 -driver=nl80211 -ssid=Mozilla IoT Gateway -hw_mode=g -# or 1 or 11 -channel=6 diff --git a/image/prepare-base-root.sh b/image/prepare-base-root.sh index 6124e78d8..2ebba388b 100644 --- a/image/prepare-base-root.sh +++ b/image/prepare-base-root.sh @@ -1,16 +1,5 @@ #!/bin/bash -e -NVM_VERSION="v0.33.8" -NODE_VERSION="--lts=carbon" - -# first we install nvm -cd $HOME -curl -o- https://github.com/raw/creationix/nvm/${NVM_VERSION}/install.sh | bash -export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh" # This loads nvm -nvm install ${NODE_VERSION} -nvm use ${NODE_VERSION} - # Allow node and python3 to use the Bluetooth adapter setcap cap_net_raw+eip $(eval readlink -f `which node`) setcap cap_net_raw+eip $(eval readlink -f `which python3`) @@ -20,6 +9,66 @@ systemctl disable hostapd.service systemctl disable dnsmasq.service # install hostapd and dnsmasq config files -cp config/hostapd.conf /etc/hostapd/hostapd.conf -cp config/dnsmasq.conf /etc/dnsmasq.conf + +cat > /etc/hostapd/hostapd.conf <> /etc/default/hostapd + +cat > /etc/dnsmasq.conf <