Skip to contentSkip to conversation

ifupdown: create file interfaces if not exist

PATCH New kai 1 participant 1 message Mar 23, 2020

lore
Share & tools
lore

kai

author
#0 lore raw

PATCH 1/1 ifupdown: create file interfaces if not exist

From: Kai Kang <[email protected]>

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.

---
 meta/recipes-core/ifupdown/ifupdown_0.8.35.bb | 7 +++++++
 1 file changed, 7 insertions(+)
meta/recipes-core/ifupdown/ifupdown_0.8.35.bb +7 -0
index 53cb971d33..a8913e6e29 100644
@@ -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"
 
Signature · 1 line
2.17.1