From c1b9fb36173f46abb342dbdc3d33a1443a3be6e6 Mon Sep 17 00:00:00 2001 From: leafee98 Date: Fri, 30 Jun 2023 22:02:31 +0800 Subject: [PATCH] add package plik-bin --- plik-bin/DEBBUILD | 34 ++++++++++++++++++++++++++++++++ plik-bin/materials/plikd.service | 16 +++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 plik-bin/DEBBUILD create mode 100644 plik-bin/materials/plikd.service diff --git a/plik-bin/DEBBUILD b/plik-bin/DEBBUILD new file mode 100644 index 0000000..bb1a11b --- /dev/null +++ b/plik-bin/DEBBUILD @@ -0,0 +1,34 @@ +#/usr/bin/env bash + +pkgname="plik-bin" +pkgrel=2 +pkgver="1.3.7" +pkgdesc="Plik is a temporary file upload system (Wetransfer like) in Go." +_arch="amd64" +url="https://github.com/root-gg/plik/" +maintainer="Leafee98 " + +_pkgname_base="plik-${pkgver}-linux-${_arch}" +_pkgname="${_pkgname_base}.tar.gz" +source=( + "${_pkgname}::https://github.com/root-gg/plik/releases/download/1.3.7/${_pkgname}" + "plikd.service::materials/plikd.service" +) + +function package { + install -Dm755 ${srcdir}/${_pkgname_base}/server/plikd ${pkgdir}/usr/bin/plikd + install -Dm644 ${srcdir}/${_pkgname_base}/server/plikd.cfg ${pkgdir}/etc/plik/plikd-sample.cfg + + mkdir -p ${pkgdir}/usr/lib/plik + cp -r ${srcdir}/${_pkgname_base}/{changelog,clients,webapp} ${pkgdir}/usr/lib/plik + + install -Dm755 ${srcdir}/plikd.service ${pkgdir}/usr/lib/systemd/system/plikd.service +} + +function debian_postinst { + cat << EOF +#!/usr/bin/env bash +useradd --system plik +systemctl daemon-reload +EOF +} diff --git a/plik-bin/materials/plikd.service b/plik-bin/materials/plikd.service new file mode 100644 index 0000000..e163bb4 --- /dev/null +++ b/plik-bin/materials/plikd.service @@ -0,0 +1,16 @@ +[Unit] +Description=Plik is a temporary file upload system (Wetransfer like) in Go. +After=network.target apache2.service + +[Service] +User=plik + +# Start program here, plik needs webapp, clients and changelog to +# host changelog and provide download of clients +WorkingDirectory=/usr/lib/plik/ + +ExecStart=/usr/bin/plikd --config /etc/plik/plikd.cfg +Restart=on-failure + +[Install] +WantedBy=multi-user.target