2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-21 19:22:05 +00:00

Merge pull request #4624 from neo954/genesis

A script to convert xCAT-genesis-base rpm package to deb package
This commit is contained in:
zet809 2018-01-17 14:26:28 +08:00 committed by GitHub
commit 35c2e4a43e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 2 deletions

View File

@ -0,0 +1,57 @@
#!/bin/bash
#
# This is a dirty script for convert an xCAT-genesis-base rpm package to
# a debian package.
#
# 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
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##*-}"
if [[ ${EXTRACT_DIR} =~ -x86_64- ]]
then
rm -rf "${EXTRACT_DIR//x86_64/amd64}"
mv "${EXTRACT_DIR}" "${EXTRACT_DIR//x86_64/amd64}"
EXTRACT_DIR="${EXTRACT_DIR//x86_64/amd64}"
sed -i -e 's/x86-64/amd64/g' "${EXTRACT_DIR}/debian/control"
sed -i -e 's/x86-64/amd64/g' "${EXTRACT_DIR}/debian/changelog"
fi
sed -i -e "/^Description:/i Breaks: xcat-genesis-scripts-${PACKAGE_ARCH//x86_64/amd64} (<< 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
EOF
( cd "${EXTRACT_DIR}" && debian/rules binary )

View File

@ -29,7 +29,7 @@ Vendor: IBM Corp.
Summary: xCAT Genesis netboot image
URL: https://xcat.org/
Source1: xCAT-genesis-base-%{tarch}.tar.bz2
Conflicts: xCAT-genesis-scripts-%{tarch} < 1:2.13.9
Conflicts: xCAT-genesis-scripts-%{tarch} < 1:2.13.10
Buildroot: %{_localstatedir}/tmp/xCAT-genesis
BuildRequires: /usr/sbin/ntp-wait

View File

@ -33,7 +33,8 @@ rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/genesis/builder
cd $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/genesis/builder
tar jxvf %{SOURCE1}
chmod +x $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/genesis/builder/buildrpm
chmod 0755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/genesis/builder/buildrpm
chmod 0755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/genesis/builder/debuild-xcat-genesis-base
cd -