Fix flame package

upgrade version of adguardhome element-web mautrix-whatsapp
use new debian packaging process for mautrix-whatsapp
This commit is contained in:
thomas 2022-04-19 01:23:36 +02:00
parent 8817ddba0a
commit 6148b1fa75
17 changed files with 32 additions and 91 deletions

View file

@ -1,47 +1,35 @@
#!/bin/bash
VERSION=0.3.0
RELEASE=1
VERSION=0.3.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"
STEP="envinit prebuild 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
echo deb http://deb.debian.org/debian bullseye-backports main > /etc/apt/sources.list.d/backports.list
apt-get update
apt-get dist-upgrade -y
apt install -y --no-install-recommends ca-certificates git libolm-dev debhelper-compat build-essential
apt install -y --no-install-recommends -t bullseye-backports golang
}
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
rm /tmp/*.deb
[ -e /tmp/${APP}] && rm -fr /tmp/${APP}
mkdir /tmp/${APP}
git clone --depth 1 -b ${GIT_VERSION} ${DEPOT} /tmp/${APP}
cp -fr /tmp/src/debian /tmp/${APP}
}
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
cd /tmp/${APP}/
dpkg-buildpackage -us -uc
cp /tmp/*.deb /tmp/dist
}

View file

@ -1 +0,0 @@
/etc/mautrix-whatsapp/config.yaml

View file

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

View file

@ -1,4 +0,0 @@
#!/bin/bash
id mautrix-whatsapp &> /dev/null || useradd mautrix-whatsapp -r -s /bin/false -md /var/lib/mautrix-whatsapp
chown mautrix-whatsapp:mautrix-whatsapp /etc/mautrix-whatsapp/

View file

@ -1,35 +0,0 @@
[Unit]
Description=mautrix-whatsapp bridge
[Service]
Type=exec
User=mautrix-whatsapp
WorkingDirectory=/var/lib/mautrix-whatsapp
ExecStart=/usr/lib/mautrix-whatsapp/mautrix-whatsapp -c /etc/mautrix-whatsapp/config.yaml
Restart=on-failure
RestartSec=30s
# Optional hardening to improve security
ReadWritePaths=/var/lib/mautrix-whatsapp /etc/mautrix-whatsapp
NoNewPrivileges=yes
MemoryDenyWriteExecute=true
PrivateDevices=yes
PrivateTmp=yes
ProtectHome=yes
ProtectSystem=strict
ProtectControlGroups=true
RestrictSUIDSGID=true
RestrictRealtime=true
LockPersonality=true
ProtectKernelLogs=true
ProtectKernelTunables=true
ProtectHostname=true
ProtectKernelModules=true
PrivateUsers=true
ProtectClock=true
SystemCallArchitectures=native
SystemCallErrorNumber=EPERM
SystemCallFilter=@system-service
[Install]
WantedBy=multi-user.target