Files
mond/debian/postinst
Wang Defa ff86a4e2bf
All checks were successful
Build and Release Mond / build-and-test (arm64) (push) Successful in 4s
Build and Release Mond / build-and-test (amd64) (push) Successful in 14s
Build and Release Mond / release (push) Successful in 37s
feat: 优化 Debian 打包配置并初始化项目文档系统
- 简化 mond.service 配置,改为通过配置文件启动
- 优化 postinst 安装脚本,自动生成配置文件模板
- 优化 postrm 卸载脚本,正确清理数据目录
- 初始化 llmdoc 文档系统,包含项目概览、使用指南、架构说明和参考文档
- 更新 README.md 构建和配置说明
- 移除 .gitignore 中 llmdoc/ 的忽略规则
2025-12-24 08:59:06 +08:00

123 lines
3.2 KiB
Bash
Executable File

#!/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/data
chown -R mond:mond /var/lib/mond
chmod -R 750 /var/lib/mond
# Create configuration file if it doesn't exist
if [ ! -f /var/lib/mond/params.conf ]; then
cat > /var/lib/mond/params.conf << 'EOF'
# Mond Configuration File
# This file is automatically created during installation
# Edit this file to customize your Mond daemon settings
# After modifying, restart the service: sudo systemctl restart mond.service
# Data directory - where blockchain data is stored
data-dir=/var/lib/mond/data
# Blockchain pruning - reduces disk usage by pruning old blockchain data
prune-blockchain=1
# ZMQ pub socket for notifications
zmq-pub=tcp://127.0.0.1:18083
# Network peer settings
out-peers=32
in-peers=64
# Priority nodes - trusted nodes to connect to
add-priority-node=p2pmd.xmrvsbeast.com:18080
add-priority-node=nodes.hashvault.pro:18080
# DNS checkpointing and blocklist
enforce-dns-checkpointing=1
enable-dns-blocklist=1
# P2P and RPC bind settings
#p2p-bind-ip=0.0.0.0
#p2p-bind-port=18080
#rpc-bind-ip=0.0.0.0
#rpc-bind-port=18081
#confirm-external-bind=1
# RPC login credentials
#rpc-login=user:password
# Enable SSL for RPC connections
#rpc-ssl=1
#rpc-ssl-certificate=/path/to/your/certificate.pem
#rpc-ssl-private-key=/path/to/your/private_key.pem
# Logging settings
# Log levels: 0=minimal, 1=errors, 2=warnings, 3=info, 4=debug
log-level=3
log-file=/var/log/mond/mond.log
EOF
chown mond:mond /var/lib/mond/params.conf
chmod 640 /var/lib/mond/params.conf
fi
# 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 "📋 Configuration and startup:"
echo ""
echo "1. Review and configure settings (optional):"
echo " sudo nano /var/lib/mond/params.conf"
echo ""
echo " Adjust network settings, peer connections, and other options as needed."
echo ""
echo "2. Start Mond:"
echo " sudo systemctl enable mond.service"
echo " sudo systemctl start mond.service"
echo ""
echo "3. Check status:"
echo " sudo systemctl status mond.service"
echo " sudo journalctl -u mond -f"
echo ""
echo "📁 Important paths:"
echo " Config file: /var/lib/mond/params.conf"
echo " Data directory: /var/lib/mond/data"
echo " Log directory: /var/log/mond"
echo " Binary: /opt/mond/mond"
echo ""
echo "💡 Tip: Your params.conf will NOT be overwritten during package upgrades."
echo ""
echo "For help:"
echo " /opt/mond/mond --help"
echo ""
exit 0