ifupdown: create file interfaces if not exist

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.

(From OE-Core rev: 4e692daf66d2c9d51d418706e20f4527505dc0bd)

Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Kai Kang
2020-03-23 10:24:14 +08:00
committed by Richard Purdie
parent 6c58c34a44
commit 4cd5ed7307

View 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"