From a255a108100e761aeeb18de76fb7ae80ba10e720 Mon Sep 17 00:00:00 2001 From: Neil Hanlon Date: Thu, 27 Apr 2023 23:50:56 -0400 Subject: [PATCH] add script to run oval sync --- sync/oval.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 sync/oval.sh diff --git a/sync/oval.sh b/sync/oval.sh new file mode 100644 index 0000000..2197bf4 --- /dev/null +++ b/sync/oval.sh @@ -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"