Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions 1-Start_WiFi.sh

This file was deleted.

27 changes: 27 additions & 0 deletions wifi/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#Settings: net_if.txt wifi_name.txt wpa_supplicant.conf

#
# commands output dependencies
#

Settings/net_if.txt:
./net_if.sh Settings/net_if.txt

# Please see Note 0
Settings/wifi_name.txt: Settings/net_if.txt
./wifi_conf_init.sh Settings/wpa_supplicant.conf
./wifi_core.sh Settings/wpa_supplicant.conf Settings/net_if.txt
./wifi_name.sh Settings/wifi_name.txt

Settings/wpa_supplicant.conf: Settings/wifi_name.txt
./wifi_conf_finalize.sh Settings/wpa_supplicant.conf Settings/wifi_name.txt

connect: Settings/wpa_supplicant.conf Settings/net_if.txt
./wifi_core.sh Settings/wpa_supplicant.conf Settings/net_if.txt
./net_ip.sh Settings/net_if.txt


# Note 0:
# Do not call this target directly as
# wifi_conf_init.sh generates wpa_supplicant.conf
# and therefore target wpa_supplicant.conf won't run.
1 change: 1 addition & 0 deletions wifi/Settings/net_if.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions wifi/Settings/wifi_name.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions wifi/Settings/wpa_supplicant.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

21 changes: 21 additions & 0 deletions wifi/net_if.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

main() (
# Sorted by likelyhood:

case 0 in
$(exists /bin/iwconfig)) iwconfig ;;
$(exists /bin/iwconfig)) ;;
$(exists /bin/iwconfig)) ;;
esac
)

exists() (
test -x "${1}" ; echo $?
)

main;

echo "Choose a network interface: "
read REPLY
echo $REPLY > "${1}"
4 changes: 4 additions & 0 deletions wifi/net_ip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

killall dhcpcd
dhcpcd -4 "${1}"
9 changes: 9 additions & 0 deletions wifi/wifi_conf_finalize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# for wifi in wifi_names do ;

echo "The following file should ONLY contain ${2}'s password"
echo "Press any key to continue..."
read
nano WiFi_password.txt

(wpa_passphrase "$(< ${2})" < WiFi_password.txt) >> "${1}"
3 changes: 3 additions & 0 deletions wifi/wifi_conf_init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

echo 'ctrl_interface=/var/run/wpa_supplicant' > "${1}"
4 changes: 4 additions & 0 deletions wifi/wifi_core.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

killall wpa_supplicant
wpa_supplicant -B -c "${1}" -i "$(< ${2})"
10 changes: 10 additions & 0 deletions wifi/wifi_name.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

wpa_cli scan
echo "Scanning..."; sleep 3s

wpa_cli scan_results

echo "Choose a WiFi: "
read REPLY
echo $REPLY > "${1}"