优化 Debian 包管理,简化发行版配置
All checks were successful
Build and Release / build-and-test (arm64, alpine) (push) Successful in -11s
Build and Release / build-and-test (amd64, alpine) (push) Successful in -5s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in -1s
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in 8s
Build and Release / release (push) Successful in 37s

- CI:简化 Debian 包发布流程,统一使用 stable 发行版
- 移除 bookworm 和 trixie 多发行版支持,简化维护
- postinst:优化安装完成提示,提供清晰的配置和启动步骤
- postrm/prerm:改进卸载和升级前的清理逻辑
- README:更新安装说明,使用 stable 仓库
- install.deb.sh:同步更新仓库配置
This commit is contained in:
2025-12-25 10:38:40 +08:00
parent 20935a6c89
commit 9e30226769
6 changed files with 70 additions and 77 deletions

View File

@@ -134,29 +134,19 @@ jobs:
} }
done done
# 上传 Debian 包到 Debian Package Registry (支持多个发行版) # 上传 Debian 包到 Debian Package Registry (通用稳定版)
echo "" echo ""
echo "📦 上传 Debian 包到 Debian Package Registry..." echo "📦 上传 Debian 包到 Debian Package Registry..."
for file in *.deb; do for file in *.deb; do
[ ! -f "$file" ] && continue [ ! -f "$file" ] && continue
# 上传到 bookworm (Debian 12) # 上传到 stable (通用稳定版)
echo " ⬆️ $file → bookworm" echo " ⬆️ $file → stable"
curl -fsSL -X PUT \ curl -fsSL -X PUT \
-H "Authorization: token ${TOKEN}" \ -H "Authorization: token ${TOKEN}" \
--upload-file "$file" \ --upload-file "$file" \
"https://${REGISTRY}/api/packages/${OWNER}/debian/pool/bookworm/main/upload" || { "https://${REGISTRY}/api/packages/${OWNER}/debian/pool/stable/main/upload" || {
echo "❌ Debian 包上传失败: $file (bookworm)" echo "❌ Debian 包上传失败: $file (stable)"
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 exit 1
} }
done done
@@ -166,7 +156,7 @@ jobs:
echo "📝 生成 Release..." echo "📝 生成 Release..."
export REGISTRY OWNER TAG 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,"","### 📥 下载方式","","#### 方式 1: 直接下载(推荐)","","点击下面 **Assets** 部分的文件名直接下载。","","#### 方式 2: Generic Package Registry",""]+[f"- [`{f}`](https://{r}/api/packages/{o}/generic/{p}/{t}/{f})" for f in sorted(glob.glob("*.tar.gz"))]+["","#### 方式 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 xxxigcc","```","","**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 xxxigcc","```"];print(json.dumps({"tag_name":t,"name":f"Release {t}","body":"\n".join(b),"draft":False,"prerelease":False}))') 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,"","### 📥 下载方式","","#### 方式 1: 直接下载(推荐)","","点击下面 **Assets** 部分的文件名直接下载。","","#### 方式 2: Generic Package Registry",""]+[f"- [`{f}`](https://{r}/api/packages/{o}/generic/{p}/{t}/{f})" for f in sorted(glob.glob("*.tar.gz"))]+["","#### 方式 3: Debian Repository","","```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 stable main\" | sudo tee -a /etc/apt/sources.list.d/{o}.list","","# Update and install","sudo apt-get update","sudo apt-get install xxxigcc","```"];print(json.dumps({"tag_name":t,"name":f"Release {t}","body":"\n".join(b),"draft":False,"prerelease":False}))')
# 创建 Release # 创建 Release
echo "" echo ""

View File

