@@ -136,8 +136,11 @@ do_bootstrap() {
else
deb_dl_dir_import "${WORKDIR}/dl_dir" "${BOOTSTRAP_BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
+ isar_apt_tmp="$(mktemp -d /tmp/isar-aptXXXXXXXXXX)"
bootstrap_list="${WORKDIR}/sources.list.d/bootstrap.list"
- install -v -m644 "${APTSRCS}" "$bootstrap_list"
+ line="copy://$isar_apt_tmp/${DISTRO} ${DEBDISTRONAME} main"
+ echo "deb [trusted=yes] ${line}" > "$bootstrap_list"
+ cat "${APTSRCS}" >> "$bootstrap_list"
syncin='flock -s ${DEB_DL_LOCK} cp -n --no-preserve=owner \
"${WORKDIR}/dl_dir/var/cache/apt/archives/"*.deb \
@@ -145,17 +148,23 @@ do_bootstrap() {
syncout='flock -s ${DEB_DL_LOCK} cp -n --no-preserve=owner \
"$1/var/cache/apt/archives/"*.deb \
"${WORKDIR}/dl_dir/var/cache/apt/archives/"'
- extra_setup="$syncin"
+ extra_setup="mount --bind '${REPO_ISAR_DIR}' $isar_apt_tmp"
+ extra_setup="$extra_setup && $syncin"
extra_extract="$syncout"
+ extra_essential="mkdir -p \$1/$isar_apt_tmp && \
+ echo \$1 > ${WORKDIR}/mmtmpdir && \
+ mount -o bind,private '${REPO_ISAR_DIR}' \$1/$isar_apt_tmp"
# prefetch apt debs because mmdebstrap will clean them on next stage
- extra_essential='apt-get install apt -y -d \
+ extra_apt='apt-get install apt -y -d \
-o Dir::State="$1/var/lib/apt" \
-o Dir::Etc="$1/etc/apt" \
-o Dir::Cache="$1/var/cache/apt" \
-o Apt::Architecture="${BOOTSTRAP_DISTRO_ARCH}" \
${@get_apt_opts(d, '-o')}'
- extra_essential="$extra_essential && $syncout"
- extra_customize="$syncout"
+ extra_essential="$extra_essential && $extra_apt && $syncout"
+ extra_customize="umount \$1/$isar_apt_tmp && \
+ umount $isar_apt_tmp && rm -rf --one-file-system $isar_apt_tmp"
+ extra_customize="$extra_customize && $syncout"
fi
if [ ! -z "${SOURCE_DATE_EPOCH}" ]; then
@@ -178,7 +187,10 @@ do_bootstrap() {
[ -d "$tmpdir" ] && sudo rm -rf --one-file-system $tmpdir; \
[ -n "$base_apt_tmp" ] && mountpoint -q $base_apt_tmp \
&& sudo umount $base_apt_tmp \
- && rm -rf --one-file-system $base_apt_tmp' EXIT
+ && rm -rf --one-file-system $base_apt_tmp; \
+ [ -n "$isar_apt_tmp" ] && mountpoint -q $isar_apt_tmp \
+ && sudo umount $isar_apt_tmp \
+ && rm -rf --one-file-system $isar_apt_tmp' EXIT
sudo TMPDIR="${BOOTSTRAP_TMPDIR}" mmdebstrap $bootstrap_args \
$arch_param \
To support using custom variants of packages in bootstrap, include isar-apt as possible distro source. In order to avoid wasting time on copying, reuse the bind-mount technique from the base-apt implementation. Signed-off-by: Andreas Naumann <anaumann@emlix.com> --- .../isar-mmdebstrap/isar-mmdebstrap.inc | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-)