/usr/lib/2013.com.canonical.certification:checkbox/bin/connect_wireless is in plainbox-provider-checkbox 0.4-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #!/bin/bash
# Any active connections?
conn=''
active_connection=$(nmcli -f SSID,ACTIVE dev wifi list | grep yes)
if [ $? -eq 0 ]
then
ap=$(echo $active_connection | awk -F\' '{print $2}')
conn=$(nmcli -t -f UUID,TYPE,NAME con list | grep wireless | grep -e "$ap$" | awk -F\: '{print $1}')
else
conn=$(nmcli -t -f UUID,TYPE con list | grep wireless | head -n 1 | awk -F\: '{print $1}')
fi
#Strip trailing/leading whitespace
conn=$(echo $conn |sed 's/^[ \t]*//;s/[ \t]*$//')
# Find out if wireless is enabled
nmcli nm wifi | grep -q 'enabled'
if [ $? -ne 0 ]
then
# Find out why
rfkill list wifi | grep 'Hard blocked' | grep -q yes
if [ $? -eq 0 ]
then
blkmessage='Your wireless may be hardware blocked. You may need
to use your wireless key/switch to re-enable it.'
echo $blkmessage
fi
fi
# Check if there's a connection already (wireless or otherwise)
nmcli dev status | grep -q '\<connected\>'
if [ $? -eq 0 ]
then
# Disconnect, pause for a short time
for iface in `nmcli -f GENERAL dev list | grep 'GENERAL.DEVICE' | awk '{print $2}'`
do
nmcli dev disconnect iface $iface
done
sleep 2
fi
nmcli con up uuid "$conn"
|