From 500a227d057a2bf2455f1c4c19544a73cc24c333 Mon Sep 17 00:00:00 2001 From: noneofyourbusiness Date: Thu, 20 May 2021 16:26:12 +0200 Subject: [PATCH] Add an automated way to configure a hostspot network Signed-off-by: Stacy Harper --- scripts/core/sxmo_hotspot.sh | 37 +++++++++++++++++++++++++++++++++++ scripts/core/sxmo_networks.sh | 4 ++++ 2 files changed, 41 insertions(+) create mode 100644 scripts/core/sxmo_hotspot.sh diff --git a/scripts/core/sxmo_hotspot.sh b/scripts/core/sxmo_hotspot.sh new file mode 100644 index 0000000..7d9a861 --- /dev/null +++ b/scripts/core/sxmo_hotspot.sh @@ -0,0 +1,37 @@ +#!/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")" diff --git a/scripts/core/sxmo_networks.sh b/scripts/core/sxmo_networks.sh index 5e46403..943c6e8 100755 --- a/scripts/core/sxmo_networks.sh +++ b/scripts/core/sxmo_networks.sh @@ -94,6 +94,7 @@ networksmenu() { $(connections) Add a GSM Network Add a WPA Network + Add a Hotspot Delete a Network Launch Nmtui Launch Ifconfig @@ -116,6 +117,9 @@ networksmenu() { "Add a WPA Network" ) addnetworkwpamenu ;; + "Add a Hotspot" ) + sxmo_hotspot.sh + ;; "Delete a Network" ) deletenetworkmenu ;;