diff options
author | Leah Rowe <leah@libreboot.org> | 2024-05-14 23:17:22 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2024-05-14 23:44:28 +0100 |
commit | 1ce7e339769c4fd38ce5a3818e5b5835a867422a (patch) | |
tree | 7a1840ba9d1be48675711eee01544793923aaad5 /include | |
parent | 190495d2e51e8fac710e53e6b3bc7afc3de74277 (diff) |
move rom tarball creation to script/roms
export LBMK_RELEASE="y"
if this is done, the tarball is created instead
of a directory, and the rom images are nuked using
./vendor inject with the nuke option, inserting the
correct version files; the rom directory is deleted
now the release script logic simple renames existing
tarballs. the benefit of this change is fewer lines of
code, and now lbmk doesn't use an insane amount of disk
space when building a *lot* of release images (the
uncompressed directories are deleted after each build)
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include')
-rwxr-xr-x | include/option.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/include/option.sh b/include/option.sh index b79c34f4..b974c630 100755 --- a/include/option.sh +++ b/include/option.sh @@ -171,3 +171,41 @@ check_project() done export LOCALVERSION="-${projectname}-${version%%-*}" } + +mktar_release() +{ + x_ insert_version_files "$1" + mktarball "$1" "${1}.tar.xz" + x_ rm -Rf "$1" +} + +mktarball() +{ + # preserve timestamps for reproducible tarballs + tar_implementation=$(tar --version | head -n1) || : + + [ "${2%/*}" = "${2}" ] || \ + mkdir -p "${2%/*}" || $err "mk, !mkdir -p \"${2%/*}\"" + printf "\nCreating archive: %s\n\n" "$2" + if [ "${tar_implementation% *}" = "tar (GNU tar)" ]; then + tar --sort=name --owner=root:0 --group=root:0 \ + --mtime="UTC 2024-05-04" -c "$1" | xz -T$threads -9e \ + > "$2" || $err "mktarball 1, ${1}" + else + # TODO: reproducible tarballs on non-GNU systems + tar -c "$1" | xz -T$threads -9e > "$2" || \ + $err "mktarball 2, $1" + fi + ( + [ "${2%/*}" != "${2}" ] && x_ cd "${2%/*}" + sha512sum "${2##*/}" > "${2##*/}.sha512" || \ + $err "!sha512sum \"${2##*/}\" > \"${2##*/}.sha512\"" + ) || $err "failed to create tarball checksum" +} + +insert_version_files() +{ + printf "%s\n" "${version}" > "${1}/version" || return 1 + printf "%s\n" "${versiondate}" > "${1}/versiondate" || return 1 + printf "%s\n" "${projectname}" > "${1}/projectname" || return 1 +} |