THE FINAL BOSS
This commit is contained in:
parent
5e04d68b4a
commit
06e3fea70b
@ -1,14 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
REAL_USER=$(who am i | awk '{print $1}')
|
||||
set -x
|
||||
|
||||
APPLIANCE_NAME="Rocky-9-aarch64-minimal"
|
||||
KICKSTARTER_FILENAME="${APPLIANCE_NAME}.ks"
|
||||
IMAGE_NAME="${APPLIANCE_NAME}-$(date +%Y.%m.%d).raw"
|
||||
COMPRESSED_IMAGE_NAME="${IMAGE_NAME}.zst"
|
||||
|
||||
if [[ ${EUID} -ne 0 ]]; then
|
||||
>&2 echo "ERROR: Please run this script as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
{
|
||||
appliance-creator \
|
||||
--config "${KICKSTARTER_FILENAME}" \
|
||||
--name "${APPLIANCE_NAME}" \
|
||||
@ -17,29 +21,25 @@ appliance-creator \
|
||||
--outdir "${PWD}" \
|
||||
--cache "/root/cache" \
|
||||
--debug \
|
||||
--verbose \
|
||||
1> Rocky-9-aarch64-minimal.stdout.log \
|
||||
2> Rocky-9-aarch64-minimal.stderr.log
|
||||
#--checksum
|
||||
--verbose
|
||||
# DO NOT USE THE '--checksum' OPTION BECAUSE, FOR SOME REASON
|
||||
# UTF8 ERRORS ARE GENERATED DURING IMAGE CREATION
|
||||
# AND THE IMAGE CREATION STEP FAILS
|
||||
#--checksum \
|
||||
|
||||
if [[ -f "${APPLIANCE_NAME}-sda.raw" ]]; then
|
||||
set -x
|
||||
if [[ -d "${APPLIANCE_NAME}" ]]; then
|
||||
|
||||
IMAGE_NAME="${APPLIANCE_NAME}-$(date +%Y.%m.%d).raw"
|
||||
COMPRESSED_IMAGE_NAME="${IMAGE_NAME}.zst"
|
||||
|
||||
touch "${APPLIANCE_NAME}-sda.raw"
|
||||
mv -v "${APPLIANCE_NAME}-sda.raw" "${IMAGE_NAME}"
|
||||
pushd "${APPLIANCE_NAME}" || exit 1
|
||||
mv -v -f "${APPLIANCE_NAME}-sda.raw" "${IMAGE_NAME}"
|
||||
zstd -9 -z "${IMAGE_NAME}"
|
||||
|
||||
sha256sum "${IMAGE_NAME}" > "${IMAGE_NAME}.sha256"
|
||||
sha512sum "${IMAGE_NAME}" > "${IMAGE_NAME}.sha512"
|
||||
|
||||
sha256sum "${COMPRESSED_IMAGE_NAME}" > "${COMPRESSED_IMAGE_NAME}.sha256"
|
||||
sha512sum "${COMPRESSED_IMAGE_NAME}" > "${COMPRESSED_IMAGE_NAME}.sha512"
|
||||
popd || exit 1
|
||||
|
||||
chown -v "${REAL_USER}:${REAL_USER}" "${IMAGE_NAME}*"
|
||||
echo 'DONE'
|
||||
echo "Please chown '${APPLIANCE_NAME}/' if necessary"
|
||||
fi
|
||||
} 1> "${APPLIANCE_NAME}.1.stdout.log" 2> "${APPLIANCE_NAME}.2.stderr.log"
|
||||
|
Loading…
Reference in New Issue
Block a user