2023-10-01 20:04:37 +00:00
|
|
|
#!/bin/sh
|
2023-10-01 18:42:33 +00:00
|
|
|
# Save the current working directory
|
|
|
|
DIR=$(pwd)
|
2023-10-02 09:52:50 +00:00
|
|
|
SCRIPTS_DIR="$DIR/scripts"
|
2023-10-01 18:42:33 +00:00
|
|
|
|
|
|
|
# Go to the home directory
|
|
|
|
cd ~
|
|
|
|
|
|
|
|
# Begin Symlinks
|
|
|
|
echo "Linking dotfiles..."
|
|
|
|
|
|
|
|
LINKS='zshrc
|
|
|
|
gitconfig
|
|
|
|
gitconfig_work
|
|
|
|
gitignore_global
|
2023-10-01 20:21:49 +00:00
|
|
|
npmrc
|
|
|
|
hushlogin'
|
2023-10-01 18:42:33 +00:00
|
|
|
|
|
|
|
echo
|
|
|
|
for L in $LINKS; do
|
|
|
|
# check if the LINK exists, back up the existing version
|
|
|
|
if [[ -e ".$L" ]]; then
|
|
|
|
echo "Backing up .$L"
|
|
|
|
mv ".$L" ".$L.backup"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Linking .$L"
|
|
|
|
ln -s "$DIR/$L" ".$L"
|
|
|
|
done
|
|
|
|
echo
|
|
|
|
|
|
|
|
echo "Done linking dotfiles."
|
|
|
|
# End Symlinks
|
2023-10-01 19:20:42 +00:00
|
|
|
|
2023-10-02 09:52:50 +00:00
|
|
|
# Check if the "scripts" directory exists
|
|
|
|
if [ ! -d "$SCRIPTS_DIR" ]; then
|
|
|
|
echo "Error: The 'scripts' directory does not exist."
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-10-01 20:04:37 +00:00
|
|
|
|
2023-10-02 09:52:50 +00:00
|
|
|
# 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")
|
2023-10-01 20:04:37 +00:00
|
|
|
|
2023-10-02 09:52:50 +00:00
|
|
|
# Change the working directory to the "scripts" directory
|
|
|
|
cd "$SCRIPTS_DIR" || exit 1
|
2023-10-01 20:04:37 +00:00
|
|
|
|
2023-10-02 09:52:50 +00:00
|
|
|
# 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! :)"
|