添加deb包构建,删除容器构建
All checks were successful
Build and Release / build-and-test (arm64, alpine) (push) Successful in 8s
Build and Release / build-and-test (amd64, alpine) (push) Successful in 15s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in 19s
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in 37s
Build and Release / release (push) Successful in 1m8s
All checks were successful
Build and Release / build-and-test (arm64, alpine) (push) Successful in 8s
Build and Release / build-and-test (amd64, alpine) (push) Successful in 15s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in 19s
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in 37s
Build and Release / release (push) Successful in 1m8s
This commit is contained in:
91
debian/build-deb.sh
vendored
Executable file
91
debian/build-deb.sh
vendored
Executable file
@@ -0,0 +1,91 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# 参数检查
|
||||
if [ $# -ne 3 ]; then
|
||||
echo "Usage: $0 <ARCH> <VERSION> <TARGZ_FILE>"
|
||||
echo "Example: $0 amd64 3.4.6-xg1 xxxigcc-amd64-ubuntu-3.4.6-xg1.tar.gz"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ARCH=$1
|
||||
VERSION=$2
|
||||
TARGZ_FILE=$3
|
||||
PKG_NAME="xxxigcc"
|
||||
DEB_FILE="${PKG_NAME}_${VERSION}_${ARCH}.deb"
|
||||
|
||||
# 转换架构名称(Docker 使用的架构名到 Debian 架构名)
|
||||
case "$ARCH" in
|
||||
amd64)
|
||||
DEB_ARCH="amd64"
|
||||
;;
|
||||
arm64)
|
||||
DEB_ARCH="arm64"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported architecture: $ARCH"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "📦 Building Debian package: ${DEB_FILE}"
|
||||
echo " Architecture: ${DEB_ARCH}"
|
||||
echo " Version: ${VERSION}"
|
||||
echo " Source: ${TARGZ_FILE}"
|
||||
|
||||
# 创建临时目录
|
||||
BUILD_DIR=$(mktemp -d)
|
||||
trap "rm -rf $BUILD_DIR" EXIT
|
||||
|
||||
# 创建包目录结构
|
||||
PKG_DIR="${BUILD_DIR}/${PKG_NAME}_${VERSION}_${DEB_ARCH}"
|
||||
mkdir -p "${PKG_DIR}/DEBIAN"
|
||||
mkdir -p "${PKG_DIR}/opt/xxxigcc"
|
||||
mkdir -p "${PKG_DIR}/lib/systemd/system"
|
||||
|
||||
# 解压二进制文件
|
||||
echo "📂 Extracting binaries..."
|
||||
tar -xzf "${TARGZ_FILE}" -C "${PKG_DIR}/opt/xxxigcc"
|
||||
|
||||
# 生成 control 文件
|
||||
echo "📝 Generating control file..."
|
||||
sed -e "s/{{VERSION}}/${VERSION}/" \
|
||||
-e "s/{{ARCH}}/${DEB_ARCH}/" \
|
||||
debian/control.template > "${PKG_DIR}/DEBIAN/control"
|
||||
|
||||
# 复制维护脚本
|
||||
echo "📋 Copying maintainer scripts..."
|
||||
cp debian/postinst "${PKG_DIR}/DEBIAN/postinst"
|
||||
cp debian/prerm "${PKG_DIR}/DEBIAN/prerm"
|
||||
cp debian/postrm "${PKG_DIR}/DEBIAN/postrm"
|
||||
chmod 755 "${PKG_DIR}/DEBIAN/postinst"
|
||||
chmod 755 "${PKG_DIR}/DEBIAN/prerm"
|
||||
chmod 755 "${PKG_DIR}/DEBIAN/postrm"
|
||||
|
||||
# 复制 systemd service 文件
|
||||
echo "🔧 Installing systemd services..."
|
||||
cp debian/xxxigcc-server.service "${PKG_DIR}/lib/systemd/system/"
|
||||
cp debian/xxxigcc-daemon.service "${PKG_DIR}/lib/systemd/system/"
|
||||
|
||||
# 设置权限
|
||||
chmod 755 "${PKG_DIR}/opt/xxxigcc/xxxigServer"
|
||||
chmod 755 "${PKG_DIR}/opt/xxxigcc/xxxigDaemon"
|
||||
chmod 755 "${PKG_DIR}/opt/xxxigcc/xxxigMiner"
|
||||
chmod 644 "${PKG_DIR}/opt/xxxigcc/config.json"
|
||||
chmod 644 "${PKG_DIR}/opt/xxxigcc/config_cc.json"
|
||||
chmod 644 "${PKG_DIR}/opt/xxxigcc/index.html"
|
||||
chmod 644 "${PKG_DIR}/lib/systemd/system/xxxigcc-server.service"
|
||||
chmod 644 "${PKG_DIR}/lib/systemd/system/xxxigcc-daemon.service"
|
||||
|
||||
# 构建 deb 包
|
||||
echo "🔨 Building package..."
|
||||
dpkg-deb --build --root-owner-group "${PKG_DIR}" "${DEB_FILE}"
|
||||
|
||||
# 检查包
|
||||
echo "✅ Package built successfully!"
|
||||
echo "📦 Package: $(pwd)/${DEB_FILE}"
|
||||
echo "📊 Package info:"
|
||||
dpkg-deb --info "${DEB_FILE}"
|
||||
|
||||
echo ""
|
||||
echo "🎉 Done!"
|
||||
18
debian/control.template
vendored
Normal file
18
debian/control.template
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
Package: xxxigcc
|
||||
Version: {{VERSION}}
|
||||
Section: net
|
||||
Priority: optional
|
||||
Architecture: {{ARCH}}
|
||||
Depends: libc6, libuv1, libssl3 | libssl1.1, libhwloc15 | libhwloc5
|
||||
Maintainer: XXXigCC Team <noreply@example.com>
|
||||
Homepage: https://github.com/Bendr0id/xmrigCC
|
||||
Description: Cryptocurrency mining software suite
|
||||
XXXigCC is a customized build of XMRigCC,
|
||||
a cryptocurrency mining software with centralized management.
|
||||
.
|
||||
This package includes:
|
||||
- xxxigServer: Central control server with web UI
|
||||
- xxxigDaemon: Client daemon that connects to the server
|
||||
- xxxigMiner: Mining executable controlled by the daemon
|
||||
- Systemd service configurations
|
||||
- Default configuration files
|
||||
82
debian/postinst
vendored
Executable file
82
debian/postinst
vendored
Executable file
@@ -0,0 +1,82 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Create user and group if they don't exist
|
||||
if ! getent group xxxigcc >/dev/null; then
|
||||
addgroup --system xxxigcc
|
||||
fi
|
||||
|
||||
if ! getent passwd xxxigcc >/dev/null; then
|
||||
adduser --system --ingroup xxxigcc --no-create-home \
|
||||
--home /opt/xxxigcc --shell /usr/sbin/nologin \
|
||||
--gecos "XXXigCC Service" xxxigcc
|
||||
fi
|
||||
|
||||
# Create log directory
|
||||
mkdir -p /var/log/xxxigcc
|
||||
chown xxxigcc:xxxigcc /var/log/xxxigcc
|
||||
chmod 750 /var/log/xxxigcc
|
||||
|
||||
# Create config directory
|
||||
mkdir -p /etc/xxxigcc
|
||||
|
||||
# Copy default configs if they don't exist
|
||||
if [ ! -f /etc/xxxigcc/config.json ]; then
|
||||
cp /opt/xxxigcc/config.json /etc/xxxigcc/config.json
|
||||
chown xxxigcc:xxxigcc /etc/xxxigcc/config.json
|
||||
chmod 640 /etc/xxxigcc/config.json
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/xxxigcc/config_cc.json ]; then
|
||||
cp /opt/xxxigcc/config_cc.json /etc/xxxigcc/config_cc.json
|
||||
chown xxxigcc:xxxigcc /etc/xxxigcc/config_cc.json
|
||||
chmod 640 /etc/xxxigcc/config_cc.json
|
||||
fi
|
||||
|
||||
# Set permissions
|
||||
chown -R xxxigcc:xxxigcc /opt/xxxigcc
|
||||
chmod 755 /opt/xxxigcc
|
||||
chmod 755 /opt/xxxigcc/xxxigServer
|
||||
chmod 755 /opt/xxxigcc/xxxigDaemon
|
||||
chmod 755 /opt/xxxigcc/xxxigMiner
|
||||
|
||||
# Reload systemd
|
||||
if [ -d /run/systemd/system ]; then
|
||||
systemctl daemon-reload
|
||||
|
||||
# Note: Services are NOT auto-enabled or auto-started
|
||||
# Users should manually enable the services they need:
|
||||
# systemctl enable xxxigcc-server.service
|
||||
# systemctl start xxxigcc-server.service
|
||||
# or
|
||||
# systemctl enable xxxigcc-daemon.service
|
||||
# systemctl start xxxigcc-daemon.service
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "✅ XXXigCC installed successfully!"
|
||||
echo ""
|
||||
echo "📋 Service Information:"
|
||||
echo ""
|
||||
echo " xxxigcc-server - Control server with web UI (uses config_cc.json)"
|
||||
echo " xxxigcc-daemon - Mining client daemon (uses config.json, auto-calls xxxigMiner)"
|
||||
echo ""
|
||||
echo "To start the server (central control):"
|
||||
echo " sudo systemctl enable xxxigcc-server.service"
|
||||
echo " sudo systemctl start xxxigcc-server.service"
|
||||
echo ""
|
||||
echo "To start the daemon (mining client):"
|
||||
echo " sudo systemctl enable xxxigcc-daemon.service"
|
||||
echo " sudo systemctl start xxxigcc-daemon.service"
|
||||
echo ""
|
||||
echo "Configuration files:"
|
||||
echo " /etc/xxxigcc/config.json - Daemon/Miner configuration"
|
||||
echo " /etc/xxxigcc/config_cc.json - Server configuration"
|
||||
echo ""
|
||||
echo "Binaries location:"
|
||||
echo " /opt/xxxigcc/xxxigServer - Control server"
|
||||
echo " /opt/xxxigcc/xxxigDaemon - Client daemon (auto-calls xxxigMiner)"
|
||||
echo " /opt/xxxigcc/xxxigMiner - Miner executable"
|
||||
echo ""
|
||||
|
||||
exit 0
|
||||
30
debian/postrm
vendored
Executable file
30
debian/postrm
vendored
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
purge)
|
||||
# Remove log directory
|
||||
rm -rf /var/log/xxxigcc
|
||||
|
||||
# Remove config directory
|
||||
rm -rf /etc/xxxigcc
|
||||
|
||||
# Remove user and group
|
||||
if getent passwd xxxigcc >/dev/null; then
|
||||
deluser --system xxxigcc 2>/dev/null || true
|
||||
fi
|
||||
|
||||
if getent group xxxigcc >/dev/null; then
|
||||
delgroup --system xxxigcc 2>/dev/null || true
|
||||
fi
|
||||
;;
|
||||
|
||||
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
|
||||
# Reload systemd
|
||||
if [ -d /run/systemd/system ]; then
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
17
debian/prerm
vendored
Executable file
17
debian/prerm
vendored
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Stop services before removal
|
||||
if [ -d /run/systemd/system ]; then
|
||||
for service in xxxigcc-server.service xxxigcc-daemon.service; do
|
||||
if systemctl is-active "$service" >/dev/null 2>&1; then
|
||||
systemctl stop "$service"
|
||||
fi
|
||||
|
||||
if systemctl is-enabled "$service" >/dev/null 2>&1; then
|
||||
systemctl disable "$service"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
exit 0
|
||||
38
debian/xxxigcc-daemon.service
vendored
Normal file
38
debian/xxxigcc-daemon.service
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
[Unit]
|
||||
Description=XXXigCC Daemon (Miner Client)
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
||||
# 工作目录
|
||||
WorkingDirectory=/opt/xxxigcc
|
||||
|
||||
# 执行命令
|
||||
ExecStart=/opt/xxxigcc/xxxigDaemon --config /etc/xxxigcc/config.json --log-file=/var/log/xxxigcc/daemon.log
|
||||
|
||||
# 重启策略
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
# 用户和组
|
||||
User=xxxigcc
|
||||
Group=xxxigcc
|
||||
|
||||
# 安全设置
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
ReadWritePaths=/var/log/xxxigcc
|
||||
|
||||
# 日志设置
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=xxxigcc-daemon
|
||||
|
||||
# 资源限制
|
||||
LimitNOFILE=65535
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
38
debian/xxxigcc-server.service
vendored
Normal file
38
debian/xxxigcc-server.service
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
[Unit]
|
||||
Description=XXXigCC Server (Control Center)
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
||||
# 工作目录
|
||||
WorkingDirectory=/opt/xxxigcc
|
||||
|
||||
# 执行命令
|
||||
ExecStart=/opt/xxxigcc/xxxigServer --config /etc/xxxigcc/config_cc.json --log-file=/var/log/xxxigcc/server.log
|
||||
|
||||
# 重启策略
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
# 用户和组
|
||||
User=xxxigcc
|
||||
Group=xxxigcc
|
||||
|
||||
# 安全设置
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
ReadWritePaths=/var/log/xxxigcc
|
||||
|
||||
# 日志设置
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=xxxigcc-server
|
||||
|
||||
# 资源限制
|
||||
LimitNOFILE=65535
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user