Add default service config

This commit is contained in:
Gamerboy59 2024-09-08 21:51:55 +02:00 committed by GitHub
commit 1ef1e09b8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 198 additions and 19 deletions

View file

@ -2,8 +2,19 @@
set -e
# Create rpxy user if it doesn't exist
if ! id rpxy >/dev/null 2>&1; then
useradd --system --no-create-home --shell /usr/sbin/nologin rpxy
fi
# Set correct user for config directory
if [ -d /etc/rpxy ]; then
chown -R rpxy:rpxy /etc/rpxy
fi
# Reload systemd, enable and start the service
systemctl daemon-reload
systemctl enable rpxy
systemctl start rpxy
exit 0
exit 0

17
.build/DEB/postrm Normal file
View file

@ -0,0 +1,17 @@
#!/bin/bash
set -e
# Remove the rpxy user and configuration directory only if purging the package
if [ "$1" = "purge" ]; then
if id rpxy >/dev/null 2>&1; then
userdel rpxy
fi
# Remove config directory
if [ -d /etc/rpxy ]; then
rm -rf /etc/rpxy
fi
fi
exit 0

View file

@ -2,7 +2,9 @@
set -e
# Stop and disable the service before removing
systemctl stop rpxy || true
systemctl disable rpxy || true
systemctl daemon-reload
exit 0
exit 0