debian-packages/packages/git/pasty-git/DEBBUILD

54 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

2024-03-12 09:36:16 +00:00
#/usr/bin/env bash
pkgname="pasty-git"
arch="amd64"
pkgrel=1
pkgver=20240312172222-39b75df
pkgdesc="pasty is a fast and lightweight code pasting server"
url="https://github.com/leafee98/pasty"
maintainer="Leafee98 <me@leafee98.com>"
source=(
"pasty::git+https://github.com/leafee98/pasty.git"
"pasty.service::materials/pasty.service"
"env::materials/env"
)
function pkgver {
echo "$(date +%Y%m%d%H%M%S)-$(git rev-parse --short HEAD)"
}
function build {
(
cd ${srcdir}/pasty
go build -o pasty ./cmd/pasty/main.go
)
}
function package {
install -Dm755 ${srcdir}/pasty/pasty ${pkgdir}/usr/lib/pasty/pasty
install -Dm644 ${srcdir}/pasty/LICENSE ${pkgdir}/usr/share/licenses/pasty/LICENSE
cp -r ${srcdir}/pasty/web ${pkgdir}/usr/lib/pasty/web
install -Dm644 ${srcdir}/pasty.service ${pkgdir}/usr/lib/systemd/system/pasty.service
# We haven't implement the 'conffiles', so don't create this file in case override user's config
#install -Dm644 ${srcdir}/env ${pkgdir}/etc/pasty/env
}
function debian_postinst {
cat << 'EOF'
#!/usr/bin/env bash
service_name="pasty.service"
adduser --system --group pasty
chown -R pasty:pasty /usr/lib/pasty
systemctl daemon-reload
if systemctl is-active --quiet ${service_name} ; then
systemctl restart ${service_name}
fi
EOF
}