]> code.ossystems Code Review - openembedded-core.git/commitdiff
ifupdown: create file interfaces if not exist
authorKai Kang <kai.kang@windriver.com>
Mon, 23 Mar 2020 02:24:14 +0000 (10:24 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 23 Mar 2020 17:16:56 +0000 (17:16 +0000)
It fails to run ifup if /etc/network/interfaces doesn't exist:

| ifup: couldn't open interfaces file "/etc/network/interfaces": No such
|       file or directory

Create the config file if not exist.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/ifupdown/ifupdown_0.8.35.bb

index 53cb971d338454b7e278d48ae28572383e96c76c..a8913e6e293d429a1ea2c6c79e8cbd1af3adb987 100644 (file)
@@ -48,6 +48,13 @@ do_install_ptest () {
     cp -r ${S}/tests/linux ${D}${PTEST_PATH}/tests/
 }
 
+pkg_postinst_ontarget_${PN} () {
+    if [ ! -f /etc/network/interfaces ]; then
+        mkdir -p /etc/network
+        touch /etc/network/interfaces
+    fi
+}
+
 ALTERNATIVE_PRIORITY = "100"
 ALTERNATIVE_${PN} = "ifup ifdown"