guowenxue
2024-07-15 bf3c1b67a4b493288310170cc22d3ea3b3e3e781
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
DESCRIPTION = "Default eth0 and wlan0 network service"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
 
inherit systemd
 
SYSTEMD_AUTO_ENABLE = "enable"
SYSTEMD_SERVICE:${PN} = "wpa-conf.service"
 
WLAN_DEV ?= "wlan0"
 
SRC_URI += " file://10-eth0.network "
SRC_URI += " file://20-wlan0.network "
SRC_URI += " file://wpa-conf.service "
 
FILES:${PN} += "${sysconfdir}/systemd/network/10-eth0.network"
FILES:${PN} += "${sysconfdir}/systemd/network/20-wlan0.network"
FILES:${PN} += "${systemd_unitdir}/system/wpa-conf.service"
 
do_install() { 
    install -d ${D}/${systemd_unitdir}/system 
    install -d ${D}${sysconfdir}/systemd/network
 
    install -m 0644 ${WORKDIR}/10-eth0.network ${D}${sysconfdir}/systemd/network
 
    install -m 0644 ${WORKDIR}/20-wlan0.network ${D}${sysconfdir}/systemd/network
    sed -i "s|wlan0|${WLAN_DEV}|g" ${D}${sysconfdir}/systemd/network/20-wlan0.network
 
    install -m 0644 ${WORKDIR}/wpa-conf.service ${D}/${systemd_unitdir}/system
    sed -i "s|wlan0|${WLAN_DEV}|g" ${D}/${systemd_unitdir}/system/wpa-conf.service
}