sxmo-utils/scripts/core/sxmo_hotspot.sh
noneofyourbusiness 500a227d05
Add an automated way to configure a hostspot network
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-05-20 16:50:04 +02:00

37 lines
739 B
Bash

#!/usr/bin/env sh
while [ -z "$SSID" ]; do
SSID="$(
echo "$ENTRIES" | sxmo_dmenu_with_kb.sh -c -p "SSID"
)"
done
while [ -z "$key" ]; do
key="$(
echo "$ENTRIES" | sxmo_dmenu_with_kb.sh -c -p "pass"
)"
done
while [ -z "$key1" ]; do
key1="$(
echo "$ENTRIES" | sxmo_dmenu_with_kb.sh -c -p "confirm"
)"
done
if [ "$key" != "$key1" ]; then
notify-send key mismatch
exit 2
fi
while [ -z "$channel" ]; do
channel="$(
echo "11" | sxmo_dmenu_with_kb.sh -l 1 -c -p "channels"
)"
done
if [ -z "$SSID" ] || [ -z "$key" ]; then
notify-send either SSID: "$SSID" or key are empty
exit 3
fi
notify-send "$(nmcli device wifi hotspot ifname wlan0 con-name "Hotspot $SSID" ssid "$SSID" channel "$channel" band bg password "$key")"