增加对 1GB Huge Pages 的支持,添加相关服务和配置,优化安装脚本
Build and Release / build-and-test (amd64) (push) Successful in 1m40s
Build and Release / build-and-test (arm64) (push) Successful in 1m40s
Build and Release / release (push) Failing after 4s

This commit is contained in:
2026-08-05 12:50:18 +08:00
parent 99a17f1852
commit b04d41d783
7 changed files with 49 additions and 75 deletions
+5
View File
@@ -46,6 +46,7 @@ PKG_DIR="${BUILD_DIR}/${PKG_NAME}_${DEB_VERSION}_${DEB_ARCH}"
mkdir -p "${PKG_DIR}/DEBIAN"
mkdir -p "${PKG_DIR}/opt/xxxig"
mkdir -p "${PKG_DIR}/lib/systemd/system"
mkdir -p "${PKG_DIR}/usr/libexec"
# 解压二进制文件
echo "📂 Extracting binaries..."
@@ -70,6 +71,8 @@ chmod 755 "${PKG_DIR}/DEBIAN/postrm"
echo "🔧 Installing systemd services..."
cp debian/xxxig-server.service "${PKG_DIR}/lib/systemd/system/"
cp debian/xxxig-daemon.service "${PKG_DIR}/lib/systemd/system/"
cp debian/xxxig-hugepages.service "${PKG_DIR}/lib/systemd/system/"
cp debian/xxxig-enable-1gb-pages "${PKG_DIR}/usr/libexec/"
# 设置权限
chmod 755 "${PKG_DIR}/opt/xxxig/xxxigServer"
@@ -80,6 +83,8 @@ chmod 644 "${PKG_DIR}/opt/xxxig/config_cc.json"
chmod 644 "${PKG_DIR}/opt/xxxig/index.html"
chmod 644 "${PKG_DIR}/lib/systemd/system/xxxig-server.service"
chmod 644 "${PKG_DIR}/lib/systemd/system/xxxig-daemon.service"
chmod 644 "${PKG_DIR}/lib/systemd/system/xxxig-hugepages.service"
chmod 755 "${PKG_DIR}/usr/libexec/xxxig-enable-1gb-pages"
# 构建 deb 包
echo "🔨 Building package..."
+1 -1
View File
@@ -3,7 +3,7 @@ Version: {{VERSION}}
Section: net
Priority: optional
Architecture: {{ARCH}}
Depends: libc6 (>= 2.31)
Depends: libc6 (>= 2.31), procps
Maintainer: XXXig Team <noreply@example.com>
Homepage: https://github.com/wangdefaa/xxxig
Description: Cryptocurrency mining software suite
+1 -1
View File
@@ -3,7 +3,7 @@ set -e
# 仅在卸载(remove)时停用服务;升级(upgrade)时保持运行与开机自启状态
if [ "$1" = "remove" ] && [ -d /run/systemd/system ]; then
for service in xxxig-server.service xxxig-daemon.service; do
for service in xxxig-server.service xxxig-daemon.service xxxig-hugepages.service; do
if systemctl is-active --quiet "$service"; then
echo "Stopping $service..."
systemctl stop "$service"
+3 -2
View File
@@ -1,6 +1,7 @@
[Unit]
Description=XXXig Daemon (Miner Client)
After=network.target
Requires=xxxig-hugepages.service
After=network.target xxxig-hugepages.service
[Service]
Type=simple
@@ -24,7 +25,7 @@ NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/log/xxxig
ReadWritePaths=/var/log/xxxig /etc/xxxig
# 日志设置
StandardOutput=journal
+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh
set -eu
sysctl -w vm.nr_hugepages="$(nproc)"
found=0
for node in /sys/devices/system/node/node*; do
file="$node/hugepages/hugepages-1048576kB/nr_hugepages"
[ -e "$file" ] || continue
printf '3\n' >"$file"
actual=$(cat "$file")
[ "$actual" -ge 3 ] || exit 1
found=1
done
[ "$found" -eq 1 ]
+9
View File
@@ -0,0 +1,9 @@
[Unit]
Description=Reserve Huge Pages for XXXig
Before=xxxig-daemon.service
ConditionPathExists=/etc/xxxig/1gb-pages.enabled
ConditionPathExists=/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages
[Service]
Type=oneshot
ExecStart=/usr/libexec/xxxig-enable-1gb-pages