增加对 1GB Huge Pages 的支持,添加相关服务和配置,优化安装脚本
This commit is contained in:
Vendored
+5
@@ -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..."
|
||||
|
||||
Vendored
+1
-1
@@ -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
|
||||
|
||||
Vendored
+1
-1
@@ -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"
|
||||
|
||||
Vendored
+3
-2
@@ -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
|
||||
|
||||
Vendored
+16
@@ -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 ]
|
||||
Vendored
+9
@@ -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
|
||||
Reference in New Issue
Block a user