proper iface handling

This commit is contained in:
Max Fiedler 2025-02-16 12:56:59 +01:00
parent 2b06e8fc7c
commit 06e9460aab

14
wpe
View File

@ -40,13 +40,19 @@ while true; do
done
echo "[+] Preparing $iface for hostapd-wpe..."
if ! nmcli device set "$iface" managed no; then
echo "[!] Failed to set $iface unmanaged. Exiting."
exit 1
fi
nmcli device set "$iface" managed no
ip link set "$iface" down
ip link set "$iface" up
# Check for hostapd-wpe.conf in the current directory
if [[ -f "hostapd-wpe.conf" ]]; then
if grep -q '^interface=' hostapd-wpe.conf; then
sed -i "s/^interface=.*/interface=$iface/" hostapd-wpe.conf
echo "[+] Updated existing interface definition in hostapd-wpe.conf."
else
echo "interface=$iface" >> hostapd-wpe.conf
echo "[+] Added missing interface definition to hostapd-wpe.conf."
fi
echo "[+] Found hostapd-wpe.conf in the current directory. Using it."
config_file="hostapd-wpe.conf"
else