update dendrite

This commit is contained in:
leafee98 2023-06-30 22:06:04 +08:00
parent c1b9fb3617
commit 8b40e3764b
2 changed files with 3 additions and 126 deletions

View file

@ -2,7 +2,7 @@
pkgname="dendrite" pkgname="dendrite"
pkgrel=1 pkgrel=1
pkgver="0.12.0" pkgver="0.13.0"
pkgdesc="Dendrite is a second-generation Matrix homeserver written in Go!" pkgdesc="Dendrite is a second-generation Matrix homeserver written in Go!"
url="https://github.com/matrix-org/dendrite" url="https://github.com/matrix-org/dendrite"
maintainer="Leafee98 <me@leafee98.com>" maintainer="Leafee98 <me@leafee98.com>"
@ -14,7 +14,7 @@ source=(
function build { function build {
( (
cd "${srcdir}/dendrite" cd "${srcdir}/dendrite"
bash build.sh go build -o bin/ ./cmd/...
) )
} }
@ -24,6 +24,5 @@ function package {
install -Dm755 -t "${pkgdir}/usr/local/lib/dendrite/" "$f"; install -Dm755 -t "${pkgdir}/usr/local/lib/dendrite/" "$f";
done done
# install -Dm755 --target-directory "${pkgdir}/usr/local/lib/dendrite/" ${srcdir}/dendrite/bin/* install -Dm644 "${srcdir}/dendrite/dendrite-sample.yaml" "${pkgdir}/etc/dendrite/dendrite-sample.yaml"
# install -Dm644 "${srcdir}/dufs.service" "${pkgdir}/usr/lib/systemd/system/dufs.service"
} }

View file

@ -1,122 +0,0 @@
#!/bin/bash
GIT_URL="https://github.com/matrix-org/dendrite.git"
SCRIPT_PATH=$(dirname $(realpath $0))
REPO_DIR="${SCRIPT_PATH}/repo"
PACK_DIR="${SCRIPT_PATH}/package"
BUILD_DIR="$REPO_DIR/bin"
ROOTFS="${SCRIPT_PATH}/rootfs"
TARGET_TAG=""
ACTION="initialze"
function err_occur {
echo "Error occurred in $ACTION"
}
trap err_occur ERR
set -o errexit
set -o errtrace
function usage()
{
echo "$0 usage:"
echo " -b the build release number"
echo " -t specify the tag to build, instead of the latest one"
}
BUILD_REL=""
while getopts ":b:t:" arg
do
case "$arg" in
b)
BUILD_REL="$OPTARG"
;;
t)
TARGET_TAG="$OPTARG"
;;
*)
usage
exit 1
;;
esac
done
function download()
{
ACTION="download"
echo "downloading/update sources..."
if [ ! -d "$REPO_DIR" ]
then
git clone "$GIT_URL" "$REPO_DIR"
else
git -C "$REPO_DIR" fetch --all
fi
}
function switch_tag()
{
ACTION="switch tag"
if [ -z "$TARGET_TAG" ]
then
TARGET_TAG=$(git -C "$REPO_DIR" tag --sort=-version:refname --list 'v*' | head -n 1)
fi
echo "switching to tag: $TARGET_TAG"
git -C "$REPO_DIR" switch --force-create build "$TARGET_TAG"
echo "cleaning workspace..."
git -C "$REPO_DIR" clean --force -xd
}
function build()
{
ACTION="build"
echo "building the program..."
cd "$REPO_DIR"
bash build.sh
}
function package()
{
ACTION="package"
echo "packaging the binaries..."
rm -rf "$ROOTFS"/*
install -D -t $ROOTFS/usr/local/lib/dendrite $BUILD_DIR/*
install -D -t $ROOTFS/etc/dendrite $REPO_DIR/dendrite-sample.yaml
export VERSION=$($BUILD_DIR/dendrite --version)
if [ -n "${BUILD_REL}" ]
then
VERSION=$VERSION-brel$BUILD_REL
fi
mkdir -p $ROOTFS/DEBIAN
sed "s/+++VERSION+++/${VERSION}/" > $ROOTFS/DEBIAN/control << EOF
Package: dendrite
Version: +++VERSION+++
Priority: optional
Architecture: all
Maintainer: leafee98 <me@leafee98.com>
Description: Dendrite is a second-generation Matrix homeserver written in Go!
Dendrite is a second-generation Matrix homeserver written in Go. It intends to provide an efficient, reliable and scalable alternative to Synapse.
EOF
mkdir -p "$PACK_DIR"
dpkg-deb --build --root-owner-group $ROOTFS $PACK_DIR/dendrite-$VERSION.deb
}
download
switch_tag
build
package