Build and Release / build-and-test (amd64, alpine) (push) Successful in 20s
Build and Release / build-and-test (arm64, alpine) (push) Successful in 42s
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in 27s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in 9s
Build and Release / release (push) Has been skipped
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
62 lines
2.0 KiB
Bash
62 lines
2.0 KiB
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
# Create user and group if they don't exist
|
|
if ! getent group xxxig-proxy >/dev/null; then
|
|
addgroup --system xxxig-proxy
|
|
fi
|
|
|
|
if ! getent passwd xxxig-proxy >/dev/null; then
|
|
adduser --system --ingroup xxxig-proxy --no-create-home \
|
|
--home /opt/xxxig-proxy --shell /usr/sbin/nologin \
|
|
--gecos "XXXig Proxy Service" xxxig-proxy
|
|
fi
|
|
|
|
# Create log directory
|
|
mkdir -p /var/log/xxxig-proxy
|
|
chown xxxig-proxy:xxxig-proxy /var/log/xxxig-proxy
|
|
chmod 750 /var/log/xxxig-proxy
|
|
|
|
# Create config directory
|
|
mkdir -p /etc/xxxig-proxy
|
|
|
|
# Copy default config if it doesn't exist
|
|
if [ ! -f /etc/xxxig-proxy/config.json ]; then
|
|
cp /opt/xxxig-proxy/config.json /etc/xxxig-proxy/config.json
|
|
chown xxxig-proxy:xxxig-proxy /etc/xxxig-proxy/config.json
|
|
chmod 640 /etc/xxxig-proxy/config.json
|
|
fi
|
|
|
|
# Set permissions:目录与二进制 755,配置等数据文件 644
|
|
chown -R root:root /opt/xxxig-proxy
|
|
find /opt/xxxig-proxy -type d -exec chmod 755 {} +
|
|
find /opt/xxxig-proxy -type f -exec chmod 644 {} +
|
|
chmod 755 /opt/xxxig-proxy/xxxig-proxy
|
|
|
|
# Reload systemd
|
|
if [ -d /run/systemd/system ]; then
|
|
systemctl daemon-reload
|
|
|
|
# 升级时重启正在运行的服务以加载新二进制;try-restart 不会启动未运行的服务,
|
|
# 故首次安装仍保持"不自动启动"语义(默认上游为 localhost,需用户改配置后再启用)
|
|
systemctl try-restart xxxig-proxy.service 2>/dev/null || true
|
|
|
|
# Note: Service is NOT auto-enabled or auto-started
|
|
# systemctl enable xxxig-proxy.service
|
|
# systemctl start xxxig-proxy.service
|
|
fi
|
|
|
|
echo ""
|
|
echo "✅ XXXig Proxy installed successfully!"
|
|
echo ""
|
|
echo "📁 Important paths:"
|
|
echo " Config files: /etc/xxxig-proxy/config.json"
|
|
echo " Log directory: /var/log/xxxig-proxy"
|
|
echo " Binaries: /opt/xxxig-proxy/xxxig-proxy"
|
|
echo " Systemd services: xxxig-proxy.service"
|
|
echo ""
|
|
echo "💡 Tip: Your config files will NOT be overwritten during package upgrades."
|
|
echo ""
|
|
|
|
exit 0
|