public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Benedikt Niedermayr <benbrenson89@googlemail.com>
To: isar-users@googlegroups.com
Cc: Benedikt Niedermayr <Benedikt.Niedermayr@mixed-mode.de>
Subject: [PATCH 4/6] Added apt-cache functionality for image rootfs.
Date: Tue,  6 Feb 2018 11:09:37 +0100	[thread overview]
Message-ID: <1517911779-30507-5-git-send-email-Benedikt.Niedermayr@mixed-mode.de> (raw)
In-Reply-To: <1517911779-30507-1-git-send-email-Benedikt.Niedermayr@mixed-mode.de>

This patch does the same thing as the last patch does for buildchroot.

Signed-off-by: Benedikt Niedermayr <Benedikt.Niedermayr@mixed-mode.de>
---
 .../recipes-core/images/files/multistrap.conf.in   |  8 ++++----
 meta-isar/recipes-core/images/isar-image-base.bb   | 22 ++++++++++++++++++----
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/meta-isar/recipes-core/images/files/multistrap.conf.in b/meta-isar/recipes-core/images/files/multistrap.conf.in
index 432b6af..4bbf2e9 100644
--- a/meta-isar/recipes-core/images/files/multistrap.conf.in
+++ b/meta-isar/recipes-core/images/files/multistrap.conf.in
@@ -6,7 +6,7 @@ noauth=true
 unpack=true
 ignorenativearch=true
 bootstrap=##DISTRO_MULTICONF_BOOTSTRAP## Isar
-aptsources=##DISTRO_MULTICONF_APTSOURCES##
+aptsources=##DISTRO_MULTICONF_APTSOURCES## Isar
 configscript=##CONFIG_SCRIPT##
 setupscript=##SETUP_SCRIPT##
 hookdir=##DIR_HOOKS##
@@ -19,14 +19,14 @@ packages=##IMAGE_PREINSTALL##
 omitdebsrc=true
 
 [updates]
-source=##DISTRO_APT_SOURCE##
-suite=##DISTRO_SUITE##-updates
+source=##DISTRO_APT_SOURCE##-updates
+suite=##DISTRO_SUITE##
 components=##DISTRO_COMPONENTS##
 omitdebsrc=true
 
 [security]
 source=##DISTRO_APT_SOURCE_SEC##
-suite=##DISTRO_SUITE##/updates
+suite=##DISTRO_SUITE##
 components=##DISTRO_COMPONENTS##
 omitdebsrc=true
 
diff --git a/meta-isar/recipes-core/images/isar-image-base.bb b/meta-isar/recipes-core/images/isar-image-base.bb
index e359ac3..bc90e95 100644
--- a/meta-isar/recipes-core/images/isar-image-base.bb
+++ b/meta-isar/recipes-core/images/isar-image-base.bb
@@ -16,7 +16,7 @@ SRC_URI = "file://multistrap.conf.in \
 
 PV = "1.0"
 
-inherit image
+inherit image apt-cache
 
 DEPENDS += "${IMAGE_INSTALL}"
 
