|
7 | 7 | REPO="${REPO:-https-cert/deploy}" |
8 | 8 | BIN_NAME="${BIN_NAME:-anssl}" |
9 | 9 | VERSION="${VERSION:-latest}" |
10 | | -MIRROR="${MIRROR:-}" |
| 10 | +MIRROR="${MIRROR:-ghproxy}" |
11 | 11 | APP_DIR="${APP_DIR:-/opt/anssl}" |
12 | 12 | INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}" |
13 | 13 | CONFIG_DIR="${CONFIG_DIR:-$APP_DIR}" |
@@ -43,7 +43,7 @@ usage() { |
43 | 43 |
|
44 | 44 | 环境变量: |
45 | 45 | VERSION 安装版本,默认 latest,例如 v0.6.0 |
46 | | - MIRROR GitHub 代理,可选 ghproxy、ghproxy2 |
| 46 | + MIRROR 下载源,可选 ghproxy、github,默认 ghproxy |
47 | 47 | APP_DIR 程序目录,默认 /opt/anssl |
48 | 48 | INSTALL_DIR 命令链接目录,默认 /usr/local/bin |
49 | 49 | CONFIG_DIR 配置目录,默认等于 APP_DIR |
@@ -137,18 +137,14 @@ build_release_urls() { |
137 | 137 | checksum_url="${base_url}/checksums.txt" |
138 | 138 |
|
139 | 139 | case "$MIRROR" in |
140 | | - "") |
| 140 | + github) |
141 | 141 | ;; |
142 | 142 | ghproxy) |
143 | | - asset_url="https://ghproxy.net/${asset_url}" |
144 | | - checksum_url="https://ghproxy.net/${checksum_url}" |
145 | | - ;; |
146 | | - ghproxy2 | gh-proxy) |
147 | 143 | asset_url="https://gh-proxy.com/${asset_url}" |
148 | 144 | checksum_url="https://gh-proxy.com/${checksum_url}" |
149 | 145 | ;; |
150 | 146 | *) |
151 | | - log_error "不支持的镜像源: ${MIRROR},可选值: ghproxy, ghproxy2" |
| 147 | + log_error "不支持的下载源: ${MIRROR},可选值: ghproxy, github" |
152 | 148 | ;; |
153 | 149 | esac |
154 | 150 | } |
@@ -244,6 +240,39 @@ uninstall_anssl() { |
244 | 240 | log_info "卸载完成" |
245 | 241 | } |
246 | 242 |
|
| 243 | +# print_success_banner 输出安装完成后的摘要信息。 |
| 244 | +print_success_banner() { |
| 245 | + version_output="$("${INSTALL_DIR}/${BIN_NAME}" version 2>/dev/null || true)" |
| 246 | + if [ "$version_output" = "" ]; then |
| 247 | + version_output="${BIN_NAME} version unknown" |
| 248 | + fi |
| 249 | + |
| 250 | + cat <<EOF |
| 251 | +
|
| 252 | +------------------------------------------------------------ |
| 253 | + ___ _ _ ____ ____ _ |
| 254 | + / _ \ | \ | / ___/ ___|| | |
| 255 | + / /_\ \ | \| \___ \___ \| | |
| 256 | + / ___ \ | |\ | ___) |__) | |___ |
| 257 | + /_/ \_\|_| \_||____/____/|_____| |
| 258 | +
|
| 259 | + anssl 安装成功 |
| 260 | +
|
| 261 | + 版本: ${version_output} |
| 262 | + 程序: ${APP_DIR}/${BIN_NAME} |
| 263 | + 命令: ${INSTALL_DIR}/${BIN_NAME} |
| 264 | + 配置: ${CONFIG_DIR}/config.yaml |
| 265 | +
|
| 266 | + 卸载: |
| 267 | + curl -fsSL https://gh-proxy.com/https://raw.githubusercontent.com/https-cert/deploy/main/scripts/install.sh | sh -s -- --uninstall |
| 268 | +
|
| 269 | + 卸载并删除配置: |
| 270 | + curl -fsSL https://gh-proxy.com/https://raw.githubusercontent.com/https-cert/deploy/main/scripts/install.sh | sh -s -- --uninstall --purge |
| 271 | +------------------------------------------------------------ |
| 272 | +
|
| 273 | +EOF |
| 274 | +} |
| 275 | + |
247 | 276 | # main 执行下载、校验、解压和安装流程。 |
248 | 277 | main() { |
249 | 278 | parse_args "$@" |
@@ -287,9 +316,8 @@ main() { |
287 | 316 | log_info "准备配置目录 ${CONFIG_DIR}" |
288 | 317 | install_config |
289 | 318 |
|
290 | | - log_info "安装完成" |
291 | | - "${INSTALL_DIR}/${BIN_NAME}" version || true |
292 | | - printf '\n%s\n' "下一步:编辑 ${CONFIG_DIR}/config.yaml,填写 server.accessKey 后运行:" |
| 319 | + print_success_banner |
| 320 | + printf '%s\n' "下一步:编辑 ${CONFIG_DIR}/config.yaml,填写 server.accessKey 后运行:" |
293 | 321 | printf '%s\n' "${INSTALL_DIR}/${BIN_NAME} daemon -c ${CONFIG_DIR}/config.yaml" |
294 | 322 | } |
295 | 323 |
|
|
0 commit comments