2016-10-14 21:59:34 +02:00
|
|
|
#!/usr/bin/env bash
|
2012-06-18 01:10:31 +02:00
|
|
|
#
|
2014-05-23 17:01:28 +02:00
|
|
|
# creates symlinks from the home directory to
|
2012-06-18 01:10:31 +02:00
|
|
|
# any desired dotfiles in ~/dotfiles
|
2014-05-23 17:01:28 +02:00
|
|
|
#
|
2012-06-18 01:10:31 +02:00
|
|
|
# adapted from @michaeljsmalley
|
|
|
|
# https://github.com/michaeljsmalley/dotfiles/blob/master/makesymlinks.sh
|
|
|
|
########################################################################
|
|
|
|
|
2017-05-21 00:59:35 +02:00
|
|
|
set e
|
|
|
|
|
2012-06-18 01:10:31 +02:00
|
|
|
# list of files/folders to symlink in homedir
|
2020-11-12 21:50:22 +01:00
|
|
|
FILES="aliases exports private zshrc zprofile gitconfig gitignore hushlogin bin tmux.conf vimrc"
|
2014-11-03 17:40:13 +01:00
|
|
|
|
2017-05-21 00:59:35 +02:00
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
# create the private file first, will be symlinked but ignored by git
|
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
|
|
|
|
touch private
|
2012-06-18 01:10:31 +02:00
|
|
|
|
|
|
|
# ----------------------------------------------------------------------
|
2014-11-03 17:40:13 +01:00
|
|
|
# create symlinks from the homedir to any files in the dotfiles directory
|
2017-09-10 14:40:28 +02:00
|
|
|
# specified in $FILES
|
2012-06-18 01:10:31 +02:00
|
|
|
# ----------------------------------------------------------------------
|
2014-11-03 17:40:13 +01:00
|
|
|
|
2017-09-10 14:40:28 +02:00
|
|
|
for FILE in $FILES; do
|
|
|
|
|
|
|
|
# remove old symlinks if present
|
|
|
|
if [ -h "$HOME/.$FILE" ]; then
|
|
|
|
rm "$HOME/.$FILE"
|
|
|
|
echo "$(tput setaf 64)✓$(tput sgr0) Removed old symlink to $(tput setaf 37)$FILE$(tput sgr0)"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# symlink files
|
|
|
|
ln -s "$PWD/$FILE" "$HOME/.$FILE"
|
|
|
|
echo "$(tput setaf 64)✓$(tput sgr0) Created new symlink to $(tput setaf 37)$FILE$(tput sgr0)"
|
|
|
|
|
2012-06-18 01:10:31 +02:00
|
|
|
done
|
|
|
|
|
2014-11-03 17:40:13 +01:00
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
# Homebrew
|
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
|
2017-06-12 01:21:12 +02:00
|
|
|
echo "$(tput setaf 136) Brewing all the things. "
|
|
|
|
echo "=============================================$(tput sgr0)"
|
2014-11-03 17:40:13 +01:00
|
|
|
|
2017-09-10 14:40:28 +02:00
|
|
|
./bin/install-brew.sh
|
2014-11-03 17:40:13 +01:00
|
|
|
|
2017-06-12 01:21:12 +02:00
|
|
|
echo "$(tput setaf 64)---------------------------------------------"
|
|
|
|
echo " ✓ done$(tput sgr0)"
|
2014-11-03 17:40:13 +01:00
|
|
|
|
2019-08-19 00:37:26 +02:00
|
|
|
# ----------------------------------------------------------------------
|
2019-10-25 00:38:46 +02:00
|
|
|
# Prompt
|
2019-08-19 00:37:26 +02:00
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
|
2019-08-18 02:07:17 +02:00
|
|
|
# Switch to using brew-installed zsh as default shell
|
2023-01-24 14:15:02 +01:00
|
|
|
if [[ $(uname -m) == 'arm64' ]]; then
|
|
|
|
PATH_HOMEBREW=/opt/homebrew
|
|
|
|
else
|
|
|
|
PATH_HOMEBREW=/usr/local
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! grep -F -q "$PATH_HOMEBREW/bin/zsh" /etc/shells; then
|
|
|
|
echo "$PATH_HOMEBREW/bin/zsh" | sudo tee -a /etc/shells;
|
|
|
|
chsh -s $PATH_HOMEBREW/bin/zsh;
|
2019-08-18 02:07:17 +02:00
|
|
|
fi;
|
2014-11-03 17:40:13 +01:00
|
|
|
|
2017-06-12 01:21:12 +02:00
|
|
|
echo "$(tput setaf 64)============================================="
|
2014-11-03 17:40:13 +01:00
|
|
|
echo " ✓ all done"
|
2017-06-12 01:21:12 +02:00
|
|
|
echo "=============================================$(tput sgr0)"
|