debmaker/ressources/mautrix-whatsapp/debmaker

48 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
VERSION=0.3.0
RELEASE=1
[ -e ./lib/function.sh ] && source ./lib/function.sh
APP=mautrix-whatsapp
DEPOT=https://github.com/mautrix/whatsapp.git
GIT_VERSION=v${VERSION}
DEB_VERSION=${VERSION}-${RELEASE}
DEBIAN_VERSION_CODENAME=bullseye
IMAGE_SIZE=4
STEP="envinit prebuild build makedeb"
envinit() {
if [ $(dpkg -l | grep -e 'ii libolm3 ' | wc -l) -eq 1 ];
then
apt-get update
apt-get dist-upgrade -y
else
apt install -y --no-install-recommends wget fakeroot dpkg ca-certificates git libolm3 libolm-dev build-essential
wget -qO - https://go.dev/dl/go1.17.7.linux-amd64.tar.gz | tar -C /usr/local -xz
fi
}
prebuild(){
[ -e /tmp/git ] && rm -fr /tmp/git
[ -e /tmp/${APP} ] || mkdir /tmp/${APP}
git clone --depth 1 -b ${GIT_VERSION} ${DEPOT} /tmp/git
cp -r /tmp/git/. /tmp/${APP}
}
build() {
cd /tmp/${APP}/
PATH=$PATH:/usr/local/go/bin ./build.sh
}
makedeb(){
PATH_DEB=/tmp/src/rootfs
cp /tmp/mautrix-whatsapp/mautrix-whatsapp ${PATH_DEB}/usr/lib/mautrix-whatsapp/mautrix-whatsapp
cp /tmp/mautrix-whatsapp/example-config.yaml ${PATH_DEB}/etc/mautrix-whatsapp/config.yaml
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
}