@@ -39,27 +39,40 @@ do_rootfs() {
     cd ${TOPDIR}
     WORKDIR_REL=${@ os.path.relpath(d.getVar("WORKDIR", True))}
 
+    # Replace directory of apt caches for using within chroots and
+    # set the trusted=yes option for local unsigned cache repository.
+    cat<<-__EOF__ > $WORKDIR_REL/hooks_multistrap/completion_sources
+    	for section in ${DISTRO_MULTICONF_APTSOURCES} isar; do
+			sed -i -e 's|${TOPDIR}/apt-cache|${CHROOT_CACHE_DIR}|g' \
+				-e 's|\[|\[ trusted=yes |g' \
+				${IMAGE_ROOTFS}/etc/apt/sources.list.d/multistrap-\$section.list
+		done
+	__EOF__
+    chmod 0755 $WORKDIR_REL/hooks_multistrap/completion_sources
+
     # Adjust multistrap config
     sed -e 's|##IMAGE_PREINSTALL##|${IMAGE_PREINSTALL}|g' \
         -e 's|##DISTRO_MULTICONF_BOOTSTRAP##|${DISTRO_MULTICONF_BOOTSTRAP}|g' \
         -e 's|##DISTRO_MULTICONF_APTSOURCES##|${DISTRO_MULTICONF_APTSOURCES}|g' \
-        -e 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|g' \
-        -e 's|##DISTRO_APT_SOURCE_SEC##|${DISTRO_APT_SOURCE_SEC}|g' \
+        -e 's|##DISTRO_APT_SOURCE##|copy:///${TOPDIR}/apt-cache/${DISTRO}/public/${ISAR_MIRROR_PREFIX}|g' \
+        -e 's|##DISTRO_APT_SOURCE_SEC##|copy:///${TOPDIR}/apt-cache/${DISTRO}/public/${ISAR_MIRROR_PREFIX}-security|g' \
         -e 's|##DISTRO_SUITE##|${DISTRO_SUITE}|g' \
         -e 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|g' \
         -e 's|##CONFIG_SCRIPT##|./'"$WORKDIR_REL"'/${DISTRO_CONFIG_SCRIPT}|g' \
         -e 's|##SETUP_SCRIPT##|./'"$WORKDIR_REL"'/setup.sh|g' \
         -e 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \
         -e 's|##IMAGE_INSTALL##|${IMAGE_INSTALL}|g' \
-        -e 's|##DEPLOY_DIR_APT##|copy:///${DEPLOY_DIR_APT}/${DISTRO}|g' \
+        -e 's|##DEPLOY_DIR_APT##|copy:///${TOPDIR}/apt-cache/${DISTRO}/public/isar|g' \
         -e 's|##ISAR_DISTRO_SUITE##|${DEBDISTRONAME}|g' \
            "${WORKDIR}/multistrap.conf.in" > "${WORKDIR}/multistrap.conf"
 
     [ ! -d ${IMAGE_ROOTFS}/proc ] && sudo install -d -o 0 -g 0 -m 555 ${IMAGE_ROOTFS}/proc
     sudo mount -t proc none ${IMAGE_ROOTFS}/proc
+    sudo mount --bind ${TOPDIR}/apt-cache ${IMAGE_ROOTFS}${CHROOT_CACHE_DIR}
     _do_rootfs_cleanup() {
         ret=$?
         sudo umount ${IMAGE_ROOTFS}/proc 2>/dev/null || true
+        sudo umount ${IMAGE_ROOTFS}${CHROOT_CACHE_DIR} 2>/dev/null || true
         (exit $ret) || bb_exit_handler
     }
     trap '_do_rootfs_cleanup' EXIT
@@ -74,3 +87,4 @@ do_rootfs() {
     sudo rm "${IMAGE_ROOTFS}/${DISTRO_CONFIG_SCRIPT}"
     _do_rootfs_cleanup
 }
+do_rootfs[dirs] += "${IMAGE_ROOTFS}${CHROOT_CACHE_DIR}"
\ No newline at end of file
-- 
2.7.4


  parent reply	other threads:[~2018-02-06 10:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-06 10:09 [PATCH 0/6] Local apt cache with aptly Benedikt Niedermayr
2018-02-06 10:09 ` [PATCH 1/6] Implement support for setting up the local apt mirror and isar repository " Benedikt Niedermayr
2018-02-06 10:09 ` [PATCH 2/6] Added API class for apt cache Benedikt Niedermayr
2018-02-06 10:09 ` [PATCH 3/6] Added apt-cache functionality for buildchroot Benedikt Niedermayr
2018-02-06 10:09 ` Benedikt Niedermayr [this message]
2018-02-06 10:09 ` [PATCH 5/6] Added do_finalize_image task Benedikt Niedermayr
2018-02-06 10:09 ` [PATCH 6/6] Added support for installing isar packages to local isar repository Benedikt Niedermayr
2018-02-06 12:39 ` [PATCH 0/6] Local apt cache with aptly Jan Kiszka
2018-02-06 13:28   ` Jan Kiszka
2018-02-06 14:03     ` Benedikt Niedermayr
2018-02-06 14:26       ` Hombourger, Cedric
2018-02-06 13:00 ` 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=1517911779-30507-5-git-send-email-Benedikt.Niedermayr@mixed-mode.de \
    --to=benbrenson89@googlemail.com \
    --cc=Benedikt.Niedermayr@mixed-mode.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