make regex take care of double digits

This commit is contained in:
Louis Abel 2022-10-12 20:39:23 -07:00
parent 544f7d2fa4
commit dea32e0fd0
Signed by untrusted user: label
GPG Key ID: B37E62D143879B36
2 changed files with 19 additions and 1 deletions

View File

@ -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

View File

@ -21,7 +21,9 @@ SOURCE_AMI_NAME=$(aws --profile resf-ami ec2 describe-images \
# Enforce a name structure # Enforce a name structure
# Rocky-8-ec2-8.6-20220515.0.x86_64 # 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 if [[ ! "${SOURCE_AMI_NAME}" =~ $pat ]]; then
echo "Bad source ami (${SOURCE_AMI_NAME}). Exiting." echo "Bad source ami (${SOURCE_AMI_NAME}). Exiting."
exit 1 exit 1