additional fixes

This commit is contained in:
Louis Abel 2021-07-12 00:50:40 -07:00
parent b449dc51b0
commit 6af12937af
Signed by: label
GPG Key ID: B37E62D143879B36
3 changed files with 62 additions and 55 deletions

View File

@ -59,3 +59,59 @@ MODS=(
AppStream AppStream
PowerTools PowerTools
) )
# functions
# Note, EL8 and EL9 may not be the same, do not put in 'common'
function treeinfoFixer() {
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 "${PRISTINE_TREE}"
pris_retval=$?
if [ "$pris_retval" -eq 0 ]; then
/bin/cp "${PRISTINE_TREE}" "${TREEINFO_VAR}"
else
echo "WARNING: We do not have a pristine treeinfo to copy from"
fi
}
# Note, EL8 and EL9 may not be the same, do not put in 'common'
function treeinfoModder() {
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}/os/Packages')
config.set('variant-AppStream', 'repository', '../../../AppStream/${BaseOSArch}/os/')
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 treeinfoModder

View File

@ -47,6 +47,11 @@ for ARCH in "${ARCHES[@]}"; do
done done
done done
# fix treeinfo
for ARCH in "${ARCHES[@]}"; do
treeinfoModder "${ARCH}"
done
# sign all repos # sign all repos
test -f $(dirname "$0")/sign-repos-only.sh test -f $(dirname "$0")/sign-repos-only.sh
ret_val=$? ret_val=$?

View File

@ -104,59 +104,5 @@ for x in "${ARCHES[@]}"; do
done done
echo "** Fix variants" echo "** Fix variants"
TREEINFO_VAR="${STAGING_ROOT}/${RELEASE_DIR}/BaseOS/${x}/os/.treeinfo" treeinfoFixer "${x}"
IMAGES_VAR="${STAGING_ROOT}/${RELEASE_DIR}/BaseOS/${x}/os/images"
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
# shellcheck disable=SC2086
BOOTISO_CHECKSUM="$(sha256sum ${IMAGES_VAR}/boot.iso | cut -d' ' -f1)"
# shellcheck disable=SC2086
EFIBOOT_CHECKSUM="$(sha256sum ${IMAGES_VAR}/efiboot.img | cut -d' ' -f1)"
# shellcheck disable=SC2086
INSTALLIMG_CHECKSUM="$(sha256sum ${IMAGES_VAR}/install.img | cut -d' ' -f1)"
# shellcheck disable=SC2086
INITRD_CHECKSUM="$(sha256sum ${IMAGES_VAR}/pxeboot/initrd.img | cut -d' ' -f1)"
# shellcheck disable=SC2086
VMLINUZ_CHECKSUM="$(sha256sum ${IMAGES_VAR}/pxeboot/vmlinuz | cut -d' ' -f1)"
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('variants-AppStream', 'id', 'AppStream')
config.set('variants-AppStream', 'name', 'AppStream')
config.set('variants-AppStream', 'type', 'variant')
config.set('variants-AppStream', 'uid', 'AppStream')
config.set('variants-AppStream', 'packages', '../../../AppStream/${x}/os/Packages')
config.set('variants-AppStream', 'repository', '../../../AppStream/${x}/os/')
config.add_section('images-${x}')
config.set('images-${x}', 'boot.iso', 'images/boot.iso')
config.set('images-${x}', 'efiboot.img', 'images/efiboot.img')
config.set('images-${x}', 'initrd', 'images/pxeboot/initrd.img')
config.set('images-${x}', 'kernel', 'images/pxeboot/vmlinuz')
config.add_section('stage2')
config.set('stage2', 'mainimage', 'images/install.img')
config.add_section('checksums')
config.set('checksums', 'images/boot.iso', 'sha256:${BOOTISO_CHECKSUM}')
config.set('checksums', 'images/efiboot.img', 'sha256:${EFIBOOT_CHECKSUM}')
config.set('checksums', 'images/install.img', 'sha256:${INSTALLIMG_CHECKSUM}')
config.set('checksums', 'images/pxeboot/initrd.img', 'sha256:${INITRD_CHECKSUM}')
config.set('checksums', 'images/pxeboot/vmlinuz', 'sha256:${VMLINUZ_CHECKSUM}')
with open('${TREEINFO_VAR}', 'w') as configfile:
config.write(configfile)
EOF
else
echo "${TREEINFO_VAR} or python3 does not exist on this system."
fi
done done