init-ifupdown: add systemd support

To avoid bringing up interfaces before they're created by udev scripts
(specifically wlan1), wait until udev settles before starting the service.

https://jira.digi.com/browse/DEL-6504

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
This commit is contained in:
Gabriel Valcazar 2019-03-13 11:25:58 +01:00
parent b957f0ef75
commit ae2abd926a
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,13 @@
[Unit]
Description=Interface initialization via ifupdown
After=systemd-udev-settle.service
Requires=systemd-udev-settle.service
[Service]
Type=oneshot
ExecStart=@SBINDIR@/ifup -a
ExecStop=@SBINDIR@/ifdown -a
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@ -5,10 +5,13 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BP}:"
INITSCRIPT_NAME = "networking" INITSCRIPT_NAME = "networking"
INITSCRIPT_PARAMS = "start 03 2 3 4 5 . stop 80 0 6 1 ." INITSCRIPT_PARAMS = "start 03 2 3 4 5 . stop 80 0 6 1 ."
inherit systemd
SRC_URI_append = " \ SRC_URI_append = " \
file://interfaces.br0.example \ file://interfaces.br0.example \
file://interfaces.p2p \ file://interfaces.p2p \
file://resolv \ file://resolv \
file://ifupdown.service \
" "
SRC_URI_append_ccimx6qpsbc = "\ SRC_URI_append_ccimx6qpsbc = "\
@ -29,11 +32,17 @@ SRC_URI_append_ccimx8x = "\
file://virtwlans.sh \ file://virtwlans.sh \
" "
SYSTEMD_SERVICE_${PN} = "ifupdown.service"
WPA_DRIVER ?= "nl80211" WPA_DRIVER ?= "nl80211"
do_install_append() { do_install_append() {
# Install DNS servers handler # Install DNS servers handler
install -m 0755 ${WORKDIR}/resolv ${D}${sysconfdir}/network/if-up.d/resolv install -m 0755 ${WORKDIR}/resolv ${D}${sysconfdir}/network/if-up.d/resolv
# Install systemd service
install -d ${D}${systemd_unitdir}/system/
install -m 0644 ${WORKDIR}/ifupdown.service ${D}${systemd_unitdir}/system/
sed -i -e 's,@SBINDIR@,${base_sbindir},g' ${D}${systemd_unitdir}/system/ifupdown.service
if [ -n "${HAVE_WIFI}" ]; then if [ -n "${HAVE_WIFI}" ]; then
if [ -n "${WLAN_P2P_INTERFACE}" ]; then if [ -n "${WLAN_P2P_INTERFACE}" ]; then