Merge ~morphis/snappy-hwe-snaps/+git/wifi-ap:check-interface-is-available into ~snappy-hwe-team/snappy-hwe-snaps/+git/wifi-ap:master

Proposed by Simon Fels
Status: Merged
Approved by: Simon Fels
Approved revision: 1313865cf8b3176f00b5ccb46128e3796a882fd8
Merged at revision: 2762d4b4df7a2c392b050cab7ca92e16b365b0b6
Proposed branch: ~morphis/snappy-hwe-snaps/+git/wifi-ap:check-interface-is-available
Merge into: ~snappy-hwe-team/snappy-hwe-snaps/+git/wifi-ap:master
Diff against target: 24 lines (+8/-1)
1 file modified
bin/ap.sh (+8/-1)
Reviewer Review Type Date Requested Status
Matteo Croce (community) Approve
Konrad Zapałowicz (community) Approve
Review via email: mp+305090@code.launchpad.net

Description of the change

Before we start using a WiFi network interface check if it is present and fail if that is not the case.

To post a comment you must log in.
Revision history for this message
Matteo Croce (teknoraver) :
Revision history for this message
Konrad Zapałowicz (kzapalowicz) wrote :

Ack

review: Approve
Revision history for this message
Matteo Croce (teknoraver) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/ap.sh b/bin/ap.sh
2index 66aa782..f017554 100755
3--- a/bin/ap.sh
4+++ b/bin/ap.sh
5@@ -26,11 +26,18 @@ fi
6
7 DEFAULT_ACCESS_POINT_INTERFACE="ap0"
8
9-if [ "$DISABLED" == "1" ] ; then
10+if [ $DISABLED -eq 1 ] ; then
11 echo "Not starting as WiFi AP is disabled"
12 exit 0
13 fi
14
15+# Make sure the configured WiFi interface is really available before
16+# doing anything.
17+if ! ifconfig $WIFI_INTERFACE ; then
18+ echo "ERROR: WiFi interface $WIFI_INTERFACE is not available!"
19+ exit 1
20+fi
21+
22 shutdown() {
23 DNSMASQ_PID=$(cat $SNAP_DATA/dnsmasq.pid)
24 kill -TERM $DNSMASQ_PID

Subscribers

People subscribed via source and target branches

to all changes: