public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: isar-users@googlegroups.com
Cc: Henning Schild <henning.schild@siemens.com>
Subject: [PATCHv2 8/9] meta: do not equip rootfss with resolv.conf when BB_NO_NETWORK
Date: Wed, 23 Oct 2019 13:42:26 +0200	[thread overview]
Message-ID: <20191023114227.31308-9-henning.schild@siemens.com> (raw)
In-Reply-To: <20191023114227.31308-1-henning.schild@siemens.com>

From: Henning Schild <henning.schild@siemens.com>

A second "line of defense" to implement BB_NO_NETWORK in Isar.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 meta/classes/buildchroot.bbclass | 10 ++++++++--
 meta/classes/rootfs.bbclass      |  5 ++++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
index 64ac450..1a8ee13 100644
--- a/meta/classes/buildchroot.bbclass
+++ b/meta/classes/buildchroot.bbclass
@@ -48,8 +48,14 @@ buildchroot_do_mounts() {
                 mount --bind '${REPO_BASE_DIR}' '${BUILDCHROOT_DIR}/base-apt'
         fi
 
-        # Refresh /etc/resolv.conf at this chance
-        cp -L /etc/resolv.conf '${BUILDCHROOT_DIR}/etc'
+        # Refresh or remove /etc/resolv.conf at this chance
+        if [ "${@repr(bb.utils.to_boolean(d.getVar('BB_NO_NETWORK')))}" = 'True' ]
+        then
+            rm -rf '${BUILDCHROOT_DIR}/etc/resolv.conf'
+        else
+            cp -L /etc/resolv.conf '${BUILDCHROOT_DIR}/etc'
+        fi
+
         ) 9>'${MOUNT_LOCKFILE}'
 EOSUDO
 }
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 995dcb6..84d4dc5 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -105,7 +105,10 @@ rootfs_install_pkgs_update() {
 ROOTFS_INSTALL_COMMAND += "rootfs_install_resolvconf"
 rootfs_install_resolvconf[weight] = "1"
 rootfs_install_resolvconf() {
-    sudo cp -rL /etc/resolv.conf '${ROOTFSDIR}/etc'
+    if [ "${@repr(bb.utils.to_boolean(d.getVar('BB_NO_NETWORK')))}" != "True" ]
+    then
+        sudo cp -rL /etc/resolv.conf '${ROOTFSDIR}/etc'
+    fi
 }
 
 ROOTFS_INSTALL_COMMAND += "rootfs_install_pkgs_download"
-- 
2.23.0


  parent reply	other threads:[~2019-10-23 11:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-23 11:42 [PATCHv2 0/9] a few cleanups a bug and a feature Henning Schild
2019-10-23 11:42 ` [PATCHv2 1/9] rootfs: fix incorrect feature name in comment Henning Schild
2019-10-23 11:42 ` [PATCHv2 2/9] base-apt: use the "basename" command instead of pattern substitution Henning Schild
2019-10-23 20:36   ` Baurzhan Ismagulov
2019-10-24  9:16     ` Henning Schild
2019-10-24 12:01       ` Baurzhan Ismagulov
2019-10-24  9:34     ` chombourger
2019-10-24 12:01       ` Baurzhan Ismagulov
2019-10-23 11:42 ` [PATCHv2 3/9] base_apt_helper: change variable names to increase readability Henning Schild
2019-10-23 11:42 ` [PATCHv2 4/9] rootfs: rename ROOTFS_INSTALL_COMMAND lock to "isar-apt-lock" Henning Schild
2019-10-23 11:42 ` [PATCHv2 5/9] dpkg-base: remove pointless ";" s at end of line Henning Schild
2019-10-23 11:42 ` [PATCHv2 6/9] dpkg-base: fix indentation from tabs to spaces Henning Schild
2019-10-23 11:42 ` [PATCHv2 7/9] base: implement BB_NO_NETWORK for apt-get Henning Schild
2019-10-31  8:42   ` Henning Schild
2019-10-23 11:42 ` Henning Schild [this message]
2019-10-23 11:42 ` [PATCHv2 9/9] bootstrap: fix debootstrap gpg issue when base-apt is not signed Henning Schild
2019-10-23 11:43 ` [PATCHv2 0/9] a few cleanups a bug and a feature Henning Schild
2019-11-07 12:16 ` Jan Kiszka
2019-11-07 14:36   ` Henning Schild

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191023114227.31308-9-henning.schild@siemens.com \
    --to=henning.schild@siemens.com \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox