toolkit/mangle/generators/generate_prepopulate_from_pungi

46 lines
926 B
Plaintext
Raw Normal View History

2022-09-26 02:31:40 +00:00
#!/bin/bash
# Parses a local compose's repos
#set -x
if [ -n "$1" ] && [ -n "$2" ]; then
MAJOR=$1
DATE=$2
else
2022-10-31 22:39:38 +00:00
echo "Major version or date not specified"
2022-09-26 02:31:40 +00:00
exit 1
fi
2024-10-29 20:10:26 +00:00
if [ -f /usr/bin/dnf4 ]; then
SAFEDNF=/usr/bin/dnf4
else
SAFEDNF=/usr/bin/dnf
fi
2022-09-26 02:31:40 +00:00
# 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"
2022-10-31 22:39:38 +00:00
exit 2
2022-09-26 02:31:40 +00:00
fi
export RLVER=$MAJOR
source common
drop="${PREPOPDROP}"
current=$(pwd)
2022-10-31 22:39:38 +00:00
compose_dir="${COMPOSE_BASEDIR}/${MAJOR}/Rocky-${MAJOR}-${DATE}/compose"
2022-09-26 02:31:40 +00:00
pushd "${compose_dir}" || { echo "Could not change directory"; exit 1; }
/usr/bin/python3 "${current}/prepopulate_parser.py" --version ${RLVER}
2022-09-26 02:31:40 +00:00
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"