summaryrefslogtreecommitdiffstats
path: root/install.sh
diff options
context:
space:
mode:
authorMitsuo Tokumori <[email protected]>2022-05-05 14:26:43 -0500
committerMitsuo Tokumori <[email protected]>2022-05-05 14:26:43 -0500
commit90f39c31e9f19bf51f0ceb9e21373dede01a4581 (patch)
tree767e3f88ba94e26db05685bab636b6aabd6a61cf /install.sh
parent57e7ad1f6d8fa823155ca414bba82ca2d497504f (diff)
parentaf0561f1d902d0fb84412ca6c301152ec44407c1 (diff)
downloaddotfiles-90f39c31e9f19bf51f0ceb9e21373dede01a4581.tar.gz
dotfiles-90f39c31e9f19bf51f0ceb9e21373dede01a4581.tar.bz2
dotfiles-90f39c31e9f19bf51f0ceb9e21373dede01a4581.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'install.sh')
-rw-r--r--install.sh49
1 files changed, 40 insertions, 9 deletions
diff --git a/install.sh b/install.sh
index ce12503..6d794b3 100644
--- a/install.sh
+++ b/install.sh
@@ -1,26 +1,57 @@
+# THIS IS CURRENTLY EXPERIMENTAL. REVIEW AND TEST FIRST. NEVER RUN ON MAIN
+# MACHINE WITHOUT A BACKUP OF VIMFILES AND DOTFILES
+
+
# Links configuration files to the ones listed here. Backup and remove your's
-# and then run this script (while inside repo directory).
+# and then run this script while inside repo directory.
+#
+# In Windows it has to be run with git-bash.
#
# Note: This solution is lazy and causes some problems. Like not being able to
# track vim pluggins.
-# bash
-ln -s ${PWD}/profile ~/.profile
-ln -s ${PWD}/bash_aliases ~/.bash_aliases
-ln -s ${PWD}/bashrc ~/.bashrc
-ln -s ${PWD}/inputrc ~/.inputrc
+# Config
+# ======
+
+platform="linux" # linux,windows
+mode="copy" # copy,slink
+
+
+# Auto config
+# ===========
+
+# Append ~ later (bash only does 1 substitution of variables)
+if [[ $platform = "linux" ]]; then
+ VIMFILES=".vim"
+elif [[ $platform = "windows" ]]; then
+ VIMFILES="vimfiles"
+fi
+
+[[ $mode = "copy" ]] && cp_or_ln="cp"
+[[ $mode = "slink" ]] && cp_or_ln="ln -s"
+
+
+# Commands
+# ========
+
+# bash ( eval concatenates and executes)
+
+eval $cp_or_ln " ${PWD}/profile ~/.profile"
+eval $cp_or_ln " ${PWD}/bash_aliases ~/.bash_aliases"
+eval $cp_or_ln " ${PWD}/bashrc ~/.bashrc"
+eval $cp_or_ln " ${PWD}/inputrc ~/.inputrc"
# vim
# ~/.vimrc takes priority over ~/.vim/vimrc, so remove the former first
-[ -d ~/.vim/ ] || mkdir -p ~/.vim/{undo,swap,backup,plugins}
+[ -d ~/.vim/ ] || mkdir -p ~/$VIMFILES/{undo,swap,backup,plugins}
chmod 0700 ~/.vim/swap # swap files should only be readable by owner
-ln -s ${PWD}/vim/vimrc ~/.vim/vimrc
-ln -s ${PWD}/vim/fun.vim ~/.vim/fun.vim
+eval $cp_or_ln " ${PWD}/vim/vimrc ~/$VIMFILES/vimrc"
+eval $cp_or_ln " ${PWD}/vim/fun.vim ~/$VIMFILES/fun.vim"
# done