debmaker/ressources/mautrix-whatsapp/mautrix-whatsapp

30 lines
824 B
Plaintext
Raw Normal View History

2022-02-12 18:30:28 +01:00
#!/bin/bash
2022-02-20 15:02:18 +01:00
STEP="envinit prebuild build makedeb"
2022-02-12 18:30:28 +01:00
envinit() {
apt install -y --no-install-recommends ca-certificates git libolm3 libolm-dev build-essential wget
2022-02-20 15:02:18 +01:00
wget -qO - https://go.dev/dl/go1.17.7.linux-amd64.tar.gz | tar -C /usr/local -xz
2022-02-12 18:30:28 +01:00
}
prebuild(){
GIT_VERSION=$1
git clone --depth 1 -b ${GIT_VERSION} https://github.com/mautrix/whatsapp.git /tmp/whatsapp
2022-02-12 18:30:28 +01:00
}
build() {
cd /tmp/whatsapp/
PATH=$PATH:/usr/local/go/bin ./build.sh
}
makedeb(){
2022-02-20 15:02:18 +01:00
GIT_VERSION=$1
DEB_VERSION=$2
PATH_DEB=/tmp/dist/rootfs
2022-02-12 18:30:28 +01:00
2022-02-20 15:02:18 +01:00
cp /tmp/whatsapp/mautrix-whatsapp ${PATH_DEB}/usr/lib/mautrix-whatsapp/mautrix-whatsapp
cp /tmp/whatsapp/example-config.yaml ${PATH_DEB}/etc/mautrix-whatsapp/config.yaml
sed -i "s/%VERSION%/$DEB_VERSION/" /tmp/dist/rootfs/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build /tmp/dist/rootfs/ /tmp/dist/
2022-02-12 18:30:28 +01:00
}