toolkit/mangle/generators/generate_prepopulate_from_pungi
2022-09-25 19:31:40 -07:00

38 lines
795 B
Bash
Executable file

#!/bin/bash
# Parses a local compose's repos
#set -x
if [ -n "$1" ] && [ -n "$2" ]; then
MAJOR=$1
DATE=$2
else
echo "Major version not specified"
exit 1
fi
# Verify the date format
echo "${DATE}" | grep -Eq '[0-9]+\.[0-9]'
grep_val=$?
if [ "$grep_val" -ne 0 ]; then
echo "Date format incorrect. You must use: YYYYMMDD.X"
fi
export RLVER=$MAJOR
source common
drop="${PREPOPDROP}"
current=$(pwd)
compose_dir="${COMPOSE_BASEDIR}/Rocky-${MAJOR}-${DATE}/compose"
pushd "${compose_dir}" || { echo "Could not change directory"; exit 1; }
/usr/bin/python3 "${current}/prepopulate_parser.py"
ret_val=$?
popd || { echo "Could not change back..."; exit 1; }
if [ "$ret_val" -ne "0" ]; then
echo "There was an error running through the parser."
exit 1
fi
echo "File located at: $drop"