Files
xxxigcc-proxy/debian/postinst
T
wangdefa 8a3cca1065
Build and Release / build-and-test (amd64, alpine) (push) Successful in -2m2s
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in -1m56s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in 5s
Build and Release / build-and-test (arm64, alpine) (push) Successful in 10s
Build and Release / release (push) Has been skipped
修复版本号为 3.4.8-xg1,更新示例参数,调整配置文件路径
2026-04-14 10:51:01 +08:00

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 /var/lib/xxxigcc-proxy
# Copy default config if it doesn't exist
if [ ! -f /var/lib/xxxigcc-proxy/config.json ]; then
cp /opt/xxxigcc-proxy/config.json /var/lib/xxxigcc-proxy/config.json
chown xxxigcc-proxy:xxxigcc-proxy /var/lib/xxxigcc-proxy/config.json
chmod 640 /var/lib/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