This commit is contained in:
zj
2025-12-22 16:06:51 +08:00
parent 09bdfeaf6e
commit 5cd17413dc
3 changed files with 9 additions and 25 deletions

View File

@@ -103,33 +103,17 @@ else
fi
# try to find websockify (prefer local, try global, then download local)
if [[ -e ${HERE}/websockify ]]; then
WEBSOCKIFY=${HERE}/websockify/run
WEBSOCKIFY=$(which websockify 2>/dev/null)
if [[ ! -x $WEBSOCKIFY ]]; then
echo "The path ${HERE}/websockify exists, but $WEBSOCKIFY either does not exist or is not executable."
echo "If you inteded to use an installed websockify package, please remove ${HERE}/websockify."
exit 1
fi
if [[ $? -ne 0 ]]; then
# 如果系统PATH中找不到 websockify则尝试克隆
echo "No installed websockify, attempting to clone websockify..."
WEBSOCKIFY=${HERE}/websockify/run # 设定克隆后 websockify/run 的路径
echo "Using local websockify at $WEBSOCKIFY"
else
WEBSOCKIFY=$(which websockify 2>/dev/null)
if [[ $? -ne 0 ]]; then
echo "No installed websockify, attempting to clone websockify..."
WEBSOCKIFY=${HERE}/websockify/run
git clone https://github.com/kanaka/websockify ${HERE}/websockify
if [[ ! -e $WEBSOCKIFY ]]; then
echo "Unable to locate ${HERE}/websockify/run after downloading"
exit 1
fi
echo "Using local websockify at $WEBSOCKIFY"
else
echo "Using installed websockify at $WEBSOCKIFY"
fi
# 如果系统PATH中找到了 websockify
echo "Using installed websockify at $WEBSOCKIFY"
fi
echo "Starting webserver and WebSockets proxy on port ${PORT}"