s3lph
4fe6ccd91c
Some checks failed
/ ansible-semaphore (push) Successful in 2m43s
/ atlasswprobe (push) Successful in 4m0s
/ daliserver (push) Successful in 2m14s
/ forgejo (push) Successful in 5m56s
/ forgejo-runner (push) Successful in 1m27s
/ http-mqtt-bridge (push) Successful in 4m50s
/ keycloak-23 (push) Successful in 10m5s
/ linux-diversion-ath-regd-optional (push) Successful in 18m51s
/ lottieconverter (push) Successful in 52s
/ matterbridge (push) Successful in 3m31s
/ matrix-element-web (push) Successful in 3m52s
/ matrix-hydrogen (push) Successful in 1m11s
/ matrix.to (push) Successful in 6m19s
/ maubot (push) Successful in 10m47s
/ maubot-plugin-spaceapi (push) Successful in 2m5s
/ maubot-plugin-ultimaker (push) Successful in 1m55s
/ mautrix-signal (push) Successful in 1m7s
/ mautrix-telegram (push) Successful in 51s
/ mediawiki-extension-auth-remoteuser (push) Successful in 1m2s
/ mediawiki-extension-nativesvghandler (push) Successful in 1m0s
/ mediawiki-extension-openidconnect (push) Successful in 1m29s
/ mediawiki-extension-pluggableauth (push) Successful in 40s
/ mqtt2prometheus (push) Successful in 4m47s
/ mumble-web (push) Successful in 53s
/ mumble-web-data (push) Failing after 7m37s
/ mumble-web-proxy (push) Failing after 6m47s
/ prometheus-ipmi-exporter (push) Successful in 1m1s
/ prometheus-dnsbl-exporter (push) Successful in 1m33s
/ prometheus2influxdb (push) Successful in 53s
/ python3-mautrix (push) Successful in 1m11s
/ python3-telethon (push) Successful in 47s
/ repo.s3lph.me-apt-source (push) Successful in 47s
/ republik-feeder (push) Successful in 1m11s
/ woodpecker-agent (push) Successful in 2m50s
/ woodpecker-cli (push) Successful in 1m10s
62 lines
2.2 KiB
Bash
Executable file
62 lines
2.2 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
set -exo pipefail
|
|
|
|
API_URL=https://codeberg.org/api/v1/repos/forgejo/forgejo/releases
|
|
JQ_EXPR='.[] | select( .prerelease==false and .draft==false and (.tag_name|test("^v[0-9.-]+$")) ) | "\(.name[1:]) \(.published_at) \(.assets[] | select(.name|test(".*-linux-amd64.xz$")).browser_download_url )"'
|
|
|
|
ROOT=$(pwd)
|
|
function fetch() {
|
|
cd "${SRCDIR}"
|
|
wget "${URL}" --output-document "forgejo-${VERSION}-linux-amd64.xz"
|
|
xz --decompress "forgejo-${VERSION}-linux-amd64.xz"
|
|
}
|
|
|
|
function prepare() {
|
|
chmod +x "${SRCDIR}/forgejo-${VERSION}-linux-amd64"
|
|
mkdir -p \
|
|
"${PKGDIR}/DEBIAN" \
|
|
"${PKGDIR}/usr/bin" \
|
|
"${PKGDIR}/etc/gitea" \
|
|
"${PKGDIR}/var/lib/gitea/custom" \
|
|
"${PKGDIR}/var/lib/gitea/data" \
|
|
"${PKGDIR}/var/lib/gitea/log" \
|
|
"${PKGDIR}/var/lib/gitea/gitea-repositories" \
|
|
"${PKGDIR}/lib/systemd/system"
|
|
cp "${SRCDIR}/forgejo-${VERSION}-linux-amd64" "${PKGDIR}/usr/bin/forgejo"
|
|
cp "${ROOT}/gitea.service" "${PKGDIR}/lib/systemd/system/gitea.service"
|
|
cp "${ROOT}/debian.control" "${PKGDIR}/DEBIAN/control"
|
|
cp "${ROOT}/debian.conffiles" "${PKGDIR}/DEBIAN/conffiles"
|
|
cp "${ROOT}/debian.postinst" "${PKGDIR}/DEBIAN/postinst"
|
|
cp "${ROOT}/debian.prerm" "${PKGDIR}/DEBIAN/prerm"
|
|
cp "${ROOT}/debian.postrm" "${PKGDIR}/DEBIAN/postrm"
|
|
cp "${ROOT}/app.ini" "${PKGDIR}/etc/gitea/app.ini"
|
|
sed -re "s/__VERSION__/${VERSION}/g" -i "${PKGDIR}/DEBIAN/control"
|
|
sed -re "s/__MAINTAINER__/${MAINTAINER}/g" -i "${PKGDIR}/DEBIAN/control"
|
|
ln -s gitea.service "${PKGDIR}/lib/systemd/system/forgejo.service"
|
|
ln -s gitea "${PKGDIR}/etc/forgejo"
|
|
find "${PKGDIR}" -exec touch -m -d "${ISODATE}" {} \;
|
|
}
|
|
|
|
function package() {
|
|
cd "${BUILDDIR}"
|
|
dpkg-deb --build "${PKGDIR}" "${BUILDDIR}"
|
|
}
|
|
|
|
function build() {
|
|
read VERSION ISODATE URL <<<$(curl "${API_URL}" | jq -r "${JQ_EXPR}" | head -1)
|
|
# Replace Forgejo patch level separater - with . to be Debian versioning compatible, and add epoch number 2
|
|
export VERSION="2:${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
|