2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-21 08:33:20 +00:00
Files
xcat-core/xCAT-genesis-builder/debuild-xcat-genesis-base
T
Daniel Hilst da9e17fb53 fix(xcat-core): check the absolute paths the Genesis module installs, and name the deb the rename supersedes
verify-genesis-payload dropped every name that started with "/" before checking
the payload, so the 609 absolute paths the EL dracut module installs were
checked by nothing. An image with no /usr/bin/awk passed. The filter now drops
only option words, and an absolute name is read back under the payload root.

The ppc64 to ppc64el rename left the new Genesis base deb without a relation to
the deb it replaces, so dpkg kept xcat-genesis-base-ppc64 installed beside it
with its own copy of the files under /opt/xcat/share/xcat/netboot/genesis.
builddeb-genesis-base and debuild-xcat-genesis-base now write Replaces and
Breaks for the superseded package, as the genesis-scripts control file already
does. The native path takes the architecture rewrite into rewrite_control() so
the superseded name is derived in one place.

genesis_payload_verification.t, genesis_base_deb_arch.t and
genesis_base_deb_control_rewrite.t fail without this change.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-09-11 16:00:57 -03:00

88 lines
2.9 KiB
Bash
Executable File

#!/bin/bash
#
# DEPRECATED: Use builddeb-genesis-base for native Ubuntu builds.
# This script converts an EL-built RPM to .deb via alien.
# Kept for backward compatibility only.
#
# xCAT-genesis-base-x86_64-2.13.10-snap201801090246.noarch.rpm
RPM_PACKAGE="$1"
if [ -z "${RPM_PACKAGE}" ]
then
echo "Usage: ${0##*/} /path/to/xCAT-genesis-base.rpm"
exit 0
fi
set -x
[ -n "${RPM_PACKAGE}" ] || exit 1
[ -f "${RPM_PACKAGE}" ] || exit 1
umask 0022
EXTRACT_DIR="${RPM_PACKAGE##*/}"
EXTRACT_DIR="${EXTRACT_DIR%%-snap*}"
rm -rf "${EXTRACT_DIR}"
rm -rf "${EXTRACT_DIR}.orig"
alien -d -g -c -k "${RPM_PACKAGE}" || exit 1
PACKAGE_ARCH="${EXTRACT_DIR%-*}"
PACKAGE_ARCH="${PACKAGE_ARCH##*-}"
# The rpm carries the Genesis target architecture, the deb must carry the Debian architecture.
# alien copies the rpm name into the deb and writes "_" as "-", so x86_64 arrives as x86-64.
case "${PACKAGE_ARCH}" in
x86_64)
ALIEN_ARCH="x86-64" ; DEB_ARCH="amd64" ;;
ppc64|ppc64le)
ALIEN_ARCH="${PACKAGE_ARCH}" ; DEB_ARCH="ppc64el" ;;
*)
ALIEN_ARCH="${PACKAGE_ARCH}" ; DEB_ARCH="${PACKAGE_ARCH}" ;;
esac
if [[ "${DEB_ARCH}" != "${PACKAGE_ARCH}" ]]
then
rm -rf "${EXTRACT_DIR//${PACKAGE_ARCH}/${DEB_ARCH}}"
mv "${EXTRACT_DIR}" "${EXTRACT_DIR//${PACKAGE_ARCH}/${DEB_ARCH}}"
EXTRACT_DIR="${EXTRACT_DIR//${PACKAGE_ARCH}/${DEB_ARCH}}"
sed -i -e "s/${ALIEN_ARCH}/${DEB_ARCH}/g" "${EXTRACT_DIR}/debian/control"
sed -i -e "s/${ALIEN_ARCH}/${DEB_ARCH}/g" "${EXTRACT_DIR}/debian/changelog"
fi
# The Genesis debs carry the architecture in the package name, so the packages an upgrade has
# to displace carry it too. 2.19 renames the ppc64 debs to ppc64el; dpkg keeps the old package,
# and its copy of the same files, unless the new one replaces it by name.
case "${DEB_ARCH}" in
ppc64el)
SUPERSEDED="xcat-genesis-ppc64, xcat-genesis-base-ppc64" ;;
*)
SUPERSEDED="xcat-genesis-${DEB_ARCH}" ;;
esac
sed -i -e "/^Description:/i Replaces: ${SUPERSEDED}" \
-e "/^Description:/i Breaks: ${SUPERSEDED}, xcat-genesis-scripts-${DEB_ARCH} (<< 2.13.10)" \
"${EXTRACT_DIR}/debian/control"
cat >"${EXTRACT_DIR}/debian/preinst" <<EOF
#!/bin/bash
[ -d /opt/xcat/share/xcat/netboot/genesis/${PACKAGE_ARCH}/fs/bin ] &&
rm -rf /opt/xcat/share/xcat/netboot/genesis/${PACKAGE_ARCH}/fs/bin
[ -d /opt/xcat/share/xcat/netboot/genesis/${PACKAGE_ARCH}/fs/sbin ] &&
rm -rf /opt/xcat/share/xcat/netboot/genesis/${PACKAGE_ARCH}/fs/sbin
[ -d /opt/xcat/share/xcat/netboot/genesis/${PACKAGE_ARCH}/fs/lib ] &&
rm -rf /opt/xcat/share/xcat/netboot/genesis/${PACKAGE_ARCH}/fs/lib
[ -d /opt/xcat/share/xcat/netboot/genesis/${PACKAGE_ARCH}/fs/lib64 ] &&
rm -rf /opt/xcat/share/xcat/netboot/genesis/${PACKAGE_ARCH}/fs/lib64
[ -d /opt/xcat/share/xcat/netboot/genesis/${PACKAGE_ARCH}/fs/var/run ] &&
rm -rf /opt/xcat/share/xcat/netboot/genesis/${PACKAGE_ARCH}/fs/var/run
exit 0
EOF
chmod 0755 "${EXTRACT_DIR}/debian/preinst"
( cd "${EXTRACT_DIR}" && debian/rules binary )