67 lines
1.4 KiB
Bash
Executable File
67 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
# Save the current working directory
|
|
DIR=$(pwd)
|
|
SCRIPTS_DIR="$DIR/scripts"
|
|
|
|
# Go to the home directory
|
|
cd ~
|
|
|
|
# Begin Symlinks
|
|
echo "Linking dotfiles..."
|
|
|
|
LINKS='zshrc
|
|
gitconfig
|
|
gitconfig_work
|
|
gitignore_global
|
|
npmrc
|
|
hushlogin'
|
|
|
|
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
|
|
|
|
# Check if the "scripts" directory exists
|
|
if [ ! -d "$SCRIPTS_DIR" ]; then
|
|
echo "Error: The 'scripts' directory does not exist."
|
|
exit 1
|
|
fi
|
|
|
|
# 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")
|
|
|
|
# Change the working directory to the "scripts" directory
|
|
cd "$SCRIPTS_DIR" || exit 1
|
|
|
|
# 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! :)"
|