1
0
mirror of https://github.com/kremalicious/dotfiles.git synced 2024-11-22 09:47:21 +01:00
dotfiles/bin/update-dotfiles.sh

76 lines
2.3 KiB
Bash
Raw Normal View History

2015-07-26 20:27:32 +02:00
#!/usr/bin/env bash
2012-06-18 01:10:31 +02:00
#
# Pull in changes and make new symlinks
#
2012-06-18 01:10:31 +02:00
# adapted from @mathiasbynens & @michaeljsmalley
# https://github.com/mathiasbynens/dotfiles/blob/master/bootstrap.sh
# https://github.com/michaeljsmalley/dotfiles/blob/master/makesymlinks.sh
########################################################################
# ----------------------------------------------------------------------
# Variables
# ----------------------------------------------------------------------
2015-09-25 11:16:10 +02:00
$DOTFILES_DIR='~/Projects/dotfiles'
2012-06-18 01:10:31 +02:00
# dotfiles directory
2015-09-25 11:16:10 +02:00
dir=$DOTFILES_DIR
2014-11-03 17:40:13 +01:00
2012-06-18 01:10:31 +02:00
# list of files/folders to symlink in homedir
files="aliases bashrc bash_profile bash_paths bash_prompt exports gemrc gitconfig gitignore hushlogin inputrc private tm_properties npmrc bin"
2014-11-03 17:40:13 +01:00
2012-06-18 01:10:31 +02:00
# ----------------------------------------------------------------------
# change to the dotfiles directory
# ----------------------------------------------------------------------
2014-11-03 17:40:13 +01:00
2012-06-18 01:10:31 +02:00
cd $dir
2014-11-03 17:40:13 +01:00
2012-06-18 01:10:31 +02:00
# ----------------------------------------------------------------------
# pull in changes
# ----------------------------------------------------------------------
2014-11-03 17:40:13 +01:00
echo "$(tput setaf 136)"
echo " Getting changes "
echo "============================================="
echo "$(tput sgr0)" # reset
#git pull
echo "$(tput setaf 64)" # green
echo "---------------------------------------------"
echo " ✓ done"
echo "$(tput sgr0)" # reset
# ----------------------------------------------------------------------
# delete existing dotfiles in ~
# ----------------------------------------------------------------------
for file in $files; do
2015-07-26 20:27:32 +02:00
rm ~/.$file
2014-11-03 17:40:13 +01:00
done
2012-06-18 01:10:31 +02:00
# ----------------------------------------------------------------------
# create symlinks from the homedir to any files in the ~/dotfiles directory
2012-06-18 01:10:31 +02:00
# specified in $files
# ----------------------------------------------------------------------
2014-11-03 17:40:13 +01:00
2012-06-18 01:10:31 +02:00
for file in $files; do
ln -s $dir/$file ~/.$file
2014-11-03 17:40:13 +01:00
echo "$(tput setaf 64)$(tput sgr0) Created 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
# ----------------------------------------------------------------------
# source what we just created
# ----------------------------------------------------------------------
source ~/.bash_profile
echo "$(tput setaf 64)" # green
echo "---------------------------------------------"
echo " ✓ all done"
echo "$(tput sgr0)" # reset