debmaker/ressources/mautrix-wsproxy/mautrix-wsproxy

40 lines
984 B
Bash
Executable File

#!/bin/bash
[ -e ./lib/function.sh ] && source ./lib/function.sh
APP=mautrix-wsproxy
VERSION=1.0.0
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/wsproxy.git /tmp/mautrix-wsproxy
}
build() {
cd /tmp/mautrix-wsproxy/
PATH=$PATH:/usr/local/go/bin
go build -o mautrix-wsproxy
}
makedeb(){
GIT_VERSION=$1
DEB_VERSION=$2
PATH_DEB=/tmp/src/rootfs
cp /tmp/mautrix-wsproxy/mautrix-wsproxy ${PATH_DEB}/usr/bin/mautrix-wsproxy
cp /tmp/mautrix-wsproxy/example-config.yaml ${PATH_DEB}/etc/mautrix-wsproxy.yaml
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
}