Add gotify

optimize apt without recommends packages
add package dpkg fakeroot when needed
This commit is contained in:
thomas 2022-02-20 23:33:43 +01:00
parent a340b7db22
commit b69d1ee47f
29 changed files with 77 additions and 94 deletions

View file

@ -3,7 +3,7 @@
STEP="envinit prebuild build makedeb"
envinit() {
apt install -y build-essential git wget ca-certificates
apt install -y --no-install-recommends build-essential git wget ca-certificates dpkg fakeroot
wget -qO - https://deb.nodesource.com/setup_16.x | bash
wget -qO - https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor > /usr/share/keyrings/yarnkey.gpg
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" > /etc/apt/sources.list.d/yarn.list
@ -14,9 +14,7 @@ envinit() {
prebuild(){
GIT_VERSION=$1
git clone https://github.com/gotify/server.git /tmp/server
cd /tmp/server/
git checkout ${GIT_VERSION}
git clone --depth 1 -b ${GIT_VERSION} https://github.com/gotify/server.git /tmp/server
}
build() {
@ -33,8 +31,10 @@ build() {
makedeb(){
GIT_VERSION=$1
DEB_VERSION=$2
cp /tmp/server/gotify-server /tmp/dist/rootfs/usr/bin/gotify-server
cp /tmp/server/config.example.yml /tmp/dist/rootfs/etc/gotify/config.yml
sed -i "s/%VERSION%/$DEB_VERSION/" /tmp/dist/rootfs/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build /tmp/dist/rootfs/ /tmp/dist/
PATH_DEB=/tmp/dist/rootfs
cp /tmp/server/gotify-server ${PATH_DEB}/usr/bin/
cp /tmp/server/config.example.yml ${PATH_DEB}/etc/gotify/config.yml
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB}/ /tmp/dist/
}

View file

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

View file

@ -1,4 +1,4 @@
#!/bin/bash
id gotify &> /dev/null || useradd gotify -r -s /bin/false
id gotify &> /dev/null || useradd gotify -r -s /bin/false -md /var/lib/gotify

View file

@ -6,8 +6,8 @@ After=network.target
[Service]
User=gotify
Group=gotify
ExecStart=/usr/bin/gotify-linux-amd64
WorkingDirectory=/usr/lib/gotify
ExecStart=/usr/bin/gotify-server
WorkingDirectory=/var/lib/gotify-server
[Install]
WantedBy=multi-user.target