From dea32e0fd0050299182f18d4ffb9f8b3c7dffe2c Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Wed, 12 Oct 2022 20:39:23 -0700 Subject: [PATCH] make regex take care of double digits --- iso/empanadas/empanadas/templates/verifygpg.tmpl | 16 ++++++++++++++++ sync/propagate-image.sh | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 iso/empanadas/empanadas/templates/verifygpg.tmpl diff --git a/iso/empanadas/empanadas/templates/verifygpg.tmpl b/iso/empanadas/empanadas/templates/verifygpg.tmpl new file mode 100644 index 0000000..2452103 --- /dev/null +++ b/iso/empanadas/empanadas/templates/verifygpg.tmpl @@ -0,0 +1,16 @@ +#!/bin/bash +set -o pipefail +{{ import_gpg_cmd }} | tee -a {{ sync_log }} +{{ arch_force_cp }} | tee -a {{ sync_log }} +{{ dnf_plugin_cmd }} | tee -a {{ sync_log }} +sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/*.repo + +LISTS=( $({{ dnf_url_cmd }} | grep '.rpm$' | tee -a {{ sync_log }}) ) + +ret_val=$? +if [ "$ret_val" -ne 0 ]; then + echo "Pulling URL's failed" | tee -a {{ sync_log }} + echo "It is likely the repo is not GPG signed properly." | tee -a {{ sync_log }} + exit 1 +fi + diff --git a/sync/propagate-image.sh b/sync/propagate-image.sh index e976e8d..7b64d95 100644 --- a/sync/propagate-image.sh +++ b/sync/propagate-image.sh @@ -21,7 +21,9 @@ SOURCE_AMI_NAME=$(aws --profile resf-ami ec2 describe-images \ # Enforce a name structure # Rocky-8-ec2-8.6-20220515.0.x86_64 -pat="Rocky-[89]-[Ee][Cc]2-[89]\.[0-9]-[0-9]+\.[0-9]+\.((aarch|x86_)64|ppc64le|s390x)" +# Rocky-9-EC2-9.10-20280501.0.aarch64 +# Rocky-10-EC2-10.2-20260530.0.x86_64 +pat="Rocky-[0-9]{,2}-[Ee][Cc]2-[0-9]{,2}\.[0-9]{,2}-[0-9]+\.[0-9]+\.((aarch|x86_)64|ppc64le|s390x)" if [[ ! "${SOURCE_AMI_NAME}" =~ $pat ]]; then echo "Bad source ami (${SOURCE_AMI_NAME}). Exiting." exit 1