mirror of
https://github.com/LunarVim/LunarVim.git
synced 2024-09-20 18:45:08 +02:00
feat(installer): handle INSTALL_PREFIX not on PATH (#2912)
This commit is contained in:
parent
7df4773b0b
commit
08b5e99f53
1 changed files with 26 additions and 7 deletions
|
@ -26,6 +26,7 @@ declare ARGS_LOCAL=0
|
||||||
declare ARGS_OVERWRITE=0
|
declare ARGS_OVERWRITE=0
|
||||||
declare ARGS_INSTALL_DEPENDENCIES=1
|
declare ARGS_INSTALL_DEPENDENCIES=1
|
||||||
declare INTERACTIVE_MODE=1
|
declare INTERACTIVE_MODE=1
|
||||||
|
declare ADDITIONAL_WARNINGS=""
|
||||||
|
|
||||||
declare -a __lvim_dirs=(
|
declare -a __lvim_dirs=(
|
||||||
"$LUNARVIM_CONFIG_DIR"
|
"$LUNARVIM_CONFIG_DIR"
|
||||||
|
@ -148,6 +149,7 @@ function main() {
|
||||||
|
|
||||||
setup_lvim
|
setup_lvim
|
||||||
|
|
||||||
|
msg "$ADDITIONAL_WARNINGS"
|
||||||
msg "Thank you for installing LunarVim!!"
|
msg "Thank you for installing LunarVim!!"
|
||||||
echo "You can start it by running: $INSTALL_PREFIX/bin/lvim"
|
echo "You can start it by running: $INSTALL_PREFIX/bin/lvim"
|
||||||
echo "Do not forget to use a font with glyphs (icons) support [https://github.com/ryanoasis/nerd-fonts]"
|
echo "Do not forget to use a font with glyphs (icons) support [https://github.com/ryanoasis/nerd-fonts]"
|
||||||
|
@ -226,7 +228,25 @@ function validate_lunarvim_files() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function validate_install_prefix() {
|
||||||
|
local prefix="$1"
|
||||||
|
case $PATH in
|
||||||
|
*"$prefix/bin"*)
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
local profile="$HOME/.profile"
|
||||||
|
test -z "$ZSH_VERSION" && profile="$HOME/.zshenv"
|
||||||
|
ADDITIONAL_WARNINGS="[WARN] the folder $prefix/bin is not on PATH, consider adding 'export PATH=$prefix/bin:\$PATH' to your $profile"
|
||||||
|
|
||||||
|
# avoid problems when calling any verify_* function
|
||||||
|
export PATH="$prefix/bin:$PATH"
|
||||||
|
}
|
||||||
|
|
||||||
function check_system_deps() {
|
function check_system_deps() {
|
||||||
|
|
||||||
|
validate_install_prefix "$INSTALL_PREFIX"
|
||||||
|
|
||||||
if ! command -v git &>/dev/null; then
|
if ! command -v git &>/dev/null; then
|
||||||
print_missing_dep_msg "git"
|
print_missing_dep_msg "git"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -279,7 +299,6 @@ function __validate_node_installation() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$manager_home" ] || [ ! -w "$manager_home" ]; then
|
if [ ! -d "$manager_home" ] || [ ! -w "$manager_home" ]; then
|
||||||
echo "[ERROR] Unable to install using [$pkg_manager] without administrative privileges."
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -294,21 +313,21 @@ function install_nodejs_deps() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
print_missing_dep_msg "${pkg_managers[@]}"
|
echo "[WARN]: skipping installing optional nodejs dependencies due to insufficient permissions."
|
||||||
exit 1
|
echo "check how to solve it: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally"
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_python_deps() {
|
function install_python_deps() {
|
||||||
echo "Verifying that pip is available.."
|
echo "Verifying that pip is available.."
|
||||||
if ! python3 -m ensurepip &>/dev/null; then
|
if ! python3 -m ensurepip >/dev/null; then
|
||||||
if ! python3 -m pip --version &>/dev/null; then
|
if ! python3 -m pip --version &>/dev/null; then
|
||||||
print_missing_dep_msg "pip"
|
echo "[WARN]: skipping installing optional python dependencies"
|
||||||
exit 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "Installing with pip.."
|
echo "Installing with pip.."
|
||||||
for dep in "${__pip_deps[@]}"; do
|
for dep in "${__pip_deps[@]}"; do
|
||||||
python3 -m pip install --user "$dep"
|
python3 -m pip install --user "$dep" || return 1
|
||||||
done
|
done
|
||||||
echo "All Python dependencies are successfully installed"
|
echo "All Python dependencies are successfully installed"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue