package-pipelines-miscellan.../keycloak-26/build.sh
s3lph cdf3074fbb
Some checks failed
/ ansible-semaphore (push) Successful in 2m0s
/ daliserver (push) Successful in 1m50s
/ forgejo (push) Successful in 3m37s
/ forgejo-runner (push) Successful in 1m23s
/ http-mqtt-bridge (push) Successful in 3m13s
/ keycloak-25 (push) Successful in 4m7s
/ keycloak-26 (push) Successful in 4m50s
/ linux-diversion-ath-regd-optional (push) Successful in 13m44s
/ lottieconverter (push) Successful in 54s
/ matterbridge (push) Successful in 2m24s
/ matrix-element-web (push) Successful in 2m33s
/ matrix-hydrogen (push) Successful in 1m11s
/ matrix.to (push) Successful in 4m7s
/ maubot (push) Successful in 6m40s
/ maubot-plugin-spaceapi (push) Successful in 1m20s
/ maubot-plugin-ultimaker (push) Successful in 1m34s
/ mautrix-signal (push) Successful in 1m3s
/ mautrix-telegram (push) Successful in 1m4s
/ mediawiki-extension-auth-remoteuser (push) Successful in 39s
/ mediawiki-extension-nativesvghandler (push) Successful in 35s
/ mediawiki-extension-openidconnect (push) Successful in 28s
/ mediawiki-extension-pluggableauth (push) Successful in 1m7s
/ mqtt2prometheus (push) Successful in 3m0s
/ prometheus-ipmi-exporter (push) Successful in 1m43s
/ prometheus-dnsbl-exporter (push) Successful in 1m30s
/ prometheus2influxdb (push) Successful in 52s
/ python3-mautrix (push) Successful in 1m10s
/ python3-telethon (push) Successful in 1m4s
/ repo.s3lph.me-apt-source (push) Successful in 42s
/ republik-feeder (push) Successful in 1m4s
/ ripe-atlas (push) Failing after 2m56s
/ woodpecker-agent (push) Successful in 1m35s
/ woodpecker-cli (push) Successful in 1m22s
chore: keycloak-26
2024-10-04 10:20:40 +02:00

68 lines
2.2 KiB
Bash
Executable file

#!/bin/bash
set -exo pipefail
. ../.skel/helpers.sh
MAJOR_VERSION=26
export PKGNAME="keycloak-${MAJOR_VERSION}"
API_URL="https://api.github.com/repos/keycloak/keycloak/releases"
JQ_EXPR='.[] | select( .prerelease==false and .draft==false and .target_commitish=="main" ) | "\(.name) \(.published_at) \(.assets[] | select( .name|test("keycloak-'${MAJOR_VERSION}'.*.tar.gz$") ).browser_download_url)"'
ROOT=$(pwd)
function fetch() {
cd "${SRCDIR}"
wget "${URL}" --output-document "keycloak-${VERSION}.tar.gz"
tar -xf "keycloak-${VERSION}.tar.gz"
}
function prepare() {
mkdir -p \
"${PKGDIR}/DEBIAN" \
"${PKGDIR}/opt/" \
"${PKGDIR}/lib/systemd/system" \
"${PKGDIR}/etc/apache2/sites-available" \
"${PKGDIR}/usr/share/doc/${PKGNAME}"
cp -r "${SRCDIR}/keycloak-${VERSION}" "${PKGDIR}/opt/keycloak/"
mv "${PKGDIR}/opt/keycloak/conf" "${PKGDIR}/etc/keycloak/"
ln -s /etc/keycloak "${PKGDIR}/opt/keycloak/conf"
mkdir -p \
"${PKGDIR}/opt/keycloak/data" \
"${PKGDIR}/opt/keycloak/ObjectStore"
rm "${PKGDIR}/opt/keycloak/bin/kc.bat" \
"${PKGDIR}/etc/keycloak/README.md"
cp "${ROOT}/debian.control" "${PKGDIR}/DEBIAN/control"
cp "${ROOT}/debian.conffiles" "${PKGDIR}/DEBIAN/conffiles"
cp "${ROOT}/debian.postinst" "${PKGDIR}/DEBIAN/postinst"
cp "${ROOT}/keycloak.service" "${PKGDIR}/lib/systemd/system/"
cp "${ROOT}/keycloak.site.conf" "${PKGDIR}/etc/apache2/sites-available/"
sed -re "s/__VERSION__/${VERSION}/g" -i "${PKGDIR}/DEBIAN/control"
sed -re "s/__MAINTAINER__/${MAINTAINER}/g" -i "${PKGDIR}/DEBIAN/control"
cp "${ROOT}/debian.copyright" "${PKGDIR}/usr/share/doc/${PKGNAME}/copyright"
github_changelog keycloak/keycloak
find "${PKGDIR}" -exec touch -m --reference "${SRCDIR}/keycloak-${VERSION}/version.txt" {} \;
}
function package() {
cd "${BUILDDIR}"
dpkg-deb --build "${PKGDIR}" "${BUILDDIR}"
}
function build() {
read VERSION ISODATE URL <<<$(curl "${API_URL}" | jq -r "${JQ_EXPR}" | head -1)
export VERSION
export ISODATE
export URL
export BUILDDIR=${ROOT}/build
export SRCDIR=${ROOT}/build/srcdir
export PKGDIR=${ROOT}/build/pkgdir
mkdir -p ${SRCDIR} ${PKGDIR}
fetch
prepare
package
}
build