第一次提交
Some checks failed
Build and Release / build-and-test (amd64, ubuntu) (push) Failing after 19m29s
Build and Release / build-and-test (amd64, alpine) (push) Failing after 19m31s
Build and Release / build-and-test (arm64, ubuntu) (push) Failing after 50m10s
Build and Release / release (push) Has been cancelled
Build and Release / build-and-test (arm64, alpine) (push) Has been cancelled
Some checks failed
Build and Release / build-and-test (amd64, ubuntu) (push) Failing after 19m29s
Build and Release / build-and-test (amd64, alpine) (push) Failing after 19m31s
Build and Release / build-and-test (arm64, ubuntu) (push) Failing after 50m10s
Build and Release / release (push) Has been cancelled
Build and Release / build-and-test (arm64, alpine) (push) Has been cancelled
This commit is contained in:
85
debian/build-deb.sh
vendored
Executable file
85
debian/build-deb.sh
vendored
Executable file
@@ -0,0 +1,85 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# 参数检查
|
||||
if [ $# -ne 3 ]; then
|
||||
echo "Usage: $0 <ARCH> <VERSION> <TARGZ_FILE>"
|
||||
echo "Example: $0 amd64 v4.12 p2pool-amd64-ubuntu-v4.12.tar.gz"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ARCH=$1
|
||||
VERSION=$2
|
||||
TARGZ_FILE=$3
|
||||
PKG_NAME="p2pool"
|
||||
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}/usr/local/bin"
|
||||
mkdir -p "${PKG_DIR}/lib/systemd/system"
|
||||
mkdir -p "${PKG_DIR}/etc/p2pool"
|
||||
|
||||
# 解压二进制文件
|
||||
echo "📂 Extracting binaries..."
|
||||
tar -xzf "${TARGZ_FILE}" -C "${PKG_DIR}/usr/local/bin"
|
||||
|
||||
# 生成 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 service..."
|
||||
cp debian/p2pool.service "${PKG_DIR}/lib/systemd/system/"
|
||||
|
||||
# 设置权限
|
||||
chmod 755 "${PKG_DIR}/usr/local/bin/p2pool"
|
||||
chmod 644 "${PKG_DIR}/lib/systemd/system/p2pool.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: p2pool
|
||||
Version: {{VERSION}}
|
||||
Section: net
|
||||
Priority: optional
|
||||
Architecture: {{ARCH}}
|
||||
Depends: libc6, libuv1, libzmq5, libcurl4
|
||||
Maintainer: P2Pool Team <noreply@example.com>
|
||||
Homepage: https://github.com/SChernykh/p2pool
|
||||
Description: Decentralized pool for Monero mining
|
||||
P2Pool is a decentralized Monero mining pool that runs on a sidechain.
|
||||
.
|
||||
Key features:
|
||||
- 0% fee
|
||||
- No central administrator
|
||||
- Trustless - funds are never in custody
|
||||
- Supports regular payouts similar to traditional pools
|
||||
- Permissionless - no one decides who can mine
|
||||
- Supports merge mining
|
||||
26
debian/p2pool.service
vendored
Normal file
26
debian/p2pool.service
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
[Unit]
|
||||
Description=P2Pool - Decentralized Monero Mining Pool
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=p2pool
|
||||
Group=p2pool
|
||||
WorkingDirectory=/var/lib/p2pool
|
||||
ExecStart=/usr/local/bin/p2pool --host 127.0.0.1 --rpc-port 18081 --wallet YOUR_MONERO_WALLET_ADDRESS
|
||||
Restart=on-failure
|
||||
RestartSec=10s
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=p2pool
|
||||
|
||||
# Security hardening
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
ReadWritePaths=/var/lib/p2pool /var/log/p2pool
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
61
debian/postinst
vendored
Executable file
61
debian/postinst
vendored
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Create user and group if they don't exist
|
||||
if ! getent group p2pool >/dev/null; then
|
||||
addgroup --system p2pool
|
||||
fi
|
||||
|
||||
if ! getent passwd p2pool >/dev/null; then
|
||||
adduser --system --ingroup p2pool --no-create-home \
|
||||
--home /var/lib/p2pool --shell /usr/sbin/nologin \
|
||||
--gecos "P2Pool Service" p2pool
|
||||
fi
|
||||
|
||||
# Create data directory
|
||||
mkdir -p /var/lib/p2pool
|
||||
chown p2pool:p2pool /var/lib/p2pool
|
||||
chmod 750 /var/lib/p2pool
|
||||
|
||||
# Create log directory
|
||||
mkdir -p /var/log/p2pool
|
||||
chown p2pool:p2pool /var/log/p2pool
|
||||
chmod 750 /var/log/p2pool
|
||||
|
||||
# Set binary permissions
|
||||
chown root:root /usr/local/bin/p2pool
|
||||
chmod 755 /usr/local/bin/p2pool
|
||||
|
||||
# Reload systemd
|
||||
if [ -d /run/systemd/system ]; then
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "✅ P2Pool installed successfully!"
|
||||
echo ""
|
||||
echo "📋 Before starting P2Pool, you MUST:"
|
||||
echo ""
|
||||
echo "1. Edit the systemd service file to set your Monero wallet address:"
|
||||
echo " sudo systemctl edit --full p2pool.service"
|
||||
echo ""
|
||||
echo " Replace 'YOUR_MONERO_WALLET_ADDRESS' with your actual Monero wallet address"
|
||||
echo " and configure --host and --rpc-port to point to your Monero node"
|
||||
echo ""
|
||||
echo "2. Start P2Pool:"
|
||||
echo " sudo systemctl enable p2pool.service"
|
||||
echo " sudo systemctl start p2pool.service"
|
||||
echo ""
|
||||
echo "3. Check status:"
|
||||
echo " sudo systemctl status p2pool.service"
|
||||
echo " sudo journalctl -u p2pool -f"
|
||||
echo ""
|
||||
echo "Data directory: /var/lib/p2pool"
|
||||
echo "Log directory: /var/log/p2pool"
|
||||
echo "Binary: /usr/local/bin/p2pool"
|
||||
echo ""
|
||||
echo "For help:"
|
||||
echo " p2pool --help"
|
||||
echo ""
|
||||
|
||||
exit 0
|
||||
34
debian/postrm
vendored
Executable file
34
debian/postrm
vendored
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
purge)
|
||||
# Remove user and group
|
||||
if getent passwd p2pool >/dev/null; then
|
||||
deluser --system p2pool 2>/dev/null || true
|
||||
fi
|
||||
if getent group p2pool >/dev/null; then
|
||||
delgroup --system p2pool 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Remove data directories (only on purge)
|
||||
rm -rf /var/lib/p2pool
|
||||
rm -rf /var/log/p2pool
|
||||
;;
|
||||
|
||||
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
|
||||
# Do nothing
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postrm called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Reload systemd
|
||||
if [ -d /run/systemd/system ]; then
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
|
||||
exit 0
|
||||
10
debian/prerm
vendored
Executable file
10
debian/prerm
vendored
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Stop service if running
|
||||
if [ -d /run/systemd/system ] && systemctl is-active --quiet p2pool.service; then
|
||||
echo "Stopping P2Pool service..."
|
||||
systemctl stop p2pool.service
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user