create debian package framework and git action job

This commit is contained in:
cosmicpsyop
2023-12-17 19:50:27 -08:00
parent cec2ba9006
commit b02740d6cc
10 changed files with 165 additions and 0 deletions

47
.github/workflows/ubuntu.yml vendored Normal file
View File

@ -0,0 +1,47 @@
name: ubuntu
on: [push, pull_request]
jobs:
ubuntu:
runs-on: ubuntu-latest
name: A job to build and run strfry on Ubuntu
steps:
- name: Checkout strfry
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build strfry
run: |
sudo apt update && sudo apt install -y --no-install-recommends \
git g++ make pkg-config libtool ca-certificates \
libyaml-perl libtemplate-perl libregexp-grammars-perl libssl-dev zlib1g-dev \
liblmdb-dev libflatbuffers-dev libsecp256k1-dev libzstd-dev
git submodule update --init
make setup-golpe
make -j4
if ! [ -f ./strfry ]; then
echo "Strfry build failed."
exit 1
fi
- name: Package strfry
run: |
sudo apt-get install debhelper devscripts -y
dpkg-buildpackage --build=binary -us -uc
mv ../*.deb .
filename=`ls *.deb | grep -v -- -dbgsym`
echo "filename=$filename" >> $GITHUB_ENV
- name: Upload strfry deb
uses: actions/upload-artifact@v3
with:
name: ${{ env.filename }}
path: ${{ env.filename }}
- name: Run strfry
run: |
cat /etc/os-release
sudo ./strfry relay &

6
debian/changelog vendored Normal file
View File

@ -0,0 +1,6 @@
strfry (0.9.6-1) unstable; urgency=low
* Initial ubuntu test release
-- Doug Hoytech <doug@hoytech.com> Fri, 22 Sep 2023 17:32:21 +0800

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
11

13
debian/control vendored Normal file
View File

@ -0,0 +1,13 @@
Source: strfry
Section: admin
Priority: optional
Maintainer: Doug Hoytech <doug@hoytech.com>
Build-Depends: debhelper (>= 8.0.0)
Package: strfry
Architecture: amd64
Depends: ${shlibs:Depends}
Conflicts:
Replaces:
Provides: strfry
Description: strfry is a relay for the nostr protocol

22
debian/copyright vendored Normal file
View File

@ -0,0 +1,22 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: strfry
Upstream-Contact: Doug Hoytech <doug@hoytech.com>
Source: https://github.com/hoytech/strfry
Files: *
Copyright: 2023 Doug Hoytech
License: GPL-3
License: GPL-3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.

21
debian/postinst vendored Normal file
View File

@ -0,0 +1,21 @@
#!/bin/sh
set -e
if ! getent group strfry >/dev/null 2>&1; then
addgroup --system --quiet strfry
fi
if ! getent passwd strfry >/dev/null 2>&1; then
adduser --system --quiet --ingroup strfry \
--no-create-home --home /nonexistent \
strfry
fi
if [ "$1" = "configure" ] ; then
chown strfry:strfry /etc/strfry.conf
chown strfry:strfry /var/lib/strfry
systemctl daemon-reload
systemctl enable strfry.service
systemctl start strfry
fi

12
debian/postrm vendored Normal file
View File

@ -0,0 +1,12 @@
#!/bin/sh
set -e
if [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
systemctl --system daemon-reload >/dev/null || true
fi
if [ "$1" = "purge" ]; then
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper purge 'strfry.service' >/dev/null || true
fi
fi

12
debian/prerm vendored Normal file
View File

@ -0,0 +1,12 @@
#!/bin/sh
set -e
if [ "$1" = "remove" ]; then
systemctl stop strfry
systemctl disable strfry
fi
if [ "$1" = "upgrade" ]; then
systemctl stop strfry
fi

15
debian/rules vendored Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/make -f
#export DH_VERBOSE=1
%:
dh $@ --parallel
override_dh_auto_clean:
override_dh_auto_install:
mkdir -p debian/strfry/usr/bin/
mkdir -p debian/strfry/etc/
mkdir -p debian/strfry/var/lib/strfry/
cp -a strfry debian/strfry/usr/bin/.
cp -a strfry.conf debian/strfry/etc/.
sed -i 's|./strfry-db/|/var/lib/strfry/|g' debian/strfry/etc/strfry.conf

16
debian/strfry.service vendored Normal file
View File

@ -0,0 +1,16 @@
[Unit]
Description=strfry relay service
After=syslog.target network.target
[Service]
User=strfry
ExecStart=/usr/bin/strfry relay
Restart=on-failure
RestartSec=5
ProtectHome=yes
NoNewPrivileges=yes
ProtectSystem=full
LimitCORE=1000000000
[Install]
WantedBy=multi-user.target