aboutsummaryrefslogtreecommitdiff
path: root/bootstrap.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap.sh')
-rwxr-xr-xbootstrap.sh33
1 files changed, 30 insertions, 3 deletions
diff --git a/bootstrap.sh b/bootstrap.sh
index aea2465..f0876f9 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -2,6 +2,33 @@
dotfiles_dir=$(cd -- "$(dirname ${BASH_SOURCE})" > /dev/null 2>&1; pwd -P)
-ln -s $dotfiles_dir/.emacs.d $HOME/.emacs.d
-ln -s $dotfiles_dir/.macos $HOME/.macos
-ln -s $dotfiles_dir/.urlview $HOME/.urlview
+remove_and_link () {
+ for var in $@
+ do
+ if [ -L $HOME/$var ] && [ -e $HOME/$var ] && \
+ [ "$(readlink -- $HOME/$var)" = "$dotfiles_dir/$var" ]; then
+ return
+ fi
+
+ rm -rf $HOME/$var
+ ln -s $dotfiles_dir/$var $HOME/$var
+ done
+}
+
+link_all () {
+ remove_and_link .ctags.d .mutt bin .alias .macos \
+ .mbsyncrc .msmtprc .tmux.conf .urlview .zshrc \
+ .vimrc .vim
+}
+
+main () {
+ if [ $# -eq 0 ] || [ $1 -eq 'all' ]; then
+ link_all
+ return
+ fi
+
+ remove_and_link $@
+}
+
+main $@
+