add script to run oval sync

This commit is contained in:
Neil Hanlon 2023-04-27 23:50:56 -04:00
parent 2d63eba5bd
commit a255a10810
Signed by untrusted user: neil
GPG Key ID: 705BC21EC3C70F34

28
sync/oval.sh Normal file
View File

@ -0,0 +1,28 @@
#!/bin/bash
log(){
printf "[LOG] [%s] %s\n" "$(date -Is)" "$1"
}
OUTPUT_DIR=/mnt/repos-staging/mirror/pub/oval
TEMP="$(mktemp -d)"
for version in 8 9; do
file="$TEMP/org.rockylinux.rlsa-$version.xml"
log "Generating $file"
podman run --rm --storage-opt ignore_chown_errors=true ghcr.io/rocky-linux/oval:latest > "$file"
log "Compressing $file to $file.bz"
bzip2 -kfz "$file"
done
log "Generating checksums"
pushd "$TEMP" >/dev/null || exit 2
# shellcheck disable=2035
sha256sum --tag * > CHECKSUM
popd > /dev/null || exit 2
log "Copying to staging directory $TEMP => $OUTPUT_DIR"
sudo rsync -vrSHP "$TEMP/" "$OUTPUT_DIR"
sudo chown -Rv 10004:10005 "$OUTPUT_DIR"