From ca8d855eb0d9182bd1c24248872818701cba79e8 Mon Sep 17 00:00:00 2001 From: Desmond Chan Date: Tue, 31 Aug 2021 02:13:09 +0800 Subject: [Bugfix] Fix cp cannot stat error during installation (#1428) --- utils/installer/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils/installer/install.sh') diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 9e198274..c39f6c8e 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -214,7 +214,7 @@ function backup_old_config() { rsync --archive -hh --partial --progress --cvs-exclude \ --modify-window=1 "$dir"/ "$dir.bak" else - cp -R "$dir/*" "$dir.bak/." + cp -R "$dir/"* "$dir.bak/." fi done echo "Backup operation complete" -- cgit v1.2.3 From 67a0ee6fddf4c8ce7c5612ce32de684a0683e3ab Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Tue, 31 Aug 2021 12:24:33 +0430 Subject: Fix the installer copy command (#1432) --- utils/installer/install.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'utils/installer/install.sh') diff --git a/utils/installer/install.sh b/utils/installer/install.sh index c39f6c8e..ec9813cf 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -210,11 +210,23 @@ function backup_old_config() { # we create an empty folder for subsequent commands \ # that require an existing directory mkdir -p "$dir" "$dir.bak" + touch "$dir/ignore" if command -v rsync &>/dev/null; then rsync --archive -hh --partial --progress --cvs-exclude \ --modify-window=1 "$dir"/ "$dir.bak" else - cp -R "$dir/"* "$dir.bak/." + OS="$(uname -s)" + case "$OS" in + Linux) + cp -r "$dir/"* "$dir.bak/." + ;; + Darwin) + cp -R "$dir/"* "$dir.bak/." + ;; + *) + echo "OS $OS is not currently supported." + ;; + esac fi done echo "Backup operation complete" -- cgit v1.2.3 From 91180ce9991b469333adc6b4d44fe491eb727f48 Mon Sep 17 00:00:00 2001 From: premell <65544203+premell@users.noreply.github.com> Date: Sat, 4 Sep 2021 10:33:55 +0200 Subject: Update install.sh (#1465) --- utils/installer/install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'utils/installer/install.sh') diff --git a/utils/installer/install.sh b/utils/installer/install.sh index ec9813cf..02fc6800 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -60,15 +60,15 @@ EOF __add_separator "80" - echo "Would you like to check lunarvim's NodeJS dependencies?" + echo "Would you like to install lunarvim's NodeJS dependencies?" read -p "[y]es or [n]o (default: no) : " -r answer [ "$answer" != "${answer#[Yy]}" ] && install_nodejs_deps - echo "Would you like to check lunarvim's Python dependencies?" + echo "Would you like to install lunarvim's Python dependencies?" read -p "[y]es or [n]o (default: no) : " -r answer [ "$answer" != "${answer#[Yy]}" ] && install_python_deps - echo "Would you like to check lunarvim's Rust dependencies?" + echo "Would you like to install lunarvim's Rust dependencies?" read -p "[y]es or [n]o (default: no) : " -r answer [ "$answer" != "${answer#[Yy]}" ] && install_rust_deps -- cgit v1.2.3 From fcb764cd638ddffbe96228c6b3b1b8e0d40dbb23 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Mon, 13 Sep 2021 11:10:07 +0200 Subject: refactor(ci): better path handling (#1531) --- utils/installer/install.sh | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'utils/installer/install.sh') diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 02fc6800..876e3cd0 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -2,7 +2,7 @@ set -eo pipefail #Set branch to master unless specified by the user -declare -r LV_BRANCH="${LV_BRANCH:-rolling}" +declare LV_BRANCH="${LV_BRANCH:-"rolling"}" declare -r LV_REMOTE="${LV_REMOTE:-lunarvim/lunarvim.git}" declare -r INSTALL_PREFIX="${INSTALL_PREFIX:-"$HOME/.local"}" @@ -10,16 +10,16 @@ declare -r XDG_DATA_HOME="${XDG_DATA_HOME:-"$HOME/.local/share"}" declare -r XDG_CACHE_HOME="${XDG_CACHE_HOME:-"$HOME/.cache"}" declare -r XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"$HOME/.config"}" -# TODO: Use a dedicated cache directory #1256 -declare -r NEOVIM_CACHE_DIR="$XDG_CACHE_HOME/nvim" - declare -r LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvim"}" declare -r LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}" +# TODO: Use a dedicated cache directory #1256 +declare -r LUNARVIM_CACHE_DIR="$XDG_CACHE_HOME/nvim" +declare -r LUNARVIM_PACK_DIR="$LUNARVIM_RUNTIME_DIR/site/pack" declare -a __lvim_dirs=( "$LUNARVIM_CONFIG_DIR" "$LUNARVIM_RUNTIME_DIR" - "$NEOVIM_CACHE_DIR" # for now this is shared with neovim + "$LUNARVIM_CACHE_DIR" ) declare -a __npm_deps=( @@ -51,6 +51,7 @@ EOF detect_platform if [ -n "$GITHUB_ACTIONS" ]; then + LV_BRANCH="${GITHUB_REF##*/}" install_packer setup_lvim exit 0 @@ -91,11 +92,7 @@ EOF ;; esac - if [ -e "$LUNARVIM_RUNTIME_DIR/site/pack/packer/start/packer.nvim" ]; then - echo "Packer already installed" - else - install_packer - fi + install_packer __add_separator "80" @@ -233,8 +230,15 @@ function backup_old_config() { } function install_packer() { - git clone --depth 1 https://github.com/wbthomason/packer.nvim \ - "$LUNARVIM_RUNTIME_DIR/site/pack/packer/start/packer.nvim" + if [ -e "$LUNARVIM_PACK_DIR/packer/start/packer.nvim" ]; then + echo "Packer already installed" + else + if ! git clone --depth 1 "https://github.com/wbthomason/packer.nvim" \ + "$LUNARVIM_PACK_DIR/packer/start/packer.nvim"; then + echo "Failed to clone Packer. Installation failed." + exit 1 + fi + fi } function clone_lvim() { @@ -271,7 +275,7 @@ function setup_lvim() { cp "$LUNARVIM_RUNTIME_DIR/lvim/utils/installer/config.example-no-ts.lua" \ "$LUNARVIM_CONFIG_DIR/config.lua" - nvim -u "$LUNARVIM_RUNTIME_DIR/lvim/init.lua" --headless \ + "$INSTALL_PREFIX/bin/lvim" --headless \ -c 'autocmd User PackerComplete quitall' \ -c 'PackerSync' -- cgit v1.2.3 From e22f9a21c179901e6dfcbdb68d035e70eae4d9e8 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Thu, 16 Sep 2021 09:58:32 +0200 Subject: fix: more robust reloading (#1556) --- utils/installer/install.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'utils/installer/install.sh') diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 876e3cd0..d2295079 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -294,6 +294,8 @@ function update_lvim() { git -C "$LUNARVIM_RUNTIME_DIR/lvim" merge --ff-only --progress || echo "Unable to guarantee data integrity while updating. Please do that manually instead." && exit 1 fi + echo "Clearing up old startup cache" + "$INSTALL_PREFIX/bin/lvim" --headless +LvimCacheReset +q echo "Your LunarVim installation is now up to date!" } -- cgit v1.2.3 From 279d537e9c96759ec0372496b786a2d28247d093 Mon Sep 17 00:00:00 2001 From: Subho Banerjee Date: Tue, 21 Sep 2021 01:52:46 -0500 Subject: [Feature]: use yarn to install nodejs dependencies (#1565) * Add yarn support for installer script * Add non-interactive install * Fix installer script bug for cargo --- utils/installer/install.sh | 135 +++++++++++++++++++++++++++++++-------------- 1 file changed, 94 insertions(+), 41 deletions(-) (limited to 'utils/installer/install.sh') diff --git a/utils/installer/install.sh b/utils/installer/install.sh index d2295079..52d36581 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash + set -eo pipefail #Set branch to master unless specified by the user @@ -31,13 +32,42 @@ declare -a __pip_deps=( "pynvim" ) +function usage() { + echo "Usage: install.sh []" + echo "" + echo "Options:" + echo " -h, --help Print this help message" + echo " -y, --yes Yes for all choices (Install NodeJS, Python, Rust dependencies)" + echo " --overwrite Overwrite previous lvim configuration" +} + +function parse_arguments() { + while [ "$#" -gt 0 ]; do + case "$1" in + -y | --yes) + ARGS_INSTALL_NONINTERACTIVE="y" + ;; + --overwrite) + ARGS_OVERWRITE="y" + ;; + -h | --help) + usage + exit 0 + ;; + esac + shift + done +} + function main() { + parse_arguments "$@" + cat <<'EOF' - 88\ 88\ - 88 | \__| - 88 |88\ 88\ 888888$\ 888888\ 888888\ 88\ 88\ 88\ 888888\8888\ - 88 |88 | 88 |88 __88\ \____88\ 88 __88\\88\ 88 |88 |88 _88 _88\ + 88\ 88\ + 88 | \__| + 88 |88\ 88\ 888888$\ 888888\ 888888\ 88\ 88\ 88\ 888888\8888\ + 88 |88 | 88 |88 __88\ \____88\ 88 __88\\88\ 88 |88 |88 _88 _88\ 88 |88 | 88 |88 | 88 | 888888$ |88 | \__|\88\88 / 88 |88 / 88 / 88 | 88 |88 | 88 |88 | 88 |88 __88 |88 | \88$ / 88 |88 | 88 | 88 | 88 |\888888 |88 | 88 |\888888$ |88 | \$ / 88 |88 | 88 | 88 | @@ -61,17 +91,23 @@ EOF __add_separator "80" - echo "Would you like to install lunarvim's NodeJS dependencies?" - read -p "[y]es or [n]o (default: no) : " -r answer - [ "$answer" != "${answer#[Yy]}" ] && install_nodejs_deps + if [ -z "$ARGS_INSTALL_NONINTERACTIVE" ]; then + echo "Would you like to install lunarvim's NodeJS dependencies?" + read -p "[y]es or [n]o (default: no) : " -r answer + [ "$answer" != "${answer#[Yy]}" ] && install_nodejs_deps - echo "Would you like to install lunarvim's Python dependencies?" - read -p "[y]es or [n]o (default: no) : " -r answer - [ "$answer" != "${answer#[Yy]}" ] && install_python_deps + echo "Would you like to install lunarvim's Python dependencies?" + read -p "[y]es or [n]o (default: no) : " -r answer + [ "$answer" != "${answer#[Yy]}" ] && install_python_deps - echo "Would you like to install lunarvim's Rust dependencies?" - read -p "[y]es or [n]o (default: no) : " -r answer - [ "$answer" != "${answer#[Yy]}" ] && install_rust_deps + echo "Would you like to install lunarvim's Rust dependencies?" + read -p "[y]es or [n]o (default: no) : " -r answer + [ "$answer" != "${answer#[Yy]}" ] && install_rust_deps + else + install_nodejs_deps + install_python_deps + install_rust_deps + fi __add_separator "80" @@ -80,17 +116,17 @@ EOF __add_separator "80" - case "$@" in - *--overwrite*) - echo "!!Warning!! -> Removing all lunarvim related config \ - because of the --overwrite flag" + if [ -n "$ARGS_OVERWRITE" ]; then + echo "!!Warning!! -> Removing all lunarvim related config \ + because of the --overwrite flag" + if [ -z "$ARGS_INSTALL_NONINTERACTIVE" ]; then read -p "Would you like to continue? [y]es or [n]o : " -r answer [ "$answer" == "${answer#[Yy]}" ] && exit 1 - for dir in "${__lvim_dirs[@]}"; do - [ -d "$dir" ] && rm -rf "$dir" - done - ;; - esac + fi + for dir in "${__lvim_dirs[@]}"; do + [ -d "$dir" ] && rm -rf "$dir" + done + fi install_packer @@ -105,7 +141,6 @@ EOF fi __add_separator "80" - } function detect_platform() { @@ -133,14 +168,14 @@ function detect_platform() { } function print_missing_dep_msg() { - echo "[ERROR]: Unable to find dependency [$1]" - echo "Please install it first and re-run the installer. Try: $RECOMMEND_INSTALL $1" -} - -function check_dep() { - if ! command -v "$1" &>/dev/null; then - print_missing_dep_msg "$1" - exit 1 + if [ "$#" -eq 1 ]; then + echo "[ERROR]: Unable to find dependency [$1]" + echo "Please install it first and re-run the installer. Try: $RECOMMEND_INSTALL $1" + else + local cmds + cmds=$(for i in "$@"; do echo "$RECOMMEND_INSTALL $i"; done) + printf "[ERROR]: Unable to find dependencies [%s]" "$@" + printf "Please install any one of the dependencies and re-run the installer. Try: \n%s\n" "$cmds" fi } @@ -155,8 +190,7 @@ function check_system_deps() { fi } -function install_nodejs_deps() { - check_dep "npm" +function __install_nodejs_deps_npm() { echo "Installing node modules with npm.." for dep in "${__npm_deps[@]}"; do if ! npm ls -g "$dep" &>/dev/null; then @@ -167,6 +201,24 @@ function install_nodejs_deps() { echo "All NodeJS dependencies are succesfully installed" } +function __install_nodejs_deps_yarn() { + echo "Installing node modules with yarn.." + yarn global add "${__npm_deps[@]}" + echo "All NodeJS dependencies are succesfully installed" +} + +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 + eval "__install_nodejs_deps_$pkg_manager" + return + fi + done + print_missing_dep_msg "${pkg_managers[@]}" + exit 1 +} + function install_python_deps() { echo "Verifying that pip is available.." if ! python3 -m ensurepip &>/dev/null; then @@ -183,22 +235,23 @@ function install_python_deps() { } function __attempt_to_install_with_cargo() { - if ! command -v cargo &>/dev/null; then + if command -v cargo &>/dev/null; then echo "Installing missing Rust dependency with cargo" cargo install "$1" else - echo "[WARN]: Unable to find fd. Make sure to install it to avoid any problems" + echo "[WARN]: Unable to find cargo. Make sure to install it to avoid any problems" + exit 1 fi } # we try to install the missing one with cargo even though it's unlikely to be found function install_rust_deps() { - if ! command -v fd &>/dev/null; then - __attempt_to_install_with_cargo "fd-find" - fi - if ! command -v rg &>/dev/null; then - __attempt_to_install_with_cargo "ripgrep" - fi + local -a deps=("fd::fd-find" "rg::ripgrep") + for dep in "${deps[@]}"; do + if ! command -v "${dep%%::*}" &>/dev/null; then + __attempt_to_install_with_cargo "${dep##*::}" + fi + done echo "All Rust dependencies are succesfully installed" } -- cgit v1.2.3 From 938e0f88bc3c27ce019470e0279233a373df61ef Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Tue, 21 Sep 2021 11:56:24 +0200 Subject: fix: remove outdated cache files on install (#1591) --- utils/installer/install.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'utils/installer/install.sh') diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 52d36581..1bbb05c4 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -318,7 +318,23 @@ EOF chmod +x "$INSTALL_PREFIX/bin/lvim" } +function remove_old_cache_files() { + local packer_cache="$LUNARVIM_CONFIG_DIR/plugin/packer_compiled.lua" + if [ -e "$packer_cache" ]; then + echo "Removing old packer cache file" + rm -f "$packer_cache" + fi + + if [ -e "$LUNARVIM_CACHE_DIR/luacache" ] || [ -e "$LUNARVIM_CACHE_DIR/lvim_cache" ]; then + echo "Removing old startup cache file" + rm -f "$LUNARVIM_CACHE_DIR/{luacache,lvim_cache}" + fi +} + function setup_lvim() { + + remove_old_cache_files + echo "Installing LunarVim shim" setup_shim -- cgit v1.2.3 From e270bdbd6f9adfd9ae471512c63c3283798481f1 Mon Sep 17 00:00:00 2001 From: Subho Banerjee Date: Thu, 30 Sep 2021 11:53:14 -0500 Subject: [Bugfix]: Use local install in Github actions (#1628) Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com> --- utils/installer/install.sh | 69 +++++++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 26 deletions(-) (limited to 'utils/installer/install.sh') diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 1bbb05c4..d4daf55a 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -17,6 +17,15 @@ declare -r LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}" declare -r LUNARVIM_CACHE_DIR="$XDG_CACHE_HOME/nvim" declare -r LUNARVIM_PACK_DIR="$LUNARVIM_RUNTIME_DIR/site/pack" +declare BASEDIR +BASEDIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +BASEDIR="$(dirname -- "$(dirname -- "$BASEDIR")")" +readonly BASEDIR + +declare ARGS_LOCAL=0 +declare ARGS_OVERWRITE=0 +declare ARGS_INSTALL_DEPENDENCIES=1 + declare -a __lvim_dirs=( "$LUNARVIM_CONFIG_DIR" "$LUNARVIM_RUNTIME_DIR" @@ -36,19 +45,26 @@ function usage() { echo "Usage: install.sh []" echo "" echo "Options:" - echo " -h, --help Print this help message" - echo " -y, --yes Yes for all choices (Install NodeJS, Python, Rust dependencies)" - echo " --overwrite Overwrite previous lvim configuration" + echo " -h, --help Print this help message" + echo " -l, --local Install local copy of LunarVim" + echo " --overwrite Overwrite previous LunarVim configuration (a backup is always performed first)" + echo " --[no]-install-dependencies Wheter to prompt to install external dependencies (will prompt by default)" } function parse_arguments() { while [ "$#" -gt 0 ]; do case "$1" in - -y | --yes) - ARGS_INSTALL_NONINTERACTIVE="y" + -l | --local) + ARGS_LOCAL=1 ;; --overwrite) - ARGS_OVERWRITE="y" + ARGS_OVERWRITE=1 + ;; + --install-dependencies) + ARGS_INSTALL_DEPENDENCIES=1 + ;; + --no-install-dependencies) + ARGS_INSTALL_DEPENDENCIES=0 ;; -h | --help) usage @@ -80,18 +96,11 @@ EOF echo "Detecting platform for managing any additional neovim dependencies" detect_platform - if [ -n "$GITHUB_ACTIONS" ]; then - LV_BRANCH="${GITHUB_REF##*/}" - install_packer - setup_lvim - exit 0 - fi - check_system_deps __add_separator "80" - if [ -z "$ARGS_INSTALL_NONINTERACTIVE" ]; then + if [ "$ARGS_INSTALL_DEPENDENCIES" -eq 1 ]; then echo "Would you like to install lunarvim's NodeJS dependencies?" read -p "[y]es or [n]o (default: no) : " -r answer [ "$answer" != "${answer#[Yy]}" ] && install_nodejs_deps @@ -103,10 +112,6 @@ EOF echo "Would you like to install lunarvim's Rust dependencies?" read -p "[y]es or [n]o (default: no) : " -r answer [ "$answer" != "${answer#[Yy]}" ] && install_rust_deps - else - install_nodejs_deps - install_python_deps - install_rust_deps fi __add_separator "80" @@ -116,13 +121,7 @@ EOF __add_separator "80" - if [ -n "$ARGS_OVERWRITE" ]; then - echo "!!Warning!! -> Removing all lunarvim related config \ - because of the --overwrite flag" - if [ -z "$ARGS_INSTALL_NONINTERACTIVE" ]; then - read -p "Would you like to continue? [y]es or [n]o : " -r answer - [ "$answer" == "${answer#[Yy]}" ] && exit 1 - fi + if [ "$ARGS_OVERWRITE" -eq 1 ]; then for dir in "${__lvim_dirs[@]}"; do [ -d "$dir" ] && rm -rf "$dir" done @@ -136,7 +135,11 @@ EOF echo "Updating LunarVim" update_lvim else - clone_lvim + if [ -n "$ARGS_LOCAL" ]; then + link_local_lvim + else + clone_lvim + fi setup_lvim fi @@ -303,6 +306,20 @@ function clone_lvim() { fi } +function link_local_lvim() { + echo "Linking local LunarVim repo" + + # Detect whether it's a symlink or a folder + if [ -d "$LUNARVIM_RUNTIME_DIR/lvim" ]; then + echo "Removing old installation files" + rm -rf "$LUNARVIM_RUNTIME_DIR/lvim" + fi + + mkdir -p "$LUNARVIM_RUNTIME_DIR" + echo " - $BASEDIR -> $LUNARVIM_RUNTIME_DIR/lvim" + ln -s -f "$BASEDIR" "$LUNARVIM_RUNTIME_DIR/lvim" +} + function setup_shim() { if [ ! -d "$INSTALL_PREFIX/bin" ]; then mkdir -p "$INSTALL_PREFIX/bin" -- cgit v1.2.3 From 52dd273ca9bc552c9bacbdbf697818e75ee993d7 Mon Sep 17 00:00:00 2001 From: Jakpat Mingmongkolmitr Date: Fri, 1 Oct 2021 14:04:27 +0700 Subject: fix(installer): fix ARGS_LOCAL condition (#1649) --- utils/installer/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils/installer/install.sh') diff --git a/utils/installer/install.sh b/utils/installer/install.sh index d4daf55a..972534bd 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -135,7 +135,7 @@ EOF echo "Updating LunarVim" update_lvim else - if [ -n "$ARGS_LOCAL" ]; then + if [ "$ARGS_LOCAL" -eq 1 ]; then link_local_lvim else clone_lvim -- cgit v1.2.3 From a273c46eee751de4a61360ae0076ed4dac433e5d Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Fri, 1 Oct 2021 13:27:06 +0200 Subject: feat: add LvimUpdate command (#1634) * feat: add prelimenary LvimUpdate command * feat: use native process management * feat: add a telescope change-log utility * fix: update readme to include the new command --- utils/installer/install.sh | 89 +++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 52 deletions(-) (limited to 'utils/installer/install.sh') diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 972534bd..82e02358 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash - set -eo pipefail #Set branch to master unless specified by the user @@ -75,52 +74,40 @@ function parse_arguments() { done } +function msg() { + local text="$1" + local div_width="80" + printf "%${div_width}s\n" ' ' | tr ' ' - + printf "%s\n" "$text" +} + function main() { parse_arguments "$@" - cat <<'EOF' + print_logo - 88\ 88\ - 88 | \__| - 88 |88\ 88\ 888888$\ 888888\ 888888\ 88\ 88\ 88\ 888888\8888\ - 88 |88 | 88 |88 __88\ \____88\ 88 __88\\88\ 88 |88 |88 _88 _88\ - 88 |88 | 88 |88 | 88 | 888888$ |88 | \__|\88\88 / 88 |88 / 88 / 88 | - 88 |88 | 88 |88 | 88 |88 __88 |88 | \88$ / 88 |88 | 88 | 88 | - 88 |\888888 |88 | 88 |\888888$ |88 | \$ / 88 |88 | 88 | 88 | - \__| \______/ \__| \__| \_______|\__| \_/ \__|\__| \__| \__| - -EOF - - __add_separator "80" - - echo "Detecting platform for managing any additional neovim dependencies" + msg "Detecting platform for managing any additional neovim dependencies" detect_platform check_system_deps - __add_separator "80" - if [ "$ARGS_INSTALL_DEPENDENCIES" -eq 1 ]; then - echo "Would you like to install lunarvim's NodeJS dependencies?" + msg "Would you like to install lunarvim's NodeJS dependencies?" read -p "[y]es or [n]o (default: no) : " -r answer [ "$answer" != "${answer#[Yy]}" ] && install_nodejs_deps - echo "Would you like to install lunarvim's Python dependencies?" + msg "Would you like to install lunarvim's Python dependencies?" read -p "[y]es or [n]o (default: no) : " -r answer [ "$answer" != "${answer#[Yy]}" ] && install_python_deps - echo "Would you like to install lunarvim's Rust dependencies?" + msg "Would you like to install lunarvim's Rust dependencies?" read -p "[y]es or [n]o (default: no) : " -r answer [ "$answer" != "${answer#[Yy]}" ] && install_rust_deps fi - __add_separator "80" - - echo "Backing up old LunarVim configuration" + msg "Backing up old LunarVim configuration" backup_old_config - __add_separator "80" - if [ "$ARGS_OVERWRITE" -eq 1 ]; then for dir in "${__lvim_dirs[@]}"; do [ -d "$dir" ] && rm -rf "$dir" @@ -129,11 +116,8 @@ EOF install_packer - __add_separator "80" - if [ -e "$LUNARVIM_RUNTIME_DIR/lvim/init.lua" ]; then - echo "Updating LunarVim" - update_lvim + bash "$LUNARVIM_RUNTIME_DIR/lvim/utils/installer/update_lvim.sh" else if [ "$ARGS_LOCAL" -eq 1 ]; then link_local_lvim @@ -143,7 +127,9 @@ EOF setup_lvim fi - __add_separator "80" + msg "Thank you for installing LunarVim!!" + 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]" } function detect_platform() { @@ -287,18 +273,18 @@ function backup_old_config() { function install_packer() { if [ -e "$LUNARVIM_PACK_DIR/packer/start/packer.nvim" ]; then - echo "Packer already installed" + msg "Packer already installed" else if ! git clone --depth 1 "https://github.com/wbthomason/packer.nvim" \ "$LUNARVIM_PACK_DIR/packer/start/packer.nvim"; then - echo "Failed to clone Packer. Installation failed." + msg "Failed to clone Packer. Installation failed." exit 1 fi fi } function clone_lvim() { - echo "Cloning LunarVim configuration" + msg "Cloning LunarVim configuration" if ! git clone --branch "$LV_BRANCH" \ --depth 1 "https://github.com/${LV_REMOTE}" "$LUNARVIM_RUNTIME_DIR/lvim"; then echo "Failed to clone repository. Installation failed." @@ -338,12 +324,12 @@ EOF function remove_old_cache_files() { local packer_cache="$LUNARVIM_CONFIG_DIR/plugin/packer_compiled.lua" if [ -e "$packer_cache" ]; then - echo "Removing old packer cache file" + msg "Removing old packer cache file" rm -f "$packer_cache" fi if [ -e "$LUNARVIM_CACHE_DIR/luacache" ] || [ -e "$LUNARVIM_CACHE_DIR/lvim_cache" ]; then - echo "Removing old startup cache file" + msg "Removing old startup cache file" rm -f "$LUNARVIM_CACHE_DIR/{luacache,lvim_cache}" fi } @@ -352,7 +338,7 @@ function setup_lvim() { remove_old_cache_files - echo "Installing LunarVim shim" + msg "Installing LunarVim shim" setup_shim @@ -368,26 +354,25 @@ function setup_lvim() { echo "Packer setup complete" cp "$LUNARVIM_RUNTIME_DIR/lvim/utils/installer/config.example.lua" "$LUNARVIM_CONFIG_DIR/config.lua" - - echo "Thank you for installing LunarVim!!" - 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]" } function update_lvim() { - git -C "$LUNARVIM_RUNTIME_DIR/lvim" fetch --quiet - if ! git -C "$LUNARVIM_RUNTIME_DIR/lvim" diff --quiet "@{upstream}"; then - git -C "$LUNARVIM_RUNTIME_DIR/lvim" merge --ff-only --progress || - echo "Unable to guarantee data integrity while updating. Please do that manually instead." && exit 1 - fi - echo "Clearing up old startup cache" - "$INSTALL_PREFIX/bin/lvim" --headless +LvimCacheReset +q - echo "Your LunarVim installation is now up to date!" + "$INSTALL_PREFIX/bin/lvim" --headless +'LvimUpdate' +q } -function __add_separator() { - local DIV_WIDTH="$1" - printf "%${DIV_WIDTH}s\n" ' ' | tr ' ' - +function print_logo() { + cat <<'EOF' + + 88\ 88\ + 88 | \__| + 88 |88\ 88\ 888888$\ 888888\ 888888\ 88\ 88\ 88\ 888888\8888\ + 88 |88 | 88 |88 __88\ \____88\ 88 __88\\88\ 88 |88 |88 _88 _88\ + 88 |88 | 88 |88 | 88 | 888888$ |88 | \__|\88\88 / 88 |88 / 88 / 88 | + 88 |88 | 88 |88 | 88 |88 __88 |88 | \88$ / 88 |88 | 88 | 88 | + 88 |\888888 |88 | 88 |\888888$ |88 | \$ / 88 |88 | 88 | 88 | + \__| \______/ \__| \__| \_______|\__| \_/ \__|\__| \__| \__| + +EOF } main "$@" -- cgit v1.2.3 From 8e3cfb77e6b2e02100b937a590dc8d55c0255ecf Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Fri, 1 Oct 2021 16:49:32 +0200 Subject: fix(installer): add missing update call (#1653) --- utils/installer/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils/installer/install.sh') diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 82e02358..c26fd157 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -117,7 +117,7 @@ function main() { install_packer if [ -e "$LUNARVIM_RUNTIME_DIR/lvim/init.lua" ]; then - bash "$LUNARVIM_RUNTIME_DIR/lvim/utils/installer/update_lvim.sh" + update_lvim else if [ "$ARGS_LOCAL" -eq 1 ]; then link_local_lvim -- cgit v1.2.3 From 0a41e9e11801ebca60230a9a07ca2fa783787852 Mon Sep 17 00:00:00 2001 From: Lee Marlow Date: Sat, 2 Oct 2021 10:02:55 -0600 Subject: docs: spelling fixes and LunarVim name consistency (#1655) --- utils/installer/install.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'utils/installer/install.sh') diff --git a/utils/installer/install.sh b/utils/installer/install.sh index c26fd157..aaee515d 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -47,7 +47,7 @@ function usage() { echo " -h, --help Print this help message" echo " -l, --local Install local copy of LunarVim" echo " --overwrite Overwrite previous LunarVim configuration (a backup is always performed first)" - echo " --[no]-install-dependencies Wheter to prompt to install external dependencies (will prompt by default)" + echo " --[no]-install-dependencies Whether to prompt to install external dependencies (will prompt by default)" } function parse_arguments() { @@ -92,15 +92,15 @@ function main() { check_system_deps if [ "$ARGS_INSTALL_DEPENDENCIES" -eq 1 ]; then - msg "Would you like to install lunarvim's NodeJS dependencies?" + msg "Would you like to install LunarVim's NodeJS dependencies?" read -p "[y]es or [n]o (default: no) : " -r answer [ "$answer" != "${answer#[Yy]}" ] && install_nodejs_deps - msg "Would you like to install lunarvim's Python dependencies?" + msg "Would you like to install LunarVim's Python dependencies?" read -p "[y]es or [n]o (default: no) : " -r answer [ "$answer" != "${answer#[Yy]}" ] && install_python_deps - msg "Would you like to install lunarvim's Rust dependencies?" + msg "Would you like to install LunarVim's Rust dependencies?" read -p "[y]es or [n]o (default: no) : " -r answer [ "$answer" != "${answer#[Yy]}" ] && install_rust_deps fi @@ -187,13 +187,13 @@ function __install_nodejs_deps_npm() { npm install -g "$dep" fi done - echo "All NodeJS dependencies are succesfully installed" + echo "All NodeJS dependencies are successfully installed" } function __install_nodejs_deps_yarn() { echo "Installing node modules with yarn.." yarn global add "${__npm_deps[@]}" - echo "All NodeJS dependencies are succesfully installed" + echo "All NodeJS dependencies are successfully installed" } function install_nodejs_deps() { @@ -220,7 +220,7 @@ function install_python_deps() { for dep in "${__pip_deps[@]}"; do python3 -m pip install --user "$dep" done - echo "All Python dependencies are succesfully installed" + echo "All Python dependencies are successfully installed" } function __attempt_to_install_with_cargo() { @@ -241,7 +241,7 @@ function install_rust_deps() { __attempt_to_install_with_cargo "${dep##*::}" fi done - echo "All Rust dependencies are succesfully installed" + echo "All Rust dependencies are successfully installed" } function backup_old_config() { -- cgit v1.2.3