@@ -12,40 +12,20 @@
- 📦 **多种安装方式** - 提供 Debian 包和通用二进制包 - 📦 **多种安装方式** - 提供 Debian 包和通用二进制包
- 🐧 **多发行版兼容** - 支持 Ubuntu、Debian 和 Alpine Linux - 🐧 **多发行版兼容** - 支持 Ubuntu、Debian 和 Alpine Linux
- 🎛️ **集中化管理** - 通过 Web UI 集中管理多个挖矿节点 - 🎛️ **集中化管理** - 通过 Web UI 集中管理多个挖矿节点
- 🔄 **自动更新** - 通过 Debian 仓库轻松安装和更新 - 🔄 **自动更新**:可通过 Debian 仓库安装(通用稳定版)
## 🚀 快速开始 ## 🚀 快速开始
### 方式一:Debian/Ubuntu推荐 ### Debian/Ubuntu推荐
#### Debian 12 (Bookworm)
```bash ```bash
# 1. 下载并添加 GPG 密钥 # 下载 GPG 密钥
sudo curl https://gitea.bcde.io/api/packages/wangdefa/debian/repository.key \ sudo curl https://gitea.bcde.io/api/packages/wangdefa/debian/repository.key -o /etc/apt/keyrings/gitea-wangdefa.asc
-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" | \ echo "deb [signed-by=/etc/apt/keyrings/gitea-wangdefa.asc] https://gitea.bcde.io/api/packages/wangdefa/debian stable main" | sudo tee -a /etc/apt/sources.list.d/wangdefa.list
sudo tee -a /etc/apt/sources.list.d/wangdefa.list
# 3. 安装 # 更新并安装
sudo apt-get update
sudo apt-get install xxxigcc
```
#### 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 update
sudo apt-get install xxxigcc sudo apt-get install xxxigcc
``` ```
@@ -54,10 +34,10 @@ sudo apt-get install xxxigcc
```bash ```bash
# 1. 下载对应架构的包 # 1. 下载对应架构的包
wget https://gitea.bcde.io/releases/download/VERSION/xxxigcc-amd64-ubuntu-VERSION.tar.gz wget https://gitea.bcde.io/releases/download/3.4.8-xg1/xxxigcc-amd64-ubuntu-3.4.8-xg1.tar.gz
# 2. 解压 # 2. 解压
tar -xzf xxxigcc-amd64-ubuntu-VERSION.tar.gz tar -xzf xxxigcc-amd64-ubuntu-3.4.8-xg1.tar.gz
cd xxxigcc cd xxxigcc
# 3. 编辑配置文件 # 3. 编辑配置文件

44
debian/postinst vendored
View File

@@ -56,27 +56,43 @@ fi
echo "" echo ""
echo "✅ XXXigCC installed successfully!" echo "✅ XXXigCC installed successfully!"
echo "" echo ""
echo "📋 Service Information:" echo "📋 Configuration and startup:"
echo "" echo ""
echo " xxxigcc-server - Control server with web UI (uses config_cc.json)" echo "1. Review and configure settings (optional):"
echo " xxxigcc-daemon - Mining client daemon (uses config.json, auto-calls xxxigMiner)" echo " For mining client:"
echo " sudo nano /etc/xxxigcc/config.json"
echo " For control server:"
echo " sudo nano /etc/xxxigcc/config_cc.json"
echo "" echo ""
echo "To start the server (central control):" echo " Adjust pool settings, wallet address, CC server, and other options as needed."
echo " sudo systemctl enable xxxigcc-server.service"
echo " sudo systemctl start xxxigcc-server.service"
echo "" echo ""
echo "To start the daemon (mining client):" echo "2. Start services:"
echo ""
echo " For mining client (daemon):"
echo " sudo systemctl enable xxxigcc-daemon.service" echo " sudo systemctl enable xxxigcc-daemon.service"
echo " sudo systemctl start xxxigcc-daemon.service" echo " sudo systemctl start xxxigcc-daemon.service"
echo "" echo ""
echo "Configuration files:" echo " For control server (optional, Web UI on port 3344):"
echo " /etc/xxxigcc/config.json - Daemon/Miner configuration" echo " sudo systemctl enable xxxigcc-server.service"
echo " /etc/xxxigcc/config_cc.json - Server configuration" echo " sudo systemctl start xxxigcc-server.service"
echo "" echo ""
echo "Binaries location:" echo "3. Check status:"
echo " /opt/xxxigcc/xxxigServer - Control server" echo " sudo systemctl status xxxigcc-daemon"
echo " /opt/xxxigcc/xxxigDaemon - Client daemon (auto-calls xxxigMiner)" echo " sudo journalctl -u xxxigcc-daemon -f"
echo " /opt/xxxigcc/xxxigMiner - Miner executable" echo ""
echo "📁 Important paths:"
echo " Config files: /etc/xxxigcc/config.json (daemon)"
echo " /etc/xxxigcc/config_cc.json (server)"
echo " Log directory: /var/log/xxxigcc"
echo " Binaries: /opt/xxxigcc/xxxigServer (control server)"
echo " /opt/xxxigcc/xxxigDaemon (mining daemon)"
echo " /opt/xxxigcc/xxxigMiner (miner executable)"
echo ""
echo "💡 Tip: Your config files will NOT be overwritten during package upgrades."
echo ""
echo "For help:"
echo " /opt/xxxigcc/xxxigDaemon --help"
echo " /opt/xxxigcc/xxxigServer --help"
echo "" echo ""
exit 0 exit 0

25
debian/postrm vendored
View File

@@ -3,28 +3,33 @@ set -e
case "$1" in case "$1" in
purge) purge)
# Remove log directory
rm -rf /var/log/xxxigcc
# Remove config directory
rm -rf /etc/xxxigcc
# Remove user and group # Remove user and group
if getent passwd xxxigcc >/dev/null; then if getent passwd xxxigcc >/dev/null; then
deluser --system xxxigcc 2>/dev/null || true deluser --quiet xxxigcc || true
fi fi
if getent group xxxigcc >/dev/null; then if getent group xxxigcc >/dev/null; then
delgroup --system xxxigcc 2>/dev/null || true delgroup --quiet xxxigcc || true
fi fi
# Remove data directories (only on purge)
rm -rf /var/log/xxxigcc
rm -rf /etc/xxxigcc
;; ;;
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
# Do nothing
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# Reload systemd # Reload systemd
if [ -d /run/systemd/system ]; then if [ -d /run/systemd/system ]; then
systemctl daemon-reload systemctl daemon-reload
fi fi
;;
esac
exit 0 exit 0

6
debian/prerm vendored
View File

@@ -4,11 +4,13 @@ set -e
# Stop services before removal # Stop services before removal
if [ -d /run/systemd/system ]; then if [ -d /run/systemd/system ]; then
for service in xxxigcc-server.service xxxigcc-daemon.service; do for service in xxxigcc-server.service xxxigcc-daemon.service; do
if systemctl is-active "$service" >/dev/null 2>&1; then if systemctl is-active --quiet "$service"; then
echo "Stopping $service..."
systemctl stop "$service" systemctl stop "$service"
fi fi
if systemctl is-enabled "$service" >/dev/null 2>&1; then if systemctl is-enabled --quiet "$service"; then
echo "Disabling $service..."
systemctl disable "$service" systemctl disable "$service"
fi fi
done done

View File

@@ -53,7 +53,7 @@ get_arch() {
# 添加 APT 源并更新 # 添加 APT 源并更新
add_apt_repository() { add_apt_repository() {
echo "deb [trusted=yes] https://${GITEA_SERVER}/api/packages/${GITEA_OWNER}/debian bookworm main" \ echo "deb [trusted=yes] https://${GITEA_SERVER}/api/packages/${GITEA_OWNER}/debian stable main" \
>/etc/apt/sources.list.d/xxxigcc.list >/etc/apt/sources.list.d/xxxigcc.list
apt-get update -qq apt-get update -qq
} }