Some checks failed
Build and Release / build-and-test (arm64, alpine) (push) Successful in 8s
Build and Release / build-and-test (amd64, alpine) (push) Successful in 14s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in 14s
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in 23s
Build and Release / release (push) Failing after 26s
51 lines
1.4 KiB
Bash
51 lines
1.4 KiB
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
# Create user and group if they don't exist
|
|
if ! getent group xxxigcc-proxy >/dev/null; then
|
|
addgroup --system xxxigcc-proxy
|
|
fi
|
|
|
|
if ! getent passwd xxxigcc-proxy >/dev/null; then
|
|
adduser --system --ingroup xxxigcc-proxy --no-create-home \
|
|
--home /opt/xxxigcc-proxy --shell /usr/sbin/nologin \
|
|
--gecos "XXXigCC Proxy Service" xxxigcc-proxy
|
|
fi
|
|
|
|
# Create log directory
|
|
mkdir -p /var/log/xxxigcc-proxy
|
|
chown xxxigcc-proxy:xxxigcc-proxy /var/log/xxxigcc-proxy
|
|
chmod 750 /var/log/xxxigcc-proxy
|
|
|
|
# Create config directory
|
|
mkdir -p /etc/xxxigcc-proxy
|
|
|
|
# Copy default config if it doesn't exist
|
|
if [ ! -f /etc/xxxigcc-proxy/config.json ]; then
|
|
cp /opt/xxxigcc-proxy/config.json /etc/xxxigcc-proxy/config.json
|
|
chown xxxigcc-proxy:xxxigcc-proxy /etc/xxxigcc-proxy/config.json
|
|
chmod 640 /etc/xxxigcc-proxy/config.json
|
|
fi
|
|
|
|
# Set permissions
|
|
chown -R xxxigcc-proxy:xxxigcc-proxy /opt/xxxigcc-proxy
|
|
chmod 755 /opt/xxxigcc-proxy
|
|
chmod 755 /opt/xxxigcc-proxy/xxxigcc-proxy
|
|
|
|
# Reload systemd
|
|
if [ -d /run/systemd/system ]; then
|
|
systemctl daemon-reload
|
|
|
|
# Enable and start service
|
|
if ! systemctl is-enabled xxxigcc-proxy.service >/dev/null 2>&1; then
|
|
systemctl enable xxxigcc-proxy.service
|
|
fi
|
|
|
|
# Start service if not running
|
|
if ! systemctl is-active xxxigcc-proxy.service >/dev/null 2>&1; then
|
|
systemctl start xxxigcc-proxy.service
|
|
fi
|
|
fi
|
|
|
|
exit 0
|