Browse Source

[Fix] install script: Don’t attempt to `cd` twice.

Fixes #1137.
Jordan Harband 9 years ago
parent
commit
cb4e010de7
  1. 8
      install.sh

8
install.sh

@ -69,7 +69,7 @@ install_nvm_from_git() { @@ -69,7 +69,7 @@ install_nvm_from_git() {
if [ -d "$INSTALL_DIR/.git" ]; then
echo "=> nvm is already installed in $INSTALL_DIR, trying to update using git"
printf "\r=> "
cd "$INSTALL_DIR" && (git fetch 2> /dev/null || {
cd "$INSTALL_DIR" && (command git fetch 2> /dev/null || {
echo >&2 "Failed to update nvm, run 'git fetch' in $INSTALL_DIR yourself." && exit 1
})
else
@ -77,9 +77,11 @@ install_nvm_from_git() { @@ -77,9 +77,11 @@ install_nvm_from_git() {
echo "=> Downloading nvm from git to '$INSTALL_DIR'"
printf "\r=> "
mkdir -p "$INSTALL_DIR"
git clone "$(nvm_source)" "$INSTALL_DIR"
command git clone "$(nvm_source)" "$INSTALL_DIR" \
|| echo >&2 "Failed to clone nvm repo. Please report this!" && exit 1
cd "$INSTALL_DIR"
fi
cd "$INSTALL_DIR" && command git checkout --quiet "$(nvm_latest_version)"
command git checkout --quiet "$(nvm_latest_version)"
if [ ! -z "$(cd "$INSTALL_DIR" && git show-ref refs/heads/master)" ]; then
if git branch --quiet 2>/dev/null; then
cd "$INSTALL_DIR" && command git branch --quiet -D master >/dev/null 2>&1

Loading…
Cancel
Save