public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: claudius.heine.ext@siemens.com
To: isar-users@googlegroups.com
Cc: Claudius Heine <ch@denx.de>
Subject: [PATCH v2 2/5] meta/isar-bootstrap-helper.bbclass: handle rfs customization centrally
Date: Thu, 22 Feb 2018 14:18:58 +0100	[thread overview]
Message-ID: <20180222131901.20915-3-claudius.heine.ext@siemens.com> (raw)
In-Reply-To: <20180222131901.20915-1-claudius.heine.ext@siemens.com>

From: Claudius Heine <ch@denx.de>

This patch introduces the 'isar-bootstrap-helper' bitbake class to
support recipes that use the basic root file system created by
isar-bootstrap.

In this patch the function 'setup_root_file_system' is defined that
allows to copy the root file system to the directory specified in the
first parameter and installs additional packages specified by the
next parameters. It also adds the local 'isar-apt' repo to the apt
configuration and fetches its index.

Signed-off-by: Claudius Heine <ch@denx.de>
---
 meta/classes/isar-bootstrap-helper.bbclass | 39 ++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 meta/classes/isar-bootstrap-helper.bbclass

diff --git a/meta/classes/isar-bootstrap-helper.bbclass b/meta/classes/isar-bootstrap-helper.bbclass
new file mode 100644
index 0000000..a06116d
--- /dev/null
+++ b/meta/classes/isar-bootstrap-helper.bbclass
@@ -0,0 +1,39 @@
+# Helper functions for using isar-bootstrap
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+setup_root_file_system() {
+    ROOTFSDIR="$1"
+    shift
+    PACKAGES="$@"
+
+    sudo cp -Trpfx \
+        "${DEPLOY_DIR_IMAGE}/isar-bootstrap-${DISTRO}-${DISTRO_ARCH}/" \
+        "$ROOTFSDIR"
+
+    echo "deb file:///isar-apt ${DEBDISTRONAME} main" | \
+        sudo tee "$ROOTFSDIR/etc/apt/sources.list.d/isar-apt.list" >/dev/null
+
+    echo "Package: *\nPin: release n=${DEBDISTRONAME}\nPin-Priority: 1000" | \
+        sudo tee "$ROOTFSDIR/etc/apt/preferences.d/isar" >/dev/null
+
+    sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO} $ROOTFSDIR/isar-apt
+    sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs $ROOTFSDIR/dev
+    sudo mount -t proc none $ROOTFSDIR/proc
+
+    # Install packages:
+    E="${@ bb.utils.export_proxies(d)}"
+    export DEBIAN_FRONTEND=noninteractive
+    sudo -E chroot "$ROOTFSDIR" /usr/bin/apt-get update \
+        -o Dir::Etc::sourcelist="sources.list.d/isar-apt.list" \
+        -o Dir::Etc::sourceparts="-" \
+        -o APT::Get::List-Cleanup="0"
+    sudo -E chroot "$ROOTFSDIR" \
+        /usr/bin/apt-get install -y \
+            --allow-unauthenticated \
+            -o Debug::pkgProblemResolver=yes \
+        $PACKAGES
+}
-- 
2.16.1


  parent reply	other threads:[~2018-02-22 13:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-22 13:18 [PATCH v2 0/5] Debootstrap integration claudius.heine.ext
2018-02-22 13:18 ` [PATCH v2 1/5] implement isar-bootstrap using debootstrap claudius.heine.ext
2018-02-23 20:39   ` Jan Kiszka
2018-02-22 13:18 ` claudius.heine.ext [this message]
2018-02-22 13:18 ` [PATCH v2 3/5] meta/buildchroot: switch to using isar-bootstrap claudius.heine.ext
2018-02-23 20:44   ` Jan Kiszka
2018-02-22 13:19 ` [PATCH v2 4/5] meta-isar/isar-image-base: " claudius.heine.ext
2018-02-23 20:45   ` Jan Kiszka
2018-02-22 13:19 ` [PATCH v2 5/5] meta-isar/multiconfig: remove multistrap references claudius.heine.ext
2018-02-23 20:46   ` Jan Kiszka
2018-02-22 14:21 ` [PATCH v2 0/5] Debootstrap integration Alexander Smirnov
2018-02-22 18:09   ` Jan Kiszka
2018-02-23  7:40   ` Claudius Heine
2018-02-23 20:35     ` Jan Kiszka
2018-02-26  6:43       ` Jan Kiszka

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=20180222131901.20915-3-claudius.heine.ext@siemens.com \
    --to=claudius.heine.ext@siemens.com \
    --cc=ch@denx.de \
    --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