Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uplad local linux binary tar.gz file for aarch64 support #168

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lua/remote-nvim/providers/provider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ local utils = require("remote-nvim.utils")
local function get_copy_paths(copy_config)
local local_dirs = copy_config.dirs
if local_dirs == "*" then
return { utils.path_join(utils.is_windows, copy_config.base, ".") }
return { utils.path_join(utils.is_windows, copy_config.base) }
else
assert(
type(local_dirs) == "table",
Expand Down Expand Up @@ -168,7 +168,12 @@ function Provider:_setup_workspace_variables()
if self._host_config.neovim_version == nil then
local prompt_title

if provider_utils.is_binary_release_available(self._host_config.os, self._host_config.arch) then

if self.offline_mode and remote_nvim.config.offline_mode.no_github then
-- hard code to binary for offline mode, without github
self._host_config.neovim_install_method = "binary"
prompt_title = "Choose Neovim version to install"
elseif provider_utils.is_binary_release_available(self._host_config.os, self._host_config.arch) then
self._host_config.neovim_install_method = "binary"
prompt_title = "Choose Neovim version to install"
else
Expand Down Expand Up @@ -237,7 +242,7 @@ function Provider:_setup_workspace_variables()
utils.path_join(self._remote_is_windows, self._remote_workspace_id_path, path)
end
self._remote_neovim_config_path =
utils.path_join(self._remote_is_windows, self._remote_xdg_config_path, remote_nvim.config.remote.app_name)
utils.path_join(self._remote_is_windows, self._remote_xdg_config_path)

self:_add_session_info()
end
Expand Down
6 changes: 5 additions & 1 deletion lua/remote-nvim/providers/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ function M.get_offline_neovim_release_name(os, version, arch, release_type)
end

if os == "Linux" then
return ("nvim-%s-linux.appimage"):format(version)
if arch == "aarch64" then
return ("nvim-%s-linux-%s.tar.gz"):format(version, arch)
else
return ("nvim-%s-linux.appimage"):format(version)
end
elseif os == "macOS" then
if (version == "nightly") or (version ~= "stable" and is_later_neovim_version(version, "v0.9.5")) then
return ("nvim-%s-macos-%s.tar.gz"):format(version, arch)
Expand Down
40 changes: 39 additions & 1 deletion scripts/neovim_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,40 @@ function build_from_source() {
echo "Building and installation done"
}

function setup_neovim_linux_tar_gz() {
local version="$1"
local arch_type="$2"
local nvim_release_name="nvim-$version-linux-$arch_type.tar.gz"
local extract_dir="nvim-linux-$arch_type"

set +e # Prevent termination based on compare_version's return
compare_versions "$version" v0.9.5
local result=$?
set -e # Re-enable termination based on return values

if [[ $version != "nightly" ]] && [[ $version != "stable" ]] && [[ $result -ne 1 ]]; then
echo "Expected release to be nightly, stable or more recent than v0.9.5"
exit 1
fi

local nvim_linux_tar_path="$temp_dir/$nvim_release_name"
cp "$nvim_version_dir/$nvim_release_name" "$nvim_linux_tar_path"

if [ ! -e "$nvim_version_dir/$nvim_release_name" ]; then
echo "Expected release to be present at $nvim_version_dir/$nvim_release_name"
exit 1
fi

echo "Extracting Neovim binary..."
tar -xzf "$nvim_linux_tar_path" -C "$temp_dir"

echo "Finishing up Neovim installation..."
mkdir -p "$nvim_version_dir"
mv -f "$temp_dir"/"$extract_dir"/* "$nvim_version_dir"

echo "Neovim installation completed!"
}

# Install on Linux using AppImage
function setup_neovim_linux_appimage() {
local nvim_release_name="nvim-$1-linux.appimage"
Expand Down Expand Up @@ -169,7 +203,11 @@ function install_neovim() {

# Install Neovim based on the detected OS
if [[ $os == "Linux" ]]; then
setup_neovim_linux_appimage "$nvim_version"
if [[ $arch_type == "aarch64" ]]; then
setup_neovim_linux_tar_gz "$nvim_version" "$arch_type"
else
setup_neovim_linux_appimage "$nvim_version"
fi
elif [[ $os == "Darwin" ]]; then
setup_neovim_macos "$nvim_version" "$arch_type"
else
Expand Down