File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ bash install.sh
4848
4949- 上述命令使用了[ 加速前缀] ( https://gh-proxy.org/ ) ,如失效可更换其他[ 可用链接] ( https://ghproxy.link/ ) 。
5050- 可通过 ` .env ` 文件或脚本参数自定义安装选项。
51+ - 在 WSL 环境中,不支持放在 Windows 挂载目录** /mnt/c/** 下,请安装到 Linux 原生目录。
5152
5253------
5354
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ source "$PROJECT_DIR/scripts/init/script.sh"
1414init_project_context " $PROJECT_DIR "
1515load_env_if_exists
1616detect_install_scope " ${1:- auto} "
17+ ensure_project_not_wsl_windows_mount
1718
1819ensure_openwrt_install_supported
1920ensure_required_commands
Original file line number Diff line number Diff line change @@ -233,6 +233,33 @@ init_project_context() {
233233 RESOURCE_DIR=" $PROJECT_DIR /resources"
234234}
235235
236+ is_wsl_env () {
237+ grep -qiE ' microsoft|wsl' /proc/sys/kernel/osrelease 2> /dev/null
238+ }
239+
240+ path_is_wsl_windows_mount () {
241+ local path=" $1 "
242+
243+ path=" $( readlink -f " $path " 2> /dev/null || printf ' %s' " $path " ) "
244+
245+ case " $path " in
246+ /mnt/[a-zA-Z]|/mnt/[a-zA-Z]/* )
247+ return 0
248+ ;;
249+ * )
250+ return 1
251+ ;;
252+ esac
253+ }
254+
255+ ensure_project_not_wsl_windows_mount () {
256+ if is_wsl_env && path_is_wsl_windows_mount " $PROJECT_DIR " ; then
257+ die_state \
258+ " 当前项目目录位于 WSL Windows 挂载盘:$PROJECT_DIR " \
259+ " 请将项目移动到 Linux 原生目录后重新安装,例如:cd ~ && git clone <repo> clash-for-linux && cd clash-for-linux && bash install.sh"
260+ fi
261+ }
262+
236263load_env_if_exists () {
237264 local env_file
238265 env_file=" $PROJECT_DIR /.env"
You can’t perform that action at this time.
0 commit comments