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() {
|
2022-02-20 23:33:43 +01:00
|
|
|
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(){
|
2022-02-20 23:33:43 +01:00
|
|
|
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
|
|
|
}
|