-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexport.sh
More file actions
executable file
·26 lines (21 loc) · 840 Bytes
/
export.sh
File metadata and controls
executable file
·26 lines (21 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env bash
set -ex
readonly SEMVER=${SEMVER_MAJOR_MINOR}${SEMVER_PATCH}
readonly DOCKER_IMAGE="ghcr.io/metal-stack/${OS_NAME}:${SEMVER}"
readonly IMAGE_BASENAME=img
readonly TARGET_PATH="images${OUTPUT_FOLDER}/${OS_NAME}/${SEMVER_MAJOR_MINOR}"
readonly EXPORT_DIRECTORY="./${TARGET_PATH}"
readonly TAR="${IMAGE_BASENAME}.tar"
readonly LZ4="${IMAGE_BASENAME}.tar.lz4"
readonly MD5="${IMAGE_BASENAME}.tar.lz4.md5"
readonly PKG="packages.txt"
# export tarball with checksum from docker image and package list
cd "${EXPORT_DIRECTORY}"
docker rmi "${DOCKER_IMAGE}" || true
docker run --rm "${DOCKER_IMAGE}" bash -c "${IMG_PKG_COMMAND}" > ${PKG}
lz4 -f -9 ${TAR} ${LZ4}
rm -f ${TAR}
md5sum ${LZ4} > ${MD5}
# export a list with the generated fqdn image names
# mkdir -p workdir
echo "${OS_NAME}-${SEMVER_MAJOR_MINOR}${SEMVER_PATCH}"