Wifi auto connect

This commit is contained in:
2025-07-09 14:48:52 +02:00
parent a12a49192f
commit 69fe3c8f77
6 changed files with 54 additions and 842 deletions

View File

@@ -0,0 +1,12 @@
[Match]
Name=wlp2s0
[Network]
DHCP=no
Address=192.168.0.25/24
Gateway=192.168.0.1
DNS=192.168.0.1
FallbackDNS=8.8.8.8 1.1.1.1
[DHCP]
UseDNS=yes

View File

@@ -0,0 +1,29 @@
SUMMARY = "WiFi Auto-Connect Configuration"
DESCRIPTION = "systemd-networkd and wpa_supplicant configuration for automatic WiFi connection"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://25-wireless.network \
file://wpa_supplicant-wlp2s0.conf"
S = "${WORKDIR}"
do_install() {
# Install systemd-networkd configuration
install -d ${D}${sysconfdir}/systemd/network
install -m 0644 ${WORKDIR}/25-wireless.network ${D}${sysconfdir}/systemd/network/
# Install wpa_supplicant configuration
install -d ${D}${sysconfdir}/wpa_supplicant
install -m 0600 ${WORKDIR}/wpa_supplicant-wlp2s0.conf ${D}${sysconfdir}/wpa_supplicant/
# Create systemd service symlinks for auto-start
install -d ${D}${sysconfdir}/systemd/system/multi-user.target.wants
ln -sf ${systemd_system_unitdir}/wpa_supplicant@.service ${D}${sysconfdir}/systemd/system/multi-user.target.wants/wpa_supplicant@wlp2s0.service
}
FILES:${PN} = "${sysconfdir}/systemd/network/* \
${sysconfdir}/wpa_supplicant/* \
${sysconfdir}/systemd/system/multi-user.target.wants/*"
RDEPENDS:${PN} = "systemd wpa-supplicant"