-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·68 lines (56 loc) · 1.98 KB
/
install.sh
File metadata and controls
executable file
·68 lines (56 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
set -euo pipefail
sed -i 's/\r$//' "$0" 2>/dev/null || true
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$PROJECT_DIR/scripts/core/common.sh"
source "$PROJECT_DIR/scripts/core/runtime.sh"
source "$PROJECT_DIR/scripts/core/config.sh"
source "$PROJECT_DIR/scripts/init/systemd.sh"
source "$PROJECT_DIR/scripts/init/systemd-user.sh"
source "$PROJECT_DIR/scripts/init/script.sh"
init_project_context "$PROJECT_DIR"
load_env_if_exists
detect_install_scope "${1:-auto}"
ensure_openwrt_install_supported
ensure_required_commands
init_layout
ensure_dashboard_deploy_prerequisites
resolve_runtime_kernel
resolve_yq
resolve_subconverter
mark_install_environment || true
mark_install_plan || true
mark_install_port_plan || true
install_clashctl_entry
install_shell_alias_entry
install_runtime_entry
install_local_dashboard_assets
ensure_controller_secret >/dev/null
set_shell_proxy_persist_enabled "false"
ensure_subscription_bootstrap_for_install "default"
prompt_subscription_if_needed
if [ -n "$(subscription_url 2>/dev/null || true)" ]; then
if generate_config; then
if [ -n "${INSTALL_PENDING_SUBSCRIPTION_URL:-}" ]; then
write_env_value "CLASH_SUBSCRIPTION_URL" "$INSTALL_PENDING_SUBSCRIPTION_URL"
fi
echo "✨ 订阅已生效"
post_install_verify
else
write_runtime_value "INSTALL_VERIFY_CONFIG_READY" "false"
write_runtime_value "INSTALL_VERIFY_RUNTIME_READY" "false"
write_runtime_value "INSTALL_VERIFY_CONTROLLER_READY" "false"
echo
echo "❗ 安装未完成:订阅编译失败"
if [ -n "$(read_build_value "BUILD_LAST_ERROR_SUMMARY" 2>/dev/null || true)" ]; then
echo "❌ 原因:$(read_build_value "BUILD_LAST_ERROR_SUMMARY" 2>/dev/null || true)"
fi
if [ -f "$RUNTIME_DIR/tmp/subscription-invalid-preview.txt" ]; then
echo "🧾 调试预览:$RUNTIME_DIR/tmp/subscription-invalid-preview.txt"
fi
echo "👉 下一步:clashctl doctor"
echo
exit 1
fi
fi
print_install_summary