Merge branch 'devel' into 'main'

add treeinfo modder for kickstart directory

See merge request release-engineering/public/toolkit!33
This commit is contained in:
Louis Abel 2021-11-10 23:31:01 +00:00
commit a5d789004e
2 changed files with 39 additions and 0 deletions

View File

@ -114,5 +114,43 @@ EOF
/bin/cp "${TREEINFO_VAR}" "${PRISTINE_TREE}" /bin/cp "${TREEINFO_VAR}" "${PRISTINE_TREE}"
} }
function treeinfoModderKickstart() {
BaseOSArch="${1}"
TREEINFO_VAR="${STAGING_ROOT}/${RELEASE_DIR}/BaseOS/${BaseOSArch}/os/.treeinfo"
PRISTINE_TREE="${STAGING_ROOT}/${RELEASE_DIR}/BaseOS/${BaseOSArch}/os/.treeinfo-pristine"
test -f "${TREEINFO_VAR}"
treeinfo_retval=$?
test -x /usr/bin/python3
python_retval=$?
# There is an awk way to do this, but it was easier to implement python and
# cat heredoc together. It felt cleaner. This was a trick I had used in a
# previous life when I had to admin Solaris systems, and I needed a way to
# add a solaris 10 system into FreeIPA (it was not fun, let me tell you). But
# the take away is I learned something kind of on the fly and well, it worked.
# Emails should have stamps.
if [ "$treeinfo_retval" -eq 0 ] && [ "$python_retval" -eq 0 ]; then
cat <<EOF | /usr/bin/python3
from configparser import ConfigParser
config = ConfigParser()
config.read('${TREEINFO_VAR}')
config.set('tree', 'variants', 'BaseOS,AppStream')
config.add_section('variant-AppStream')
config.set('variant-AppStream', 'id', 'AppStream')
config.set('variant-AppStream', 'name', 'AppStream')
config.set('variant-AppStream', 'type', 'variant')
config.set('variant-AppStream', 'uid', 'AppStream')
config.set('variant-AppStream', 'packages', '../../../AppStream/${BaseOSArch}/kickstart/Packages')
config.set('variant-AppStream', 'repository', '../../../AppStream/${BaseOSArch}/kickstart/')
with open('${TREEINFO_VAR}', 'w') as configfile:
config.write(configfile)
EOF
else
echo "${TREEINFO_VAR}, or python3 does not exist on this system."
fi
/bin/cp "${TREEINFO_VAR}" "${PRISTINE_TREE}"
}
export -f treeinfoFixer export -f treeinfoFixer
export -f treeinfoModder export -f treeinfoModder
export -f treeinfoModderKickstart

View File

@ -73,6 +73,7 @@ done
for ARCH in "${ARCHES[@]}"; do for ARCH in "${ARCHES[@]}"; do
echo "Ensuring treeinfo is correct" echo "Ensuring treeinfo is correct"
treeinfoModder "${ARCH}" treeinfoModder "${ARCH}"
treeinfoModderKickstart "${ARCH}"
done done
# sign all repos # sign all repos