fix(install): make setup failures explicit and atomic
Installer pipelines masked dependency and download failures, causing false success messages and unsafe config replacement. Atomic updates and current upstream installers keep failures visible.
This commit is contained in:
+9
-11
@@ -1,7 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Save the original working directory
|
||||
ORIGINAL_DIR="$(pwd)"
|
||||
set -euo pipefail
|
||||
|
||||
NVM_VERSION="v0.40.4"
|
||||
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||
|
||||
# Install nvm (Node Version Manager) if it is not already installed
|
||||
if command -v nvm &> /dev/null; then
|
||||
@@ -9,19 +11,15 @@ if command -v nvm &> /dev/null; then
|
||||
else
|
||||
echo -e "Installing nvm (Node Version Manager)\n"
|
||||
# Using the official install script (https://github.com/nvm-sh/nvm)
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
|
||||
curl -fsSL "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" | bash
|
||||
|
||||
# Load nvm for the remainder of this script
|
||||
export NVM_DIR="${XDG_CONFIG_HOME:-$HOME/.nvm}"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
command -v nvm &> /dev/null
|
||||
fi
|
||||
|
||||
# OPTIONAL: Install the latest LTS version of Node.js
|
||||
# Uncomment the following line if you would like to automatically install it
|
||||
# Install the latest LTS version of Node.js
|
||||
nvm install --lts
|
||||
|
||||
# Apply the "basic" zsh configuration patch (downloads zshrc/basic.zsh to ~/.config/zshrc/basic.zsh)
|
||||
curl -s https://git.miomio.moe/mio/easyzsh/raw/branch/master/patch.sh | bash -s nvm
|
||||
|
||||
# Restore original working directory
|
||||
cd "$ORIGINAL_DIR"
|
||||
# Apply the nvm zsh configuration patch
|
||||
curl -fsSL https://git.miomio.moe/mio/easyzsh/raw/branch/master/patch.sh | bash -s -- nvm
|
||||
|
||||
Reference in New Issue
Block a user