-#connman config to ignore wired interfaces on qemu machines
+#connman config to setup wired interface on qemu machines
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
-SRC_URI_append_qemuall = " file://main.conf"
-
-PR = "r0"
+SRC_URI_append_qemuall = "file://wired.config \
+ file://wired-setup \
+ "
+PR = "r1"
PACKAGE_ARCH = "${MACHINE_ARCH}"
do_install() {
- #Blacklist ethn network interface in case of qemu* machines
- if test -e ${WORKDIR}/main.conf; then
+ #Configure Wired network interface in case of qemu* machines
+ if test -e ${WORKDIR}/wired.config && test -e ${WORKDIR}/wired-setup; then
+ install -d ${D}${localstatedir}/lib/connman
+ install -m 0644 ${WORKDIR}/wired.config ${D}${localstatedir}/lib/connman
install -d ${D}${sysconfdir}/connman
- install -m 0644 ${WORKDIR}/main.conf ${D}${sysconfdir}/connman
+ install -m 0755 ${WORKDIR}/wired-setup ${D}${sysconfdir}/connman
fi
}
--- /dev/null
+#!/bin/sh
+
+CONFIGF=/var/lib/connman/wired.config
+
+# Extract wired network config from /proc/cmdline
+NET_CONF=`cat /proc/cmdline |sed -ne 's/^.*ip=\([^ ]*\):\([^ ]*\):\([^ ]*\):\([^ ]*\).*$/\1\/\4\/\3/p'`
+
+# Check if eth0 is already set via kernel cmdline
+if [ "x$NET_CONF" = "x" ]; then
+ # Wired interface is not configured via kernel cmdline
+ # Remove connman config file template
+ rm ${CONFIGF}
+else
+ # Setup a connman config accordingly
+ sed -i -e "s|^\(IPv4 =\)|\1 ${NET_CONF}|" ${CONFIGF}
+fi