首次提交
Some checks failed
Build and Release Mond / build-and-test (arm64, alpine) (push) Failing after 1m3s
Build and Release Mond / build-and-test (amd64, alpine) (push) Failing after 1m39s
Build and Release Mond / build-and-test (arm64, ubuntu) (push) Failing after 2m24s
Build and Release Mond / build-and-test (amd64, ubuntu) (push) Failing after 3m2s
Build and Release Mond / release (push) Has been skipped

This commit is contained in:
2025-12-15 11:15:14 +08:00
commit 2493344eba
12 changed files with 882 additions and 0 deletions

90
debian/build-deb.sh vendored Executable file
View File

@@ -0,0 +1,90 @@
#!/bin/bash
set -e
# 参数检查
if [ $# -ne 3 ]; then
echo "Usage: $0 <ARCH> <VERSION> <BINARY_DIR>"
echo "Example: $0 amd64 0.18.4.4 build/Linux/release/bin"
exit 1
fi
ARCH=$1
VERSION=$2
BINARY_DIR=$3
PKG_NAME="mond"
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 " Binary directory: ${BINARY_DIR}"
# 检查二进制文件是否存在
if [ ! -f "${BINARY_DIR}/mond" ]; then
echo "❌ Error: mond binary not found in ${BINARY_DIR}"
exit 1
fi
# 创建临时目录
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/mond"
mkdir -p "${PKG_DIR}/lib/systemd/system"
# 复制二进制文件
echo "📂 Copying binary..."
cp "${BINARY_DIR}/mond" "${PKG_DIR}/opt/mond/mond"
# 生成 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/mond.service "${PKG_DIR}/lib/systemd/system/"
# 设置权限
chmod 755 "${PKG_DIR}/opt/mond/mond"
chmod 644 "${PKG_DIR}/lib/systemd/system/mond.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!"

16
debian/control.template vendored Normal file
View File

@@ -0,0 +1,16 @@
Package: mond
Version: {{VERSION}}
Section: net
Priority: optional
Architecture: {{ARCH}}
Depends: libc6, libboost-system1.74.0 | libboost-system1.81.0 | libboost-system1.83.0, libboost-filesystem1.74.0 | libboost-filesystem1.81.0 | libboost-filesystem1.83.0, libboost-thread1.74.0 | libboost-thread1.81.0 | libboost-thread1.83.0, libboost-program-options1.74.0 | libboost-program-options1.81.0 | libboost-program-options1.83.0, libssl3 | libssl1.1, libzmq5, libunwind8
Maintainer: Mond Team <noreply@example.com>
Homepage: https://github.com/monero-project/monero
Description: Mond cryptocurrency daemon
Mond is a customized build of Monero daemon (monerod),
a privacy-focused cryptocurrency network daemon.
.
This package includes:
- mond: Network daemon for Mond cryptocurrency
- Systemd service configuration
- Default configuration support

38
debian/mond.service vendored Normal file
View File

@@ -0,0 +1,38 @@
[Unit]
Description=Mond Cryptocurrency Daemon
After=network.target
[Service]
Type=simple
# 工作目录
WorkingDirectory=/opt/mond
# 执行命令
ExecStart=/opt/mond/mond --data-dir=/var/lib/mond --log-file=/var/log/mond/mond.log --detach
# 重启策略
Restart=always
RestartSec=10
# 用户和组
User=mond
Group=mond
# 安全设置
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/lib/mond /var/log/mond
# 日志设置
StandardOutput=journal
StandardError=journal
SyslogIdentifier=mond
# 资源限制
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target

60
debian/postinst vendored Executable file
View File

@@ -0,0 +1,60 @@
#!/bin/sh
set -e
# Create user and group if they don't exist
if ! getent group mond >/dev/null; then
addgroup --system mond
fi
if ! getent passwd mond >/dev/null; then
adduser --system --ingroup mond --no-create-home \
--home /var/lib/mond --shell /usr/sbin/nologin \
--gecos "Mond Cryptocurrency Daemon" mond
fi
# Create log directory
mkdir -p /var/log/mond
chown mond:mond /var/log/mond
chmod 750 /var/log/mond
# Create data directory
mkdir -p /var/lib/mond
chown mond:mond /var/lib/mond
chmod 750 /var/lib/mond
# Set permissions on binary
chown root:mond /opt/mond/mond
chmod 755 /opt/mond/mond
# Reload systemd
if [ -d /run/systemd/system ]; then
systemctl daemon-reload
# Note: Service is NOT auto-enabled or auto-started
# Users should manually enable the service:
# systemctl enable mond.service
# systemctl start mond.service
fi
echo ""
echo "✅ Mond installed successfully!"
echo ""
echo "📋 Service Information:"
echo ""
echo " mond - Mond cryptocurrency network daemon"
echo ""
echo "To start the daemon:"
echo " sudo systemctl enable mond.service"
echo " sudo systemctl start mond.service"
echo ""
echo "Data directory:"
echo " /var/lib/mond"
echo ""
echo "Log directory:"
echo " /var/log/mond"
echo ""
echo "Binary location:"
echo " /opt/mond/mond"
echo ""
exit 0

42
debian/postrm vendored Executable file
View File

@@ -0,0 +1,42 @@
#!/bin/sh
set -e
case "$1" in
purge)
# Remove user and group
if getent passwd mond >/dev/null; then
deluser --quiet mond || true
fi
if getent group mond >/dev/null; then
delgroup --quiet mond || true
fi
# Remove log directory
rm -rf /var/log/mond
# Note: We keep /var/lib/mond (blockchain data) for safety
# Users can manually remove it if needed
echo ""
echo "⚠️ Blockchain data preserved at: /var/lib/mond"
echo "To completely remove all data, run:"
echo " sudo rm -rf /var/lib/mond"
echo ""
;;
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

17
debian/prerm vendored Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/sh
set -e
# Stop and disable service if running
if [ -d /run/systemd/system ]; then
if systemctl is-active --quiet mond.service; then
echo "Stopping mond service..."
systemctl stop mond.service
fi
if systemctl is-enabled --quiet mond.service 2>/dev/null; then
echo "Disabling mond service..."
systemctl disable mond.service
fi
fi
exit 0