Add mautrix-syncproxy and mautrix-wsproxy

This commit is contained in:
thomas 2022-02-26 04:53:01 +01:00
parent eaba9effe3
commit 51bcd703d6
18 changed files with 185 additions and 5 deletions

View file

@ -0,0 +1,30 @@
#!/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/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
}

View file

@ -0,0 +1 @@
/etc/mautrix-wsproxy.yaml

View file

@ -0,0 +1,7 @@
Package: mautrix-wsproxy
Version: %VERSION%
Section: base
Priority: optional
Architecture: all
Maintainer: Thomas Legay <thomas@syngate.fr>
Description: mautrix-wsproxy

View file

@ -0,0 +1,4 @@
#!/bin/bash
id mautrix-wsproxy &> /dev/null || useradd mautrix-wsproxy -r -s /bin/false -d /

View file

@ -0,0 +1,17 @@
[Unit]
Description=wsproxy
Documentation=https://github.com/mautrix/wsproxy
After=network.target
[Service]
User=mautrix-wsproxy
Group=mautrix-wsproxy
ExecStart=/usr/bin/mautrix-wsproxy --config /etc/mautrix-wsproxy.yaml
WorkingDirectory=/tmp
Restart=on-failure
RestartSec=60
[Install]
WantedBy=multi-user.target