This commit is contained in:
parent
a18fa88e50
commit
b2bc0c410d
3 changed files with 79 additions and 0 deletions
50
.forgejo/workflows/build.yaml
Normal file
50
.forgejo/workflows/build.yaml
Normal file
|
@ -0,0 +1,50 @@
|
|||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: debian:bookworm
|
||||
|
||||
steps:
|
||||
- run: |-
|
||||
apt update
|
||||
apt install -y nodejs git curl make libglib2.0-dev libdbi-dev libtalloc-dev libtevent-dev nettle-dev
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- run: make
|
||||
|
||||
- name: Build Debian package
|
||||
run: |-
|
||||
mkdir -p deb/DEBIAN
|
||||
cat <<EOF | tee deb/DEBIAN/control
|
||||
Package: siahsd
|
||||
Version: 0.$(date --date="@$(git show -s --format='%ct' HEAD)" '+%4Y%m%d.%H%M%S')
|
||||
Section: base
|
||||
Priority: optional
|
||||
Architecture: amd64
|
||||
Maintainer: polyfloyd <floy@polyfloyd.net>, Wilco Baan Hofman <wilco@baanhofman.nl>
|
||||
Description: SIA-HS daemon
|
||||
Depends: libglib2.0-0 libdbi1 libtalloc2 libnettle8 libtevent0
|
||||
EOF
|
||||
cp -v support/postinst deb/DEBIAN/postinst
|
||||
|
||||
install -D -m 0755 build/siahsd deb/usr/bin/siahsd
|
||||
install -D support/systemd.service deb/lib/systemd/system/siahsd.service
|
||||
install -D siahsd.conf deb/etc/siahsd.conf
|
||||
|
||||
dpkg-deb --build deb siahsd.deb
|
||||
|
||||
- name: Deploy Debian package
|
||||
run: |-
|
||||
curl \
|
||||
--fail \
|
||||
--user ${{ secrets.PKG_RELEASE_CREDENTIALS }} \
|
||||
--upload-file siahsd.deb \
|
||||
$GITHUB_SERVER_URL/api/packages/$GITHUB_REPOSITORY_OWNER/debian/pool/stable/main/upload
|
14
support/postinst
Executable file
14
support/postinst
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
if ! id -u siahsd >/dev/null 2>&1; then
|
||||
useradd \
|
||||
--no-user-group \
|
||||
--system \
|
||||
--create-home \
|
||||
--home-dir /var/lib/siahsd \
|
||||
--shell /usr/sbin/nologin siahsd \
|
||||
fi
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl restart siahsd.service
|
||||
systemctl enable siahsd.service
|
15
support/systemd.service
Normal file
15
support/systemd.service
Normal file
|
@ -0,0 +1,15 @@
|
|||
[Unit]
|
||||
Description=SIA-HS daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
PIDFile=/var/lib/siahsd/siahsd.pid
|
||||
Restart=always
|
||||
RestartSec=10s
|
||||
ExecStartPre=-/bin/rm /var/lib/siahsd/siahsd.pid
|
||||
ExecStart=/usr/bin/siahsd
|
||||
User=siahsd
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Add table
Add a link
Reference in a new issue