首次提交
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

223
.gitea/workflows/ci.yaml Normal file
View File

@@ -0,0 +1,223 @@
# .gitea/workflows/ci.yaml
name: Build and Release Mond
on:
push:
branches: [main, master, develop]
tags: ['v*']
env:
DOCKER_BUILDKIT: "1"
PRODUCT_NAME: "mond"
MONERO_VERSION: "v0.18.4.4"
BUILDX_NO_DEFAULT_ATTESTATIONS: "1"
jobs:
build-and-test:
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest-amd64' || 'ubuntu-latest-arm64' }}
strategy:
matrix:
arch: [amd64, arm64]
distro: [ubuntu, alpine]
steps:
- uses: actions/checkout@v4
- name: Setup Docker Buildx
run: |
# 创建 buildx builder原生构建不需要 QEMU
docker buildx create --use --name native-builder \
--driver docker-container \
--driver-opt network=host \
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=50000000 \
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SPEED=10000000 \
|| true
docker buildx inspect --bootstrap
- name: Build binaries
run: |
PLATFORM="linux/${{ matrix.arch }}"
echo "🏗️ Building ${PLATFORM} on native ${{ matrix.arch }} runner"
echo "📦 Distribution: ${{ matrix.distro }}"
echo "📦 Monero Version: ${MONERO_VERSION}"
# 设置 BuildKit 优化参数
export BUILDKIT_PROGRESS=plain
docker buildx build --pull \
--platform ${PLATFORM} \
--build-arg MONERO_VERSION=${MONERO_VERSION} \
--output type=local,dest=./output \
-f docker/Dockerfile.${{ matrix.distro }} .
- name: Package and test
run: |
DIR="./output/linux_${{ matrix.arch }}"
if [ ! -d "$DIR" ]; then
echo "❌ 构建输出目录不存在: $DIR"
exit 1
fi
VERSION=${MONERO_VERSION#v} # 移除前导 v
TARGZ="${PRODUCT_NAME}-${{ matrix.arch }}-${{ matrix.distro }}-${VERSION}.tar.gz"
tar -czf "${TARGZ}" -C "$DIR" .
echo "📦 Created package: ${TARGZ}"
ls -lh "${TARGZ}"
# 快速验证
mkdir -p test && tar -xzf "${TARGZ}" -C test
test/mond --version 2>/dev/null || echo "⚠️ 跳过版本检查"
rm -rf test
- name: Build Debian package
if: matrix.distro == 'ubuntu'
run: |
# 安装 dpkg-deb如果需要
sudo apt-get update && sudo apt-get install -y dpkg-dev
DIR="./output/linux_${{ matrix.arch }}"
VERSION=${MONERO_VERSION#v} # 移除前导 v
echo "📦 Building Debian package for ${{ matrix.arch }}..."
chmod +x debian/build-deb.sh
./debian/build-deb.sh ${{ matrix.arch }} ${VERSION} "${DIR}"
ls -lh *.deb
- uses: https://github.com/ChristopherHX/gitea-upload-artifact@v4
with:
name: binaries-${{ matrix.arch }}-${{ matrix.distro }}
path: |
*.tar.gz
*.deb
retention-days: 1
release:
runs-on: ubuntu-latest-amd64
needs: build-and-test
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: https://github.com/ChristopherHX/gitea-download-artifact@v4
with:
pattern: binaries-*
path: ./packages
merge-multiple: true
- name: Upload packages and create release
env:
TOKEN: ${{ secrets.BUILD_TOKEN }}
TAG: ${{ github.ref_name }}
run: |
cd packages
# 提取仓库信息(移除 https:// 前缀和仓库路径)
REGISTRY=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
OWNER="${{ gitea.repository_owner }}"
REPO_NAME=$(echo "${{ gitea.repository }}" | cut -d'/' -f2)
echo "📦 上传包到 Generic Package Registry..."
echo " Registry: ${REGISTRY}"
echo " Owner: ${OWNER}"
echo " Package: ${PRODUCT_NAME}"
echo " Version: ${TAG}"
# 上传所有 tar.gz 包到 Generic Package Registry
for file in *.tar.gz; do
[ ! -f "$file" ] && continue
echo " ⬆️ $file"
curl -fsSL -X PUT \
-H "Authorization: token ${TOKEN}" \
--upload-file "$file" \
"https://${REGISTRY}/api/packages/${OWNER}/generic/${PRODUCT_NAME}/${TAG}/$file" || {
echo "❌ 上传失败: $file"
exit 1
}
done
# 上传 Debian 包到 Debian Package Registry (支持多个发行版)
echo ""
echo "📦 上传 Debian 包到 Debian Package Registry..."
for file in *.deb; do
[ ! -f "$file" ] && continue
# 上传到 bookworm (Debian 12)
echo " ⬆️ $file → bookworm"
curl -fsSL -X PUT \
-H "Authorization: token ${TOKEN}" \
--upload-file "$file" \
"https://${REGISTRY}/api/packages/${OWNER}/debian/pool/bookworm/main/upload" || {
echo "❌ Debian 包上传失败: $file (bookworm)"
exit 1
}
# 上传到 trixie (Debian 13)
echo " ⬆️ $file → trixie"
curl -fsSL -X PUT \
-H "Authorization: token ${TOKEN}" \
--upload-file "$file" \
"https://${REGISTRY}/api/packages/${OWNER}/debian/pool/trixie/main/upload" || {
echo "❌ Debian 包上传失败: $file (trixie)"
exit 1
}
done
# 生成 Release JSON payload
echo ""
echo "📝 生成 Release..."
export REGISTRY OWNER TAG
RELEASE_DATA=$(python3 -c 'import json,glob,os;r=os.environ["REGISTRY"];o=os.environ["OWNER"];p=os.environ["PRODUCT_NAME"];t=os.environ["TAG"];b=["## Release "+t,"","Mond is a customized build of Monero daemon (monerod).","","### 📥 Download Methods","","#### Method 1: Direct Download (Recommended)","","Click on the file names in the **Assets** section below to download directly.","","#### Method 2: Generic Package Registry",""]+[f"- [`{f}`](https://{r}/api/packages/{o}/generic/{p}/{t}/{f})" for f in sorted(glob.glob("*.tar.gz"))]+["","#### Method 3: Debian Repository","","**Debian 12 (bookworm):**","","```bash","# Download GPG key",f"sudo curl https://{r}/api/packages/{o}/debian/repository.key -o /etc/apt/keyrings/gitea-{o}.asc","","# Add repository",f"echo \"deb [signed-by=/etc/apt/keyrings/gitea-{o}.asc] https://{r}/api/packages/{o}/debian bookworm main\" | sudo tee -a /etc/apt/sources.list.d/{o}.list","","# Update and install","sudo apt-get update","sudo apt-get install mond","```","","**Debian 13 (trixie):**","","```bash","# Download GPG key",f"sudo curl https://{r}/api/packages/{o}/debian/repository.key -o /etc/apt/keyrings/gitea-{o}.asc","","# Add repository",f"echo \"deb [signed-by=/etc/apt/keyrings/gitea-{o}.asc] https://{r}/api/packages/{o}/debian trixie main\" | sudo tee -a /etc/apt/sources.list.d/{o}.list","","# Update and install","sudo apt-get update","sudo apt-get install mond","```"];print(json.dumps({"tag_name":t,"name":f"Release {t}","body":"\n".join(b),"draft":False,"prerelease":False}))')
# 创建 Release
echo ""
echo "🎉 创建 Release..."
RESPONSE=$(curl -fsSL -w "\n%{http_code}" -X POST \
-H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \
"https://${REGISTRY}/api/v1/repos/${{ gitea.repository }}/releases" \
-d "${RELEASE_DATA}")
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
RESPONSE_BODY=$(echo "$RESPONSE" | head -n-1)
if [ "$HTTP_CODE" = "201" ]; then
echo "✅ Release 创建成功"
RELEASE_ID=$(echo "$RESPONSE_BODY" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
echo " Release ID: ${RELEASE_ID}"
elif [ "$HTTP_CODE" = "409" ]; then
echo "⚠️ Release 已存在,获取现有 Release ID..."
RELEASE_ID=$(curl -fsSL \
-H "Authorization: token ${TOKEN}" \
"https://${REGISTRY}/api/v1/repos/${{ gitea.repository }}/releases/tags/${TAG}" | \
grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
echo " Release ID: ${RELEASE_ID}"
else
echo "❌ 创建 Release 失败 (HTTP ${HTTP_CODE})"
echo "$RESPONSE_BODY"
exit 1
fi
# 上传文件作为 Release 附件
echo ""
echo "📎 上传文件作为 Release 附件..."
for file in *.tar.gz *.deb; do
[ ! -f "$file" ] && continue
echo " ⬆️ $file"
# 使用 multipart/form-data 上传附件
curl -fsSL -X POST \
-H "Authorization: token ${TOKEN}" \
-F "attachment=@${file}" \
"https://${REGISTRY}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets?name=${file}" || {
echo " ⚠️ 附件上传失败: $file可能已存在"
}
done
echo ""
echo "✅ Release 创建完成!"
echo "🔗 访问: https://${REGISTRY}/${{ gitea.repository }}/releases/tag/${TAG}"
# 清理临时文件
rm -f release_body.md

7
.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
# Claude Code
.mcp.json
.claude/
llmdoc/
example/
.source/

203
README.md Normal file
View File

@@ -0,0 +1,203 @@
# Mond
> Monero daemon 的定制版本
[![License](https://img.shields.io/badge/license-BSD--3--Clause-blue.svg)](LICENSE)
[![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg)](.gitea/workflows/ci.yaml)
## 🎯 主要特性
- 🏗️ **多架构支持** - 原生支持 AMD64 和 ARM64 架构
- 📦 **多种安装方式** - 提供 Debian 包和通用二进制包
- 🐧 **多发行版兼容** - 支持 Ubuntu、Debian 和 Alpine Linux
- 🔒 **隐私优先** - 基于 Monero 的隐私保护技术
- 🔄 **自动更新** - 通过 Debian 仓库轻松安装和更新
## 🚀 快速开始
### 方式一Debian/Ubuntu推荐
#### Debian 12 (Bookworm)
```bash
# 1. 下载并添加 GPG 密钥
sudo curl https://gitea.bcde.io/api/packages/wangdefa/debian/repository.key \
-o /etc/apt/keyrings/gitea-wangdefa.asc
# 2. 添加软件源
echo "deb [signed-by=/etc/apt/keyrings/gitea-wangdefa.asc] https://gitea.bcde.io/api/packages/wangdefa/debian bookworm main" | \
sudo tee -a /etc/apt/sources.list.d/wangdefa.list
# 3. 安装
sudo apt-get update
sudo apt-get install mond
```
#### Debian 13 (Trixie)
```bash
# 1. 下载并添加 GPG 密钥
sudo curl https://gitea.bcde.io/api/packages/wangdefa/debian/repository.key \
-o /etc/apt/keyrings/gitea-wangdefa.asc
# 2. 添加软件源
echo "deb [signed-by=/etc/apt/keyrings/gitea-wangdefa.asc] https://gitea.bcde.io/api/packages/wangdefa/debian trixie main" | \
sudo tee -a /etc/apt/sources.list.d/wangdefa.list
# 3. 安装
sudo apt-get update
sudo apt-get install mond
```
### 方式二:通用二进制包
```bash
# 1. 下载对应架构的包
wget https://gitea.bcde.io/releases/download/VERSION/mond-amd64-ubuntu-VERSION.tar.gz
# 2. 解压
tar -xzf mond-amd64-ubuntu-VERSION.tar.gz
# 3. 运行
./mond --help
```
## 📋 使用说明
### Debian/Ubuntu 系统服务
#### 启动服务
```bash
# 启用并启动服务
sudo systemctl enable mond.service
sudo systemctl start mond.service
# 查看状态
sudo systemctl status mond.service
# 查看日志
sudo journalctl -u mond -f
```
#### 停止服务
```bash
sudo systemctl stop mond.service
sudo systemctl disable mond.service
```
### 直接运行
```bash
# 基本运行
./mond
# 指定数据目录
./mond --data-dir=/path/to/data
# 指定日志文件
./mond --log-file=/path/to/log
# 后台运行
./mond --detach
```
## ⚙️ 配置说明
### 目录结构
#### Debian/Ubuntu 系统包
```
/opt/mond/mond # 二进制文件
/var/lib/mond/ # 区块链数据目录
/var/log/mond/ # 日志目录
```
#### 通用二进制包
```
./mond # 二进制文件
```
### 常用命令行选项
```bash
--data-dir <path> # 指定数据目录
--log-file <path> # 指定日志文件路径
--log-level <level> # 日志级别 (0-4)
--detach # 后台运行
--rpc-bind-ip <ip> # RPC 绑定 IP (默认: 127.0.0.1)
--rpc-bind-port <port> # RPC 绑定端口 (默认: 18081)
--p2p-bind-ip <ip> # P2P 绑定 IP (默认: 0.0.0.0)
--p2p-bind-port <port> # P2P 绑定端口 (默认: 18080)
```
## 🔄 修改内容
本项目基于 [Monero](https://github.com/monero-project/monero) 进行以下修改:
1. **项目重命名**`monero``mond`
2. **二进制文件名**`monerod``mond`
3. **版本标识**`MONERO_*``MOND_*`
所有修改通过 [init.sh](init.sh) 在构建过程中自动应用。
## 🏗️ 构建说明
### 本地构建
```bash
# 1. 克隆源代码
git clone .source
# 2. 运行修改脚本
cd .source
../init.sh
# 3. 构建
mkdir -p build/release && cd build/release
cmake ../.. -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI_DEPS=OFF
make -j$(nproc) daemon
```
### Docker 构建
```bash
# Ubuntu 构建
docker buildx build --platform linux/amd64 \
-f docker/Dockerfile.ubuntu \
--output type=local,dest=./output .
# Alpine 构建
docker buildx build --platform linux/amd64 \
-f docker/Dockerfile.alpine \
--output type=local,dest=./output .
```
## 📝 许可证
本项目基于 BSD-3-Clause 许可证开源。
- 原始项目:[Monero](https://github.com/monero-project/monero) (BSD-3-Clause)
- 修改内容:详见 [init.sh](init.sh)
## 🙏 致谢
- [Monero Project](https://github.com/monero-project/monero) - 原始项目和核心技术
## ⚠️ 免责声明
本软件仅供学习和研究使用。使用本软件进行任何活动请遵守当地法律法规。作者不对使用本软件造成的任何损失或法律问题负责。
## 📞 支持
如有问题或建议,请通过以下方式联系:
- 提交 Issue
- 发送 Pull Request
---
**注意**:本项目是 Monero 的定制版本,不代表官方 Monero 项目。

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

64
docker/Dockerfile.alpine Normal file
View File

@@ -0,0 +1,64 @@
FROM alpine:3.18 AS base
ARG TARGETARCH
ARG BUILDPLATFORM
# 安装构建依赖
RUN apk add --no-cache \
git \
wget \
build-base \
cmake \
boost-dev \
openssl-dev \
zeromq-dev \
unbound-dev \
libsodium-dev \
libunwind-dev \
xz-dev \
readline-dev \
expat-dev \
hidapi-dev \
libusb-dev \
protobuf-dev \
eudev-dev \
linux-headers \
pkgconfig
FROM base AS build
ARG MONERO_VERSION=v0.18.3.4
ARG TARGETARCH
ARG BUILDPLATFORM
ARG TARGETPLATFORM
# 克隆 Monero 项目
RUN git clone --recursive https://github.com/monero-project/monero.git && \
cd monero && \
git checkout ${MONERO_VERSION} && \
git submodule update --init --force
WORKDIR /monero
# 复制并运行 init.sh 脚本进行修改
COPY ./init.sh ./init.sh
RUN chmod +x ./init.sh && sed -i 's|/bin/sh|/bin/ash|' ./init.sh && ./init.sh
# 构建 Monero (mond)
RUN if [ "$BUILDPLATFORM" != "$TARGETPLATFORM" ]; then \
MAKE_JOBS="-j2"; \
else \
MAKE_JOBS="-j$(nproc)"; \
fi && \
echo "Building with parallel jobs: $MAKE_JOBS" && \
mkdir -p build/release && cd build/release && \
cmake ../.. -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI_DEPS=OFF -DARCH=default -DSTATIC=ON && \
make $MAKE_JOBS daemon
# 最终阶段 - 只复制二进制文件
FROM scratch
ARG TARGETARCH
COPY --from=build /monero/build/release/bin/mond /linux_${TARGETARCH}/mond

70
docker/Dockerfile.ubuntu Normal file
View File

@@ -0,0 +1,70 @@
FROM ubuntu:22.04 AS base
ARG TARGETARCH
ARG BUILDPLATFORM
ENV DEBIAN_FRONTEND=noninteractive
# 安装构建依赖
RUN apt-get update && apt-get install -y \
git \
wget \
build-essential \
cmake \
pkg-config \
libboost-all-dev \
libssl-dev \
libzmq3-dev \
libunbound-dev \
libsodium-dev \
libunwind8-dev \
liblzma-dev \
libreadline-dev \
libexpat1-dev \
libpgm-dev \
qttools5-dev-tools \
libhidapi-dev \
libusb-1.0-0-dev \
libprotobuf-dev \
protobuf-compiler \
libudev-dev \
libgtest-dev \
&& rm -rf /var/lib/apt/lists/*
FROM base AS build
ARG MONERO_VERSION=v0.18.3.4
ARG TARGETARCH
ARG BUILDPLATFORM
ARG TARGETPLATFORM
# 克隆 Monero 项目
RUN git clone --recursive https://github.com/monero-project/monero.git && \
cd monero && \
git checkout ${MONERO_VERSION} && \
git submodule update --init --force
WORKDIR /monero
# 复制并运行 init.sh 脚本进行修改
COPY ./init.sh ./init.sh
RUN chmod +x ./init.sh && ./init.sh
# 构建 Monero (mond)
RUN if [ "$BUILDPLATFORM" != "$TARGETPLATFORM" ]; then \
MAKE_JOBS="-j2"; \
else \
MAKE_JOBS="-j$(nproc)"; \
fi && \
echo "Building with parallel jobs: $MAKE_JOBS" && \
mkdir -p build/release && cd build/release && \
cmake ../.. -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI_DEPS=OFF -DARCH=default && \
make $MAKE_JOBS daemon
# 最终阶段 - 只复制二进制文件
FROM scratch
ARG TARGETARCH
COPY --from=build /monero/build/release/bin/mond /linux_${TARGETARCH}/mond

52
init.sh Executable file
View File

@@ -0,0 +1,52 @@
#!/bin/sh
# Modify the CMakeLists.txt and source files to change the project name from "monero" to "mond"
# 1. Modify main CMakeLists.txt - Change project name
sed -i 's/project(monero)/project(mond)/' CMakeLists.txt
# 2. Modify daemon CMakeLists.txt - Change output binary name
sed -i 's/OUTPUT_NAME "monerod"/OUTPUT_NAME "mond"/' src/daemon/CMakeLists.txt
# 3. Modify version.cpp.in - Change all MONERO to MOND
sed -i 's/DEF_MONERO_VERSION_TAG/DEF_MOND_VERSION_TAG/' src/version.cpp.in
sed -i 's/DEF_MONERO_VERSION "/DEF_MOND_VERSION "/' src/version.cpp.in
sed -i 's/DEF_MONERO_RELEASE_NAME/DEF_MOND_RELEASE_NAME/' src/version.cpp.in
sed -i 's/DEF_MONERO_VERSION_FULL/DEF_MOND_VERSION_FULL/' src/version.cpp.in
sed -i 's/DEF_MONERO_VERSION_IS_RELEASE/DEF_MOND_VERSION_IS_RELEASE/' src/version.cpp.in
sed -i 's/MONERO_VERSION_TAG/MOND_VERSION_TAG/g' src/version.cpp.in
sed -i 's/MONERO_VERSION "/MOND_VERSION "/' src/version.cpp.in
sed -i 's/MONERO_RELEASE_NAME/MOND_RELEASE_NAME/g' src/version.cpp.in
sed -i 's/MONERO_VERSION_FULL/MOND_VERSION_FULL/g' src/version.cpp.in
sed -i 's/MONERO_VERSION_IS_RELEASE/MOND_VERSION_IS_RELEASE/g' src/version.cpp.in
sed -i 's/"Fluorine Fermi"/"Mond"/' src/version.cpp.in
# 4. Modify version.h - Change all MONERO to MOND
sed -i 's/MONERO_VERSION_TAG/MOND_VERSION_TAG/g' src/version.h
sed -i 's/MONERO_VERSION/MOND_VERSION/g' src/version.h
sed -i 's/MONERO_RELEASE_NAME/MOND_RELEASE_NAME/g' src/version.h
sed -i 's/MONERO_VERSION_FULL/MOND_VERSION_FULL/g' src/version.h
sed -i 's/MONERO_VERSION_IS_RELEASE/MOND_VERSION_IS_RELEASE/g' src/version.h
# 5. Modify all source files that reference MONERO_VERSION
find src -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.inl" \) -exec sed -i 's/MONERO_VERSION/MOND_VERSION/g' {} \;
find src -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.inl" \) -exec sed -i 's/MONERO_RELEASE_NAME/MOND_RELEASE_NAME/g' {} \;
# 6. Modify display strings - Change "Monero" to "Mond" in user-facing messages
sed -i 's/"Monero '"'"'/"Mond '"'"'/g' src/daemon/main.cpp
sed -i 's/"Monero '"'"'/"Mond '"'"'/g' src/daemon/command_server.cpp
sed -i 's/"Monero '"'"'/"Mond '"'"'/g' src/daemon/executor.cpp
sed -i 's/"Monero '"'"'/"Mond '"'"'/g' src/simplewallet/simplewallet.cpp
sed -i 's/"Monero '"'"'/"Mond '"'"'/g' src/wallet/wallet_args.cpp
find src/blockchain_utilities -type f -name "*.cpp" -exec sed -i 's/"Monero '"'"'/"Mond '"'"'/g' {} \;
find src/debug_utilities -type f -name "*.cpp" -exec sed -i 's/"Monero '"'"'/"Mond '"'"'/g' {} \;
find src/gen_ssl_cert -type f -name "*.cpp" -exec sed -i 's/"Monero '"'"'/"Mond '"'"'/g' {} \;
find tests -type f -name "*.cpp" -exec sed -i 's/"Monero '"'"'/"Mond '"'"'/g' {} \;
# 7. Remove copyright notices (optional - comment out if you want to keep them)
# Uncomment the following lines if you want to remove Monero Project copyright
# find . -type f \( -name "*.cpp" -o -name "*.h" \) -exec sed -i '/Copyright.*The Monero Project/d' {} \;
echo "Project successfully modified from Monero to Mond!"
echo "Binary output name: mond"
echo "Project name: mond"