webhookd/DEBIAN/postinst
Alex Rennie-Lis ebc1aea8c7 first commit
2025-01-23 15:31:27 +00:00

29 lines
645 B
Bash
Executable File

#!/bin/bash
# Ensure the configuration directory exists
if [ ! -f /etc/webhookd.conf ]; then
cat <<EOL > /etc/webhookd.conf
# Webhook Daemon Configuration
SCRIPT_FOLDER=/webhooks/
HOST=0.0.0.0
PORT=8443
CERT_FILE=/etc/ssl/certs/webhookd.crt
KEY_FILE=/etc/ssl/private/webhookd.key
EOL
fi
# Create the system user if not exists
if ! id -u webhookd >/dev/null 2>&1; then
useradd -r -s /bin/false webhookd
fi
# Set ownership for the script folder
mkdir -p /webhooks/
chown -R webhookd:webhookd /webhooks/
# Reload systemd and enable the service
systemctl daemon-reload
systemctl enable webhookd.service
systemctl start webhookd.service