-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
# Switch to wifi AP mode | ||
|
||
# Check if we are root | ||
if [ $(id -u) -ne 0 ]; then | ||
echo "Please run as root" | ||
exit 1 | ||
fi | ||
|
||
|
||
# Configure the dhcpcd to use the static IP address | ||
cp ./ap_config_files/dhcpcd.conf /etc/dhcpcd.conf | ||
|
||
# Configure the dnsmaq | ||
cp ./ap_config_files/dnsmasq.conf /etc/dnsmasq.conf | ||
|
||
# Configure the hostapd | ||
cp ./ap_config_files/hostapd.conf /etc/hostapd/hostapd.conf | ||
|
||
# Add new local host name to /etc/hosts | ||
cp ./ap_config_files/hosts /etc/hosts | ||
|
||
# Stop services | ||
systemctl stop hostapd | ||
systemctl stop dnsmasq | ||
|
||
# Stop services conflicting with hostapd | ||
systemctl stop systemd-resolved | ||
systemctl stop wpa_supplicant | ||
|
||
# Stop active wpa supplicant processes | ||
pkill wpa_supplicant | ||
|
||
# Restart dhcpcd, dnsmasq and hostapd | ||
systemctl daemon-reload | ||
systemctl restart dhcpcd dnsmasq hostapd | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# Switch WIFI client mode | ||
|
||
# Check if we are root | ||
if [ $(id -u) -ne 0 ]; then | ||
echo "Please run as root" | ||
exit 1 | ||
fi | ||
|
||
|
||
# Delete AP Configs | ||
cp ./client_config_files/dhcpcd.conf /etc/dhcpcd.conf | ||
|
||
# Add wifi credentials to wpa_supplicant config | ||
cp ./client_config_files/wpa_supplicant-wlan0.conf /etc/wpa_supplicant/wpa_supplicant-wlan0.conf | ||
|
||
# Stop AP mode services | ||
systemctl stop hostapd dnsmasq | ||
|
||
# Restart services | ||
systemctl daemon-reload | ||
systemctl restart systemd-resolved dhcpcd | ||
systemctl enable [email protected] | ||
systemctl start [email protected] | ||
|
||
|
||
|