WLAN autoconfiguration through wpa_supplicant and mdev rules

This commit is contained in:
2026-04-04 01:52:36 -03:00
parent 14481a2939
commit 719ef5ea40
4 changed files with 35 additions and 1 deletions

View File

@@ -6,4 +6,7 @@
/etc/ssh/ssh_host_rsa_key f 600 0 0 - - - - -
#rtl8821cu usb modeswitch script
/lib/mdev/rtl8821cu_usb_modeswitch.sh f 755 0 0 - - - - -
/lib/mdev/rtl8821cu_usb_modeswitch.sh f 755 0 0 - - - - -
# WLAN setup
/lib/mdev/wlan_setup.sh f 755 0 0 - - - - -

View File

@@ -21,3 +21,17 @@
# Add usb_modeswitch mdev rule
grep -q "usb_modeswitch" "$TARGET_DIR/etc/mdev.conf" || \
echo '$PRODUCT=bda/1a2b.* root:root 0660 */lib/mdev/rtl8821cu_usb_modeswitch.sh' >> "$TARGET_DIR/etc/mdev.conf"
# Add wlan_setup mdev rule
grep -q "wlan_setup" "$TARGET_DIR/etc/mdev.conf" || \
echo '$PRODUCT=bda/c820.* root:root 0660 */lib/mdev/wlan_setup.sh' >> "$TARGET_DIR/etc/mdev.conf"
# Add wlan0 configuration
grep -q "iface wlan0" "$TARGET_DIR/etc/network/interfaces" || \
cat >> "$TARGET_DIR/etc/network/interfaces" << 'EOF'
auto wlan0
iface wlan0 inet dhcp
pre-up ip link set wlan0 up
pre-up wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
EOF

View File

@@ -0,0 +1,4 @@
network={
ssid="Gabriel_2G"
psk="gabrielwifi"
}

View File

@@ -0,0 +1,13 @@
#!/bin/sh
case "$ACTION" in
add)
[ -e /sys/class/net/wlan0 ] || exit 0
ifdown wlan0 2>/dev/null
killall wpa_supplicant 2>/dev/null
ifup wlan0
;;
remove)
ifdown wlan0 2>/dev/null
killall wpa_supplicant 2>/dev/null
;;
esac