fix: support arm64 in install-lua-language-server

get_arch() only handled x86_64, so arm64 machines failed with
"unsupported architecture: arm64". Also switch the bin symlink to a
wrapper script: lua-language-server locates main.lua relative to its
own unresolved argv[0], so launching it through a symlinked executable
(rather than a symlinked directory) made it fail to find main.lua.
main
Buddy 3 days ago
parent 99f1a7f6e1
commit 6b55be7df2

@ -13,12 +13,23 @@ main() (
extract_tarball "${URL}" "${DEST}/${VERSION}"
set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/lua-language-server" "${DEST}" bin/lua-language-server
# lua-language-server locates main.lua next to its own argv[0], without
# resolving symlinks, so it can't be launched through a symlinked
# executable (only a symlinked directory in the path works). Use a
# wrapper script instead of set_link.
cat >"${XDG_BIN_HOME}/lua-language-server" <<EOF
#!/usr/bin/env bash
exec "${DEST}/current/bin/lua-language-server" "\$@"
EOF
chmod +x "${XDG_BIN_HOME}/lua-language-server"
)
get_arch() (
case $(uname -m) in
x86_64*) echo x64 ;;
arm64*) echo arm64 ;;
aarch64*) echo arm64 ;;
*)
echo >&2 "unsupported architecture: $(uname -m)"
exit 1

Loading…
Cancel
Save