Skip to content

Commit

Permalink
Merge pull request #169 from grml/sources-no-bindmount
Browse files Browse the repository at this point in the history
SOURCES: move directory instead of bind-mounting it in
  • Loading branch information
zeha authored Nov 4, 2024
2 parents 160ab7e + 87524f9 commit 859bc6d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
22 changes: 12 additions & 10 deletions etc/grml/fai/config/scripts/GRMLBASE/03-get-sources
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ fi
set -u

PACKAGE_LIST=$(mktemp)
SOURCES_PATH=/grml-live/grml_sources/
SOURCES_ERRORS_LOG="${SOURCES_PATH}"errors.log

bailout() {
rm -f "${target}/grml-live/sources/errors.log"
rm -f "${target}${SOURCES_ERRORS_LOG}"
rm -f "$PACKAGE_LIST"
}

Expand All @@ -31,30 +33,30 @@ if ! [ -r "${PACKAGE_LIST}" ] ; then
bailout
exit 1
else
mkdir -p "${target}"/grml-live/sources
mkdir -p "${target}${SOURCES_PATH}"

# needs to be done for each package to get:
# | Picking 'acpi-support' as source package instead of 'acpi-fakekey'
# instead of:
# | E: Unable to find a source package for acpi-fakekey
for package in $(grep -v '^#' ${PACKAGE_LIST}) ; do
cat << EOT | chroot "$target" /bin/bash
cd /grml-live/sources
apt-get --download-only source "$package" 2>>/grml-live/sources/errors.log
cd "${SOURCES_PATH}"
apt-get --download-only source "$package" 2>>"${SOURCES_ERRORS_LOG}"
EOT
done

if grep -q '^E:' "${target}/grml-live/sources/errors.log" ; then
if grep -q '^E:' "${target}${SOURCES_ERRORS_LOG}" ; then
echo "Errors noticed while retrieving sources:" >&2
cat "${target}/grml-live/sources/errors.log" >&2
cat "${target}${SOURCES_ERRORS_LOG}" >&2
bailout
exit 1
elif grep -q '^W:' "${target}/grml-live/sources/errors.log" ; then
elif grep -q '^W:' "${target}${SOURCES_ERRORS_LOG}" ; then
echo "Warnings noticed while retrieving sources (not failing the build though):"
cat "${target}/grml-live/sources/errors.log"
elif grep -q '.' "${target}/grml-live/sources/errors.log" ; then
cat "${target}${SOURCES_ERRORS_LOG}"
elif grep -q '.' "${target}${SOURCES_ERRORS_LOG}" ; then
echo "Unclassified problems noticed while retrieving sources:" >&2
cat "${target}/grml-live/sources/errors.log" >&2
cat "${target}${SOURCES_ERRORS_LOG}" >&2
bailout
exit 1
fi
Expand Down
7 changes: 4 additions & 3 deletions grml-live
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ umount_all() {
/usr/lib/fai/mkramdisk -u "$(readlink -f ${CHROOT_OUTPUT}/var/lib/dpkg)" >/dev/null 2>&1 || /bin/true
fi

umount "${CHROOT_OUTPUT}/grml-live/sources/" 2>/dev/null || /bin/true
[ -n "$MIRROR_DIRECTORY" ] && umount "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}"
}
# }}}
Expand Down Expand Up @@ -777,8 +776,7 @@ else
mount --bind "${MIRROR_DIRECTORY}" "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}"
fi

mkdir -p "${OUTPUT}/grml_sources/" "${CHROOT_OUTPUT}/grml-live/sources/"
mount --bind "${OUTPUT}/grml_sources/" "${CHROOT_OUTPUT}/grml-live/sources/"
mkdir -p "${CHROOT_OUTPUT}/grml-live/grml_sources/"

log "Executed FAI command line:"
log "BUILD_ONLY=$BUILD_ONLY BOOTSTRAP_ONLY=$BOOTSTRAP_ONLY GRML_LIVE_CONFIG=$CONFIGDUMP WAYBACK_DATE=$WAYBACK_DATE fai $VERBOSE -C $GRML_FAI_CONFIG -s file:///$GRML_FAI_CONFIG/config -c$CLASSES -u $HOSTNAME $FAI_ACTION $CHROOT_OUTPUT $FAI_ARGS"
Expand All @@ -794,6 +792,9 @@ else
bailout 1
fi

mv "${CHROOT_OUTPUT}/grml-live/grml_sources/" "${OUTPUT}/"
rmdir "${CHROOT_OUTPUT}/grml-live"

# provide inform fai about the ISO we build, needs to be provided
# *after* FAI stage, otherwise FAI skips the debootstrap stage if
# there is not BASEFILE (as it checks for presence of /etc) :(
Expand Down

0 comments on commit 859bc6d

Please sign in to comment.