Skip to content

Commit 09af9a0

Browse files
CopilotNewFutureCopilot
authored
feat(install): 一键安装脚本 add POSIX-compatible one-click installation script with multilingual support and comprehensive testing (NewFuture#546)
* Initial plan * feat(install): add one-click installation script with multi-platform support Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com> * fix(install): address review feedback - POSIX sh compatibility, multilingual support, API proxy, and CI tests Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com> * fix(install): address feedback - simplify logic, update URLs, add OpenWrt testing, improve sudo handling Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com> * update scripts * mv test scripts * update test scirpts * update tests * fix tests * fix ci * update test * fix tests * set-ua * fix tests in docker * fix tests * fix version * fix version check * fix tests * fix proxy * fix tests * enhance download functionality with timeout and improved SSL handling * update proxy validation to use a real release asset for improved reliability * fix proxy * fix download result code * fix test proxy * fix ertry * fix retry * info message * update README and installation scripts to support remote URL and proxy configuration * wget 兼容 * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix libc detect * fix beta check --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com> Co-authored-by: New Future <NewFuture@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent f7a92b3 commit 09af9a0

9 files changed

Lines changed: 959 additions & 16 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ jobs:
256256
set -ex
257257
for f in output/*/ddns; do
258258
platform=$(basename $(dirname "$f") | tr '_' '/')
259-
docker/test-in-docker.sh $platform ${{matrix.libc}} "$f"
259+
tests/scripts/test-in-docker.sh $platform ${{matrix.libc}} "$f"
260260
done
261261
262262
# 输出目录结构扁平化

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ jobs:
213213
set -ex
214214
for f in output/*/ddns; do
215215
platform=$(basename $(dirname "$f") | tr '_' '/')
216-
docker/test-in-docker.sh $platform ${{matrix.libc}} "$f"
216+
tests/scripts/test-in-docker.sh $platform ${{matrix.libc}} "$f"
217217
done
218218
219219
# 输出目录结构扁平化

.github/workflows/test-install.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Test Install Script
2+
run-name: "Install Test: ${{ github.event_name == 'pull_request' && format('PR #{0}', github.event.pull_request.number) || github.ref_name }} | ${{ github.event.head_commit.message || github.event.pull_request.title || 'Manual trigger' }} by ${{ github.actor }}"
3+
4+
on:
5+
push:
6+
branches: [ master ]
7+
pull_request:
8+
branches: [ master ]
9+
paths:
10+
- 'install.sh'
11+
- '.github/workflows/test-install.yml'
12+
13+
jobs:
14+
test-install-script:
15+
name: Test on ${{ matrix.os }}
16+
runs-on: ${{ matrix.os }}
17+
env:
18+
# Remote installer from the current repository and commit
19+
RAW_URL: ${{ format('https://raw.githubusercontent.com/{0}/{1}/install.sh', github.repository, github.sha) }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, macos-13]
24+
25+
steps:
26+
- name: Test install script help
27+
run: curl -fsSL "$RAW_URL" | sh -s -- --help
28+
- name: Test with bash (if available)
29+
run: curl -fsSL "$RAW_URL" | bash -s -- --help
30+
31+
- name: Test install latest
32+
run: curl -fsSL "$RAW_URL" | sh
33+
- name: Check DDNS
34+
run: ddns --version
35+
- name: Test uninstall
36+
run: curl -fsSL "$RAW_URL" | sh -s -- --uninstall
37+
38+
39+
- name: Test install beta with language detection (zh_CN)
40+
run: curl -fsSL "$RAW_URL" | LANG=zh_CN.UTF-8 sh -s -- beta
41+
- name: Test install beta with language detection (zh_CN)
42+
run: curl -fsSL "$RAW_URL" | LANG=zh_CN.UTF-8 sh -s -- --help | grep -q "一键安装脚本"
43+
- name: Check DDNS
44+
run: ddns --version
45+
- name: Test uninstall
46+
run: curl -fsSL "$RAW_URL" | sh -s -- --uninstall
47+
48+
- name: Test install location by wget
49+
run: wget -qO - "$RAW_URL" | sh -s -- --install-dir /tmp/ddns
50+
- name: Check DDNS in custom location
51+
run: /tmp/ddns/ddns --version
52+
53+
test-with-container:
54+
name: Test on Container (${{ matrix.container }})
55+
runs-on: ubuntu-latest
56+
strategy:
57+
matrix:
58+
container:
59+
- alpine:latest
60+
- debian:latest
61+
- openwrt/rootfs:latest
62+
63+
container: ${{ matrix.container }}
64+
env:
65+
# Remote installer from the current repository and commit
66+
RAW_URL: ${{ format('https://raw.githubusercontent.com/{0}/{1}/install.sh', github.repository, github.sha) }}
67+
68+
steps:
69+
- name: install wget
70+
if: matrix.container == 'debian:latest'
71+
run: apt-get update && apt-get install -y wget
72+
- name: Download install script
73+
run: wget "$RAW_URL" && chmod +x install.sh
74+
75+
- name: Test install script help
76+
run: ./install.sh --help
77+
78+
- name: Test install latest
79+
run: ./install.sh
80+
- name: Check DDNS
81+
run: ddns --version
82+
- name: Test uninstall
83+
run: ./install.sh --uninstall
84+
85+
- name: Test install beta with language detection (zh_CN)
86+
run: LANG=zh_CN.UTF-8 ./install.sh beta
87+
- name: Check DDNS
88+
run: ddns --version
89+
- name: Test uninstall
90+
run: ./install.sh --uninstall

README.en.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
- **Configuration Methods:**
2222
- [Command Line Arguments](/doc/config/cli.en.md)
23-
- [JSON Configuration File](/doc/config/json.en.md) (supports single-file multi-provider and multiple config files)
23+
- [JSON Configuration File](/doc/config/json.en.md) (supports single-file multi-provider, multiple config files, and remote URL)
2424
- [Environment Variables](/doc/config/env.en.md)
2525
- [Provider Configuration Guide](/doc/providers/)
2626

@@ -64,11 +64,11 @@
6464

6565
### ① Installation
6666

67-
Choose one of the following methods: `binary` version, `pip` version, `source code` execution, or `Docker`.
67+
Choose one of the following methods: `Docker`, `binary` version, `pip` version, or `source code` execution.
6868

6969
Docker version is recommended for best compatibility, small size, and optimized performance.
7070

71-
- #### Docker (Requires Docker Installation)
71+
- #### Docker (Recommended)
7272

7373
For detailed instructions and advanced usage, see [Docker Usage Documentation](/doc/docker.en.md)
7474

@@ -101,15 +101,24 @@ Docker version is recommended for best compatibility, small size, and optimized
101101

102102
</details>
103103

104+
- #### Binary Version (Single file, no Python required)
105+
106+
Go to [releases to download the corresponding version](https://github.com/NewFuture/DDNS/releases/latest)
107+
108+
Or use the one‑click installation script to automatically download and install the binary for your platform:
109+
110+
```bash
111+
curl -fSL https://ddns.newfuture.cc/install.sh | sh
112+
```
113+
Note: Installing to system directories (e.g., /usr/local/bin) may require root or sudo; if permissions are insufficient, run as `sudo sh`.
114+
115+
For detailed instructions, see [Installation Documentation](doc/install.en.md)
116+
104117
- #### pip Installation (Requires pip or easy_install)
105118

106119
1. Install ddns: `pip install ddns` or `easy_install ddns`
107120
2. Run: `ddns -h` or `python -m ddns`
108121

109-
- #### Binary Version (Single file, no Python required)
110-
111-
Go to [releases to download the corresponding version](https://github.com/NewFuture/DDNS/releases/latest)
112-
113122
- #### Source Code Execution (No dependencies, requires Python environment)
114123

115124
1. Clone or [download this repository](https://github.com/NewFuture/DDNS/archive/master.zip) and extract

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
### ⚙️ 灵活配置
2424

2525
- **命令行参数**: `ddns --dns=dnspod --id=xxx --token=xxx` ([配置文档](doc/config/cli.md))
26-
- **JSON 配置文件**: 支持多域名、多服务商配置 ([配置文档](doc/config/json.md))
26+
- **JSON 配置文件**: 支持多域名、多服务商配置,支持远程URL配置 ([配置文档](doc/config/json.md))
2727
- **环境变量**: Docker 友好的配置方式 ([配置文档](doc/config/env.md))
2828

2929
### 🌍 DNS 服务商支持
@@ -50,11 +50,11 @@
5050

5151
### ① 安装
5252

53-
根据需要选择一种方式:`二进制`版、`pip`版、`源码`运行,或者 `Docker`
53+
根据需要选择一种方式:`一键脚本``二进制`版、`pip`版、`源码`运行,或者 `Docker`
5454

5555
推荐 Docker 版,兼容性最佳,体积小,性能优化。
5656

57-
- #### Docker(需要安装 Docker
57+
- #### Docker(推荐
5858

5959
详细说明和高级用法请查看 [Docker 使用文档](/doc/docker.md)
6060

@@ -87,15 +87,24 @@
8787

8888
</details>
8989

90+
- #### 二进制版(单文件,无需 python)
91+
92+
前往[release下载对应版本](https://github.com/NewFuture/DDNS/releases/latest)
93+
94+
也可使用一键安装脚本自动下载并安装对应平台的二进制:
95+
96+
```bash
97+
curl -fSL https://ddns.newfuture.cc/install.sh | sh
98+
```
99+
提示:安装到系统目录(如 /usr/local/bin)可能需要 root 或 sudo 权限;若权限不足,可改为 `sudo sh` 运行。
100+
101+
详细说明请查看 [一键安装文档](doc/install.md)
102+
90103
- #### pip 安装(需要 pip 或 easy_install)
91104

92105
1. 安装 ddns: `pip install ddns``easy_install ddns`
93106
2. 运行: `ddns -h` 或者 `python -m ddns`
94107

95-
- #### 二进制版(单文件,无需 python)
96-
97-
前往[release下载对应版本](https://github.com/NewFuture/DDNS/releases/latest)
98-
99108
- #### 源码运行(无任何依赖,需 python 环境)
100109

101110
1. clone 或者 [下载此仓库](https://github.com/NewFuture/DDNS/archive/master.zip) 并解压

doc/install.en.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# One-Click Installation Script
2+
3+
DDNS one-click installation script with support for automatic download and installation on Linux and macOS systems.
4+
5+
## Quick Installation
6+
7+
```bash
8+
# Install latest stable version online
9+
curl -fsSL https://ddns.newfuture.cc/install.sh | sh
10+
11+
# Use sudo if root permission is needed for system directory
12+
curl -fsSL https://ddns.newfuture.cc/install.sh | sudo sh
13+
14+
# Or using wget
15+
wget -qO- https://ddns.newfuture.cc/install.sh | sh
16+
```
17+
18+
> **Note:** Default installation to `/usr/local/bin`. If the directory requires administrator privileges, the script will automatically prompt to use sudo, or you can run with sudo in advance.
19+
20+
## Version Selection
21+
22+
```bash
23+
# Install latest stable version
24+
curl -fsSL https://ddns.newfuture.cc/install.sh | sh -s -- latest
25+
26+
# Install latest beta version
27+
curl -fsSL https://ddns.newfuture.cc/install.sh | sh -s -- beta
28+
29+
# Install specific version
30+
curl -fsSL https://ddns.newfuture.cc/install.sh | sh -s -- v4.0.2
31+
```
32+
33+
## Command Line Options
34+
35+
| Option | Description |
36+
|--------|-------------|
37+
| `latest` | Install latest stable version (default) |
38+
| `beta` | Install latest beta version |
39+
| `v4.0.2` | Install specific version |
40+
| `--install-dir PATH` | Specify installation directory (default: /usr/local/bin) |
41+
| `--proxy URL` | Specify proxy domain/prefix (e.g., `https://hub.gitmirror.com/`), overrides auto-detection |
42+
| `--force` | Force reinstallation |
43+
| `--uninstall` | Uninstall installed ddns |
44+
| `--help` | Show help information |
45+
46+
## Advanced Usage
47+
48+
```bash
49+
# Custom installation directory
50+
curl -fsSL https://ddns.newfuture.cc/install.sh | sh -s -- beta --install-dir ~/.local/bin
51+
52+
# Force reinstallation
53+
curl -fsSL https://ddns.newfuture.cc/install.sh | sh -s -- --force
54+
55+
# Uninstall
56+
curl -fsSL https://ddns.newfuture.cc/install.sh | sh -s -- --uninstall
57+
58+
# Specify proxy domain (override auto-detection)
59+
curl -fsSL https://ddns.newfuture.cc/install.sh | sh -s -- --proxy https://hub.gitmirror.com/
60+
```
61+
62+
## System Support
63+
64+
**Operating Systems:** Linux (glibc/musl), macOS
65+
**Architectures:** x86_64, ARM64, ARM v7, ARM v6, i386
66+
**Dependencies:** curl or wget
67+
68+
### Auto-Detection Features
69+
- **System Detection:** Automatically identifies operating system, architecture and libc type
70+
- **Tool Detection:** Automatically selects curl or wget download tool
71+
- **Network Optimization:** Automatically tests and selects the best download mirror (github.com → China mirror sites)
72+
- **Manual Override:** Use `--proxy` to specify a proxy domain/mirror prefix, which takes precedence over auto-detection
73+
74+
## Verify Installation
75+
76+
```bash
77+
ddns --version # Check version
78+
which ddns # Check installation location
79+
```
80+
81+
## Update & Uninstall
82+
83+
```bash
84+
# Update to latest version
85+
curl -fsSL https://ddns.newfuture.cc/install.sh | sh -s -- latest
86+
87+
# Uninstall
88+
curl -fsSL https://ddns.newfuture.cc/install.sh | sh -s -- --uninstall
89+
90+
# Manual uninstall
91+
sudo rm -f /usr/local/bin/ddns
92+
```
93+
94+
## Troubleshooting
95+
96+
**Permission Issues:** Use `sudo` or install to user directory
97+
**Network Issues:** Script automatically uses mirror sites (hub.gitmirror.com, proxy.gitwarp.com, etc.)
98+
**Unsupported Architecture:** Check [releases page](https://github.com/NewFuture/DDNS/releases) for supported architectures
99+
**Proxy Environment:** The script respects system proxy settings (`HTTP_PROXY/HTTPS_PROXY`); you can also use `--proxy https://hub.gitmirror.com/` to specify a GitHub mirror prefix (overrides auto-detection)

0 commit comments

Comments
 (0)