debmaker/ressources/mautrix-syncproxy/mautrix-syncproxy

39 lines
918 B
Bash
Executable File

#!/bin/bash
[ -e ./lib/function.sh ] && source ./lib/function.sh
APP=mautrix-syncproxy
VERSION=0.0.1
GIT_VERSION=$VERSION
DEB_VERSION=$VERSION-1
DEBIAN_VERSION_CODENAME=bullseye
IMAGE_SIZE=2
STEP="envinit prebuild build makedeb"
envinit() {
apt install -y --no-install-recommends build-essential git wget ca-certificates dpkg fakeroot
wget -qO - https://go.dev/dl/go1.17.7.linux-amd64.tar.gz | tar -C /usr/local -xz
}
prebuild(){
GIT_VERSION=$1
git clone --depth 1 https://github.com/mautrix/syncproxy.git /tmp/mautrix-syncproxy
}
build() {
cd /tmp/mautrix-syncproxy/
PATH=$PATH:/usr/local/go/bin
go build -o mautrix-syncproxy
}
makedeb(){
GIT_VERSION=$1
DEB_VERSION=$2
PATH_DEB=/tmp/src/rootfs
cp /tmp/mautrix-syncproxy/mautrix-syncproxy ${PATH_DEB}/usr/bin/mautrix-syncproxy
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
}