diff options
Diffstat (limited to 'utils/installer/install.sh')
-rwxr-xr-x | utils/installer/install.sh | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 1dc77513..c30f2efe 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -171,12 +171,11 @@ function print_missing_dep_msg() { } function check_neovim_min_version() { - # TODO: consider locking the requirement to 0.6+ - local verify_version_cmd='if !has("nvim-0.5.1") | cquit | else | quit | endif' + local verify_version_cmd='if !has("nvim-0.6.0") | cquit | else | quit | endif' # exit with an error if min_version not found if ! nvim --headless -u NONE -c "$verify_version_cmd"; then - echo "[ERROR]: LunarVim requires at least Neovim v0.5.1 or higher" + echo "[ERROR]: LunarVim requires at least Neovim v0.6.0 or higher" exit 1 fi } @@ -223,19 +222,29 @@ function __install_nodejs_deps_yarn() { function __validate_node_installation() { local pkg_manager="$1" local manager_home - manager_home="$($pkg_manager config get prefix 2>/dev/null)" + + if ! command -v "$pkg_manager" &>/dev/null; then + return 1 + fi + + if [ "$pkg_manager" == "npm" ]; then + manager_home="$(npm config get prefix 2>/dev/null)" + else + manager_home="$(yarn global bin 2>/dev/null)" + fi if [ ! -d "$manager_home" ] || [ ! -w "$manager_home" ]; then - echo "[ERROR] Unable to install without administrative privilages. Please set you NPM_HOME correctly and try again." - exit 1 + echo "[ERROR] Unable to install using [$pkg_manager] without administrative privileges." + return 1 fi + + return 0 } function install_nodejs_deps() { local -a pkg_managers=("yarn" "npm") for pkg_manager in "${pkg_managers[@]}"; do - if command -v "$pkg_manager" &>/dev/null; then - __validate_node_installation "$pkg_manager" + if __validate_node_installation "$pkg_manager"; then eval "__install_nodejs_deps_$pkg_manager" return fi @@ -343,18 +352,7 @@ function link_local_lvim() { } function setup_shim() { - if [ ! -d "$INSTALL_PREFIX/bin" ]; then - mkdir -p "$INSTALL_PREFIX/bin" - fi - cat >"$INSTALL_PREFIX/bin/lvim" <<EOF -#!/bin/sh - -export LUNARVIM_CONFIG_DIR="\${LUNARVIM_CONFIG_DIR:-$LUNARVIM_CONFIG_DIR}" -export LUNARVIM_RUNTIME_DIR="\${LUNARVIM_RUNTIME_DIR:-$LUNARVIM_RUNTIME_DIR}" - -exec nvim -u "\$LUNARVIM_RUNTIME_DIR/lvim/init.lua" "\$@" -EOF - chmod +x "$INSTALL_PREFIX/bin/lvim" + make -C "$LUNARVIM_BASE_DIR" install-bin } function remove_old_cache_files() { |