Fix: ensure /usr/local/bin exists before installing binary #109

Open
stahiga wants to merge 1 commit from stahiga/fix-missing-bin-dir into main
stahiga commented 2025-12-28 10:28:02 -05:00 (Migrated from github.com)

In certain environments (e.g., ubuntu desktop minimal), /usr/local/bin does not exist.
In such cases,installing fails to place the xray binary while not halting the script execution.
This PR adds a check to create the directory before installing the binary.

某些环境下/usr/local/bin没有被预安装。
这时脚本在执行安装xray binary逻辑时,会失败但不报错。
现在在install逻辑前增加了目录检查,如果目录不存在则创建。

In certain environments (e.g., ubuntu desktop minimal), `/usr/local/bin` does not exist. In such cases,installing fails to place the xray binary while not halting the script execution. This PR adds a check to create the directory before installing the binary. 某些环境下`/usr/local/bin`没有被预安装。 这时脚本在执行安装xray binary逻辑时,会失败但不报错。 现在在install逻辑前增加了目录检查,如果目录不存在则创建。
Meo597 commented 2025-12-28 11:43:49 -05:00 (Migrated from github.com)

Alpine不可能有这种问题,不应该检查

Alpine不可能有这种问题,不应该检查
stahiga commented 2025-12-28 12:37:28 -05:00 (Migrated from github.com)

这个修改是因为一个新环境安装(Ubuntu desktop minimal)中遇到的问题,
表明该目录在某些发行版中有不存在的可能,所以在安装逻辑中增加了目录检查。

Alpine 脚本只是保持一致性地采用了相同逻辑,已在 Alpine 镜像上验证可以正常运行。

这个修改是因为一个新环境安装(Ubuntu desktop minimal)中遇到的问题, 表明该目录在某些发行版中有不存在的可能,所以在安装逻辑中增加了目录检查。 Alpine 脚本只是保持一致性地采用了相同逻辑,已在 Alpine 镜像上验证可以正常运行。
Fangliding commented 2025-12-28 12:58:26 -05:00 (Migrated from github.com)

minimal的Ubuntu docker映像78.1MB都有这个文件夹 很难想象desktop minimal能没有
我搜了一下网上好像 类似的报错极度稀少且基本来自macos(显然不属于这个脚本的支持范围)
你确定没有这个文件夹是你使用的发行版预期的?你可以提供信息吗

minimal的Ubuntu docker映像78.1MB都有这个文件夹 很难想象desktop minimal能没有 我搜了一下网上好像 类似的报错极度稀少且基本来自macos(显然不属于这个脚本的支持范围) 你确定没有这个文件夹是你使用的发行版预期的?你可以提供信息吗
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin stahiga/fix-missing-bin-dir:stahiga/fix-missing-bin-dir
git switch stahiga/fix-missing-bin-dir

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff stahiga/fix-missing-bin-dir
git switch stahiga/fix-missing-bin-dir
git rebase main
git switch main
git merge --ff-only stahiga/fix-missing-bin-dir
git switch stahiga/fix-missing-bin-dir
git rebase main
git switch main
git merge --no-ff stahiga/fix-missing-bin-dir
git switch main
git merge --squash stahiga/fix-missing-bin-dir
git switch main
git merge --ff-only stahiga/fix-missing-bin-dir
git switch main
git merge stahiga/fix-missing-bin-dir
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
XTLS/Xray-install!109
No description provided.