mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 08:30:45 +08:00
55 lines
2 KiB
Bash
55 lines
2 KiB
Bash
#!/bin/sh
|
|
# Resolve $0 through symlinks so basedir is the shim's real directory.
|
|
# Cap hops at the kernel's ELOOP limit so a cycle cannot hang the shim.
|
|
link="$0"
|
|
hops=0
|
|
while [ -L "$link" ] && [ "$hops" -lt 40 ]; do
|
|
hops=$((hops+1))
|
|
target=$(readlink "$link")
|
|
case "$target" in
|
|
/*) link="$target" ;;
|
|
*) link="$(dirname "$link")/$target" ;;
|
|
esac
|
|
done
|
|
basedir=$(dirname "$(echo "$link" | sed -e 's,\\,/,g')")
|
|
basedir_win="$basedir"
|
|
exe=""
|
|
msys=""
|
|
|
|
case `uname -a` in
|
|
*CYGWIN*|*MINGW*|*MSYS*)
|
|
if command -v cygpath > /dev/null 2>&1; then
|
|
basedir_win=`cygpath -w "$basedir"`
|
|
fi
|
|
exe=".exe"
|
|
msys="true"
|
|
;;
|
|
*WSL2*)
|
|
if command -v wslpath > /dev/null 2>&1; then
|
|
basedir_win="$(wslpath -w "$basedir" 2> /dev/null)"
|
|
if [ $? -ne 0 ] || [ -z "$basedir_win" ]; then
|
|
basedir_win="$basedir"
|
|
else
|
|
exe=".exe"
|
|
fi
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
if [ -z "$NODE_PATH" ]; then
|
|
export NODE_PATH="/mnt/d/code/gpt/dsh-im-ops/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/node_modules:/mnt/d/code/gpt/dsh-im-ops/node_modules/.pnpm/qrcode@1.5.4/node_modules:/mnt/d/code/gpt/dsh-im-ops/node_modules/.pnpm/node_modules"
|
|
else
|
|
export NODE_PATH="/mnt/d/code/gpt/dsh-im-ops/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/node_modules:/mnt/d/code/gpt/dsh-im-ops/node_modules/.pnpm/qrcode@1.5.4/node_modules:/mnt/d/code/gpt/dsh-im-ops/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
fi
|
|
if [ -n "$exe" ] && [ -x "$basedir/node.exe" ]; then
|
|
exec "$basedir/node.exe" "$basedir_win/../../bin/qrcode" "$@"
|
|
elif [ -x "$basedir/node" ]; then
|
|
exec "$basedir/node" "$basedir/../../bin/qrcode" "$@"
|
|
elif command -v node >/dev/null 2>&1; then
|
|
exec node "$basedir/../../bin/qrcode" "$@"
|
|
elif [ -n "$exe" ] && command -v node.exe >/dev/null 2>&1; then
|
|
exec node.exe "$basedir_win/../../bin/qrcode" "$@"
|
|
else
|
|
exec node "$basedir/../../bin/qrcode" "$@"
|
|
fi
|
|
# cmd-shim-target=D:/code/gpt/dsh-im-ops/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/bin/qrcode
|