From bccbcff3ab081ffdeb7c615cc42bfd84ae680dcb Mon Sep 17 00:00:00 2001 From: Lee Marlow Date: Wed, 15 Dec 2021 00:30:38 -0700 Subject: fix(installer): backup linked files with rsync (#2081) This allows backup to succeed for people who use symlinks for managing dotfiles. Currently errors with the following: ``` rsync error: some files/attrs were not transferred (see previous errors) (code 23) \ at main.c(1350) [sender=3.2.3] ```` --- utils/installer/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils/installer') diff --git a/utils/installer/install.sh b/utils/installer/install.sh index d420baed..61519998 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -288,7 +288,7 @@ function backup_old_config() { touch "$dir/ignore" msg "Backing up old $dir to $dir.bak" if command -v rsync &>/dev/null; then - rsync --archive -hh --stats --partial --cvs-exclude "$dir"/ "$dir.bak" + rsync --archive -hh --stats --partial --copy-links --cvs-exclude "$dir"/ "$dir.bak" else OS="$(uname -s)" case "$OS" in -- cgit v1.2.3 From 024c8111337105e7ca624aa71c9adb2f0718a15f Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Mon, 20 Dec 2021 09:00:04 +0100 Subject: fix(installer): check if npm-prefix is writable (#2091) --- utils/installer/install.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'utils/installer') diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 61519998..1dc77513 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -210,6 +210,7 @@ function __install_nodejs_deps_npm() { npm install -g "$dep" fi done + echo "All NodeJS dependencies are successfully installed" } @@ -219,10 +220,22 @@ function __install_nodejs_deps_yarn() { echo "All NodeJS dependencies are successfully installed" } +function __validate_node_installation() { + local pkg_manager="$1" + local manager_home + manager_home="$($pkg_manager config get prefix 2>/dev/null)" + + 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 + fi +} + 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" eval "__install_nodejs_deps_$pkg_manager" return fi -- cgit v1.2.3