Skip to content

Commit

Permalink
Merge pull request #215 from grml/mika/sources
Browse files Browse the repository at this point in the history
Generate source package tarball when using SOURCES class
  • Loading branch information
mika authored Dec 18, 2024
2 parents 5fe6360 + 8b0a6fa commit 94e6140
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions grml-live
Original file line number Diff line number Diff line change
Expand Up @@ -1864,6 +1864,38 @@ create_netbootpackage() {
create_netbootpackage
# }}}

# {{{
create_sourcespackages() {
if ! hasclass SOURCES ; then
log "Skipping source package generation, only enabled with class SOURCES"
return 0
fi

local OUTPUT_FILE SOURCES_DIR
OUTPUT_FILE="${OUTPUT}/$(basename "${ISO_NAME}" .iso)-sources.tar"
SOURCES_DIR="${OUTPUT}/grml_sources/"

if ! [ -d "${SOURCES_DIR}" ] ; then
eerror "Base directory ${SOURCES_DIR} not present, can not generate source package" ; eend 1
bailout 22
fi

if tar -C "${OUTPUT}" -cf "${OUTPUT_FILE}" "$(basename "${SOURCES_DIR}")" ; then
(
# shellcheck disable=SC2164 # We just wrote there. If it disappeared, too bad.
cd "$(dirname "${OUTPUT_FILE}")"
sha256sum "$(basename "${OUTPUT_FILE}")" > "${OUTPUT_FILE}.sha256"
)
einfo "Generated source package ${OUTPUT_FILE}" ; eend 0
else
eerror "Could not generate source package ${OUTPUT_FILE}" ; eend 1
bailout 22
fi
}

create_sourcespackages
# }}}

# finalize {{{
if [ -n "${start_seconds}" ] ; then
end_seconds="$(date +%s)"
Expand Down

0 comments on commit 94e6140

Please sign in to comment.