mirror of
https://github.com/wnlen/clash-for-linux.git
synced 2026-03-21 22:06:45 +08:00
script
This commit is contained in:
@ -41,10 +41,29 @@ fi
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$PROJECT_DIR/scripts/get_cpu_arch.sh"
|
||||
# shellcheck disable=SC1091
|
||||
source "$PROJECT_DIR/scripts/resolve_clash.sh"
|
||||
# shellcheck disable=SC1091
|
||||
source "$PROJECT_DIR/scripts/service_lib.sh"
|
||||
|
||||
CLASH_BIN="$(resolve_clash_bin "$PROJECT_DIR" "${CpuArch:-}")"
|
||||
|
||||
if [ ! -x "$CLASH_BIN" ]; then
|
||||
echo "[ERROR] clash binary not found or not executable: $CLASH_BIN" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
test_config() {
|
||||
local bin="$1"
|
||||
local config="$2"
|
||||
"$bin" -t -f "$config" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
if ! test_config "$CLASH_BIN" "$CONFIG_FILE"; then
|
||||
echo "[ERROR] config test failed: $CONFIG_FILE" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# systemd 模式
|
||||
if [ "$FOREGROUND" = true ]; then
|
||||
write_run_state "running" "systemd"
|
||||
|
||||
Reference in New Issue
Block a user