package-pipelines-miscellan.../keycloak-25/build.sh
s3lph b558446308
Some checks failed
/ ansible-semaphore (push) Failing after 15s
/ atlasswprobe (push) Successful in 4m10s
/ daliserver (push) Successful in 2m19s
/ forgejo (push) Has been cancelled
/ forgejo-runner (push) Successful in 1m39s
/ http-mqtt-bridge (push) Successful in 5m6s
/ keycloak-24 (push) Has been cancelled
/ keycloak-25 (push) Has been cancelled
/ linux-diversion-ath-regd-optional (push) Has been cancelled
/ lottieconverter (push) Successful in 1m6s
/ matterbridge (push) Successful in 4m3s
/ matrix-element-web (push) Failing after 51s
/ matrix-hydrogen (push) Successful in 1m24s
/ matrix.to (push) Has been cancelled
/ maubot (push) Has been cancelled
/ maubot-plugin-spaceapi (push) Successful in 2m16s
/ maubot-plugin-ultimaker (push) Successful in 2m16s
/ mautrix-signal (push) Successful in 51s
/ mautrix-telegram (push) Has been cancelled
/ mediawiki-extension-auth-remoteuser (push) Has been cancelled
/ mediawiki-extension-nativesvghandler (push) Has been cancelled
/ mediawiki-extension-openidconnect (push) Has been cancelled
/ mediawiki-extension-pluggableauth (push) Has been cancelled
/ mqtt2prometheus (push) Has been cancelled
/ prometheus-ipmi-exporter (push) Has been cancelled
/ prometheus-dnsbl-exporter (push) Has been cancelled
/ prometheus2influxdb (push) Has been cancelled
/ python3-mautrix (push) Has been cancelled
/ python3-telethon (push) Has been cancelled
/ repo.s3lph.me-apt-source (push) Has been cancelled
/ republik-feeder (push) Has been cancelled
/ woodpecker-agent (push) Has been cancelled
/ woodpecker-cli (push) Has been cancelled
chore: keycloak-25
2024-06-10 22:53:37 +02:00

68 lines
2.2 KiB
Bash
Executable file

#!/bin/bash
set -exo pipefail
. ../.skel/helpers.sh
MAJOR_VERSION=25
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