2022-02-05 17:12:29 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
FROMFEDORA='34'
|
2022-02-06 21:00:45 +00:00
|
|
|
PACKAGE='msmtp'
|
2022-02-05 17:12:29 +00:00
|
|
|
|
|
|
|
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
|
|
|
|
cd ${ABSDIR}
|
|
|
|
|
|
|
|
type -P docker >/dev/null && DOCKER=$(which docker)
|
|
|
|
type -P podman >/dev/null && DOCKER=$(which podman)
|
|
|
|
|
2022-02-06 21:00:45 +00:00
|
|
|
if ! JSONLINE=$(curl -s https://src.fedoraproject.org/_dg/bodhi_updates/rpms/${PACKAGE} | grep -e "fc${FROMFEDORA}\","); then
|
|
|
|
echo "ERROR : No ${PACKAGE} release available for Fedora ${FROMFEDORA}"
|
|
|
|
echo "Please check https://src.fedoraproject.org/rpms/${PACKAGE} to choose the right release."
|
2022-02-05 17:44:22 +00:00
|
|
|
exit 1
|
2022-02-05 17:12:29 +00:00
|
|
|
fi
|
|
|
|
|
2022-02-06 21:00:45 +00:00
|
|
|
VERSION=$(echo "${JSONLINE}" | sed -e "s/^\s*\"stable\": \"${PACKAGE}-\(.*\)\.fc${FROMFEDORA}\",\s*$/\1/")
|
2022-02-05 17:12:29 +00:00
|
|
|
|
|
|
|
ARCH=$(${DOCKER} run --rm docker.io/library/rockylinux:8 uname -i)
|
|
|
|
|
2022-02-06 21:00:45 +00:00
|
|
|
${DOCKER} build -t docker-${PACKAGE}-build -f- . <<EOF
|
2022-02-05 17:12:29 +00:00
|
|
|
FROM docker.io/library/rockylinux:8
|
|
|
|
RUN dnf install -y epel-release dnf-plugins-core && \
|
|
|
|
dnf config-manager --set-enabled powertools && \
|
|
|
|
dnf install -y rpm-build gcc make gettext gnutls-devel libgsasl-devel libidn-devel libsecret-devel && \
|
|
|
|
useradd -m dontbuildasroot -s /bin/bash
|
|
|
|
USER dontbuildasroot
|
2022-02-06 21:00:45 +00:00
|
|
|
RUN curl https://download-ib01.fedoraproject.org/pub/fedora/linux/updates/${FROMFEDORA}/Everything/SRPMS/Packages/m/${PACKAGE}-${VERSION}.fc${FROMFEDORA}.src.rpm -o /tmp/package.src.rpm && \
|
|
|
|
rpmbuild --rebuild /tmp/package.src.rpm
|
2022-02-05 17:12:29 +00:00
|
|
|
EOF
|
|
|
|
|
2022-02-06 21:00:45 +00:00
|
|
|
${DOCKER} create -ti --name docker-${PACKAGE}-xfer docker-${PACKAGE}-build bash
|
|
|
|
${DOCKER} cp docker-${PACKAGE}-xfer:/home/dontbuildasroot/rpmbuild/RPMS/${ARCH}/${PACKAGE}-${VERSION}.el8.${ARCH}.rpm ./files/
|
|
|
|
${DOCKER} rm -fv docker-${PACKAGE}-xfer
|
|
|
|
${DOCKER} rmi -f docker-${PACKAGE}-build
|