From 68662a157590e61e317aa3dc5f891994d6530ca1 Mon Sep 17 00:00:00 2001 From: James Date: Mon, 2 Oct 2023 10:52:50 +0100 Subject: [PATCH] fix: brew installation --- install.sh | 38 ++++++++++++++++++++++++++++-------- scripts/install-homebrew.sh | 8 ++++---- scripts/install-oh-my-zsh.sh | 2 +- scripts/install-volta.sh | 1 + 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/install.sh b/install.sh index 29f8407..dc474b1 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,7 @@ #!/bin/sh # Save the current working directory DIR=$(pwd) +SCRIPTS_DIR="$DIR/scripts" # Go to the home directory cd ~ @@ -31,14 +32,35 @@ echo echo "Done linking dotfiles." # End Symlinks -# Set up macOS defaults -./scripts/set-mac-defaults.sh +# Check if the "scripts" directory exists +if [ ! -d "$SCRIPTS_DIR" ]; then + echo "Error: The 'scripts' directory does not exist." + exit 1 +fi -# Install Homebrew, packages and applications -./scripts/install-homebrew.sh +# List of scripts to be executed (replace these with your script names) +SCRIPTS=("set-mac-defaults.sh" "install-homebrew.sh" "install-oh-my-zsh.sh" "install-volta.sh") -# Install Oh My Zsh -./scripts/install-oh-my-zsh.sh +# Change the working directory to the "scripts" directory +cd "$SCRIPTS_DIR" || exit 1 -# Install Volta -./scripts/install-volta.sh +# Iterate over the scripts and execute them +for script in "${SCRIPTS[@]}"; do + + # Check if the script file exists + if [ ! -f "$script" ]; then + echo "Warning: Script '$script' not found in the 'scripts' directory." + continue + fi + + # Execute the script + echo "Executing '$script'..." + chmod +x "$script" # Ensure the script is executable + "./$script" # Execute the script + echo "Finished executing '$script'." +done + +# Return to the original directory (optional) +cd - > /dev/null + +echo "new Compooper successful! :)" diff --git a/scripts/install-homebrew.sh b/scripts/install-homebrew.sh index 64db953..4e67a3d 100755 --- a/scripts/install-homebrew.sh +++ b/scripts/install-homebrew.sh @@ -1,6 +1,6 @@ -#!/bin/sh -# -# Homebrew +#!/bin/bash + +# Homebrew installation # Check for Homebrew if test ! $(which brew) @@ -10,7 +10,7 @@ then /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" fi -brew update > /dev/null +brew update-reset echo "Installing Homebrew packages..." echo diff --git a/scripts/install-oh-my-zsh.sh b/scripts/install-oh-my-zsh.sh index 73aa6b4..e4d7307 100755 --- a/scripts/install-oh-my-zsh.sh +++ b/scripts/install-oh-my-zsh.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Install oh-my-zsh sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" diff --git a/scripts/install-volta.sh b/scripts/install-volta.sh index 93a62cb..1fd9d51 100644 --- a/scripts/install-volta.sh +++ b/scripts/install-volta.sh @@ -1,4 +1,5 @@ #!/bin/bash + echo "Installing Volta..." echo curl https://get.volta.sh | bash