From: Benedikt Niedermayr <benbrenson89@googlemail.com>
To: isar-users@googlegroups.com
Cc: Benedikt Niedermayr <Benedikt.Niedermayr@mixed-mode.de>
Subject: [PATCH v2 4/7] Added apt-cache functionality for image rootfs.
Date: Thu, 8 Feb 2018 11:40:09 +0100 [thread overview]
Message-ID: <1518086412-12567-5-git-send-email-Benedikt.Niedermayr@mixed-mode.de> (raw)
In-Reply-To: <1518086412-12567-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 | 25 ++++++++++++++++++----
2 files changed, 25 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..b342018 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,43 @@ do_rootfs() {
cd ${TOPDIR}
WORKDIR_REL=${@ os.path.relpath(d.getVar("WORKDIR", True))}
+ # 1. Replace directory of apt caches for using within chroots and
+ # 2. set the trusted=yes option for local unsigned cache repository.
+ # 3. Reduce components to main since mirror only offers that,
+ # see Multi-Component Publishing section of aptly doc for avoiding this fix.
+ cat<<-__EOF__ > $WORKDIR_REL/hooks_multistrap/completion_sources
+ for section in ${DISTRO_MULTICONF_APTSOURCES} isar; do
+ sed -i -e 's|${CACHE_DIR}|${CHROOT_CACHE_DIR}|g' \
+ -e 's|\[|\[ trusted=yes |g' \
+ -e 's|${DISTRO_COMPONENTS}|main|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:///${CACHE_DIR}/${DISTRO}/public/${ISAR_MIRROR_PREFIX}|g' \
+ -e 's|##DISTRO_APT_SOURCE_SEC##|copy:///${CACHE_DIR}/${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:///${CACHE_DIR}/${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 +90,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
next prev parent reply other threads:[~2018-02-08 10:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-08 10:40 [PATCH v2 0/7] Local apt cache with aptly V2 Benedikt Niedermayr
2018-02-08 10:40 ` [PATCH v2 1/7] Implement support for setting up the local apt mirror and isar repository with aptly Benedikt Niedermayr
2018-02-08 10:40 ` [PATCH v2 2/7] Added API class for apt cache Benedikt Niedermayr
2018-02-08 10:40 ` [PATCH v2 3/7] Added apt-cache functionality for buildchroot Benedikt Niedermayr
2018-02-08 10:40 ` Benedikt Niedermayr [this message]
2018-02-08 10:40 ` [PATCH v2 5/7] Added do_finalize_image task Benedikt Niedermayr
2018-02-08 10:40 ` [PATCH v2 6/7] Added support for installing isar packages to local isar repository Benedikt Niedermayr
2018-02-08 10:40 ` [PATCH v2 7/7] Introducing fetchall, unpackall and unpack_debian tasks Benedikt Niedermayr
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=1518086412-12567-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