Adding wifi scripts; general cleanup
This commit is contained in:
@@ -1,25 +1,29 @@
|
||||
LIST=arch-update close-guest fix-sound log-guest open-guest restart-service silent-guardian revproxy simple-web
|
||||
LIST=arch-update close-guest fix-sound log-guest open-guest restart-service silent-guardian revproxy simple-web wifi wifiboot
|
||||
LOCATION=/root/bin
|
||||
INSTALLER != curl -s https://aninix.net/foundation/installer-test.bash | /bin/bash
|
||||
PERMISSION=0700
|
||||
|
||||
compile:
|
||||
compile: ${LIST} ./wifi.service
|
||||
@echo Nothing to compile.
|
||||
|
||||
install: compile
|
||||
install: compile
|
||||
mkdir -p ${LOCATION};
|
||||
mkdir -p /var/log/aninix/
|
||||
for i in ${LIST}; do cp ./$$i ${LOCATION}; done
|
||||
cp ./wifi.service /usr/lib/systemd/system/wifi.service
|
||||
make checkperm
|
||||
|
||||
reverse:
|
||||
for i in ${LIST}; do cp ${LOCATION}/$$i .; done
|
||||
cp /usr/lib/systemd/system/wifi.service .
|
||||
|
||||
test: ${LIST}
|
||||
for i in ${LIST}; do [ "$$(grep -c '#/bin/bash' $$i)" -ne 1 ]; done
|
||||
|
||||
checkperm:
|
||||
for i in ${LIST}; do chown root:root ${LOCATION}/$$i; chmod ${PERMISSION} ${LOCATION}/$$i; done
|
||||
chown root: /usr/lib/systemd/system/wifi.service;
|
||||
chmod 0644 /usr/lib/systemd/system/wifi.service
|
||||
|
||||
clean:
|
||||
@echo Nothing to do.
|
||||
|
16
Admin/wifi
Executable file
16
Admin/wifi
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
if [ -z "$1" ]; then
|
||||
echo Usage: $0 conf_name '[ interface ]'
|
||||
exit 1;
|
||||
else
|
||||
conf="$1"
|
||||
fi
|
||||
if [ -z "$2" ]; then
|
||||
interface="wlp4s0"
|
||||
else
|
||||
interface="$2"
|
||||
fi
|
||||
wpa_supplicant -i "$interface" -c /etc/wpa_supplicant/"${conf}".conf -B
|
||||
sleep 3
|
||||
dhcpcd "$interface"
|
||||
exit $?
|
12
Admin/wifi.service
Normal file
12
Admin/wifi.service
Normal file
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Wifi Connectivity Service
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/root/bin/wifiboot
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
13
Admin/wifiboot
Executable file
13
Admin/wifiboot
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
MAC="34:f6:4b:36:12:8f"
|
||||
interface=`ip link list | grep -B 1 "$MAC" | head -n 1 | cut -f 2 -d ':' | cut -f 2 -d ' '`
|
||||
ip link set "$interface" up
|
||||
for i in `iwlist "$interface" scanning | grep ESSID | cut -f 2 -d \" | tr '[:upper:]' '[:lower:]'`; do
|
||||
if [ -f /etc/wpa_supplicant/"$i".conf ]; then
|
||||
/root/bin/wifi "$i" "$interface"
|
||||
if [ $? -eq 0 ]; then
|
||||
exit 0;
|
||||
fi
|
||||
fi
|
||||
done
|
Reference in New Issue
Block a user