debmaker/ressources/mautrix-syncproxy/mautrix-syncproxy

29 lines
737 B
Bash
Executable file

#!/bin/bash
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
}