diff options
| author | Mitsuo Tokumori <[email protected]> | 2022-09-01 02:08:18 -0500 |
|---|---|---|
| committer | Mitsuo Tokumori <[email protected]> | 2022-09-01 02:08:18 -0500 |
| commit | 637de36e40185e67c51d2d85b6d61fafb3835248 (patch) | |
| tree | de6aaf15dd1e014568aae2e88874d05ab9438cdc /install.sh | |
| parent | d19f39580a3adddca8b2c26edc97b331dded495d (diff) | |
| download | dotfiles-637de36e40185e67c51d2d85b6d61fafb3835248.tar.gz dotfiles-637de36e40185e67c51d2d85b6d61fafb3835248.tar.bz2 dotfiles-637de36e40185e67c51d2d85b6d61fafb3835248.zip | |
Tidy up directory and install script. Add test.sh
Diffstat (limited to 'install.sh')
| -rwxr-xr-x[-rw-r--r--] | install.sh | 72 |
1 files changed, 44 insertions, 28 deletions
diff --git a/install.sh b/install.sh index 9fcd2fa..36c84b6 100644..100755 --- a/install.sh +++ b/install.sh @@ -10,54 +10,70 @@ # Note: This solution is lazy and causes some problems. Like not being able to # track vim pluggins. - # Config # ====== -platform="linux" # linux,windows -mode="copy" # copy,slink +mode=$1 # copy,slink + +# Prepare +# ======= -# Auto config -# =========== +# HOME variable must be available + +if [[ -z $XDG_CONFIG_HOME ]]; then + XDG_CONFIG_HOME="$HOME/.config" + mkdir -p $XDG_CONFIG_HOME +fi -# Append ~ later (bash only does 1 substitution of variables) -if [[ $platform = "linux" ]]; then - VIMFILES=".vim" -elif [[ $platform = "windows" ]]; then - VIMFILES="vimfiles" +if [[ $mode = "copy" ]]; then + cp_or_ln="cp" +elif [[ $mode = "slink" ]]; then + cp_or_ln="ln -s" # if you are fearless add the `-f` option +else + echo "Usage: $0 copy|slink" + exit fi -[[ $mode = "copy" ]] && cp_or_ln="cp" -[[ $mode = "slink" ]] && cp_or_ln="ln -s" +VIMFILES="$HOME/.vim" # In windows it's `%userprofile%/vimfiles/` -# Commands -# ======== +# Install +# ======= -# bash ( eval concatenates and executes) +# 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" +eval $cp_or_ln " ${PWD}/bash/profile $HOME/.profile" +eval $cp_or_ln " ${PWD}/bash/bashrc $HOME/.bashrc" +eval $cp_or_ln " ${PWD}/bash/bash_aliases $HOME/.bash_aliases" +eval $cp_or_ln " ${PWD}/bash/inputrc $HOME/.inputrc" # vim -# ~/.vimrc takes priority over ~/.vim/vimrc, so remove the former first +# `~/.vimrc` takes priority over `~/.vim/vimrc`. Remove the former if it exists -mkdir -p ~/$VIMFILES/{undo,swap,backup,plugins} -chmod 0700 ~/.vim/swap # swap files should only be readable by owner +mkdir -p $VIMFILES/{undo,swap,backup,plugins} +chmod 0700 $VIMFILES/swap # swap files should only be readable by owner -eval $cp_or_ln " ${PWD}/vim/vimrc ~/$VIMFILES/vimrc" -eval $cp_or_ln " ${PWD}/vim/fun.vim ~/$VIMFILES/fun.vim" +eval $cp_or_ln " ${PWD}/vim/vimrc $VIMFILES/vimrc" +eval $cp_or_ln " ${PWD}/vim/fun.vim $VIMFILES/fun.vim" # git -[ -d ~/.config/git ] || mkdir -p ~/.config/git -eval $cp_or_ln " ${PWD}/git/ignore ~/.config/git/ignore" -eval $cp_or_ln " ${PWD}/git/config ~/.config/git/config" -eval $cp_or_ln " ${PWD}/git/git-prompt.sh ~/.git-prompt.sh" +[ -d $XDG_CONFIG_HOME/git ] || mkdir -p $XDG_CONFIG_HOME/git +eval $cp_or_ln " ${PWD}/git/ignore $XDG_CONFIG_HOME/git/ignore" +eval $cp_or_ln " ${PWD}/git/config $XDG_CONFIG_HOME/git/config" +eval $cp_or_ln " ${PWD}/git/git-prompt.sh $HOME/.git-prompt.sh" + +# zathura + +mkdir -p $XDG_CONFIG_HOME/zathura +eval $cp_or_ln " ${PWD}/other/zathurarc $XDG_CONFIG_HOME/zathura/zathurarc" + +# tmux + +eval $cp_or_ln " ${PWD}/tmux/tmux.conf $HOME/.tmux.conf" +eval $cp_or_ln " ${PWD}/tmux/tmux.conf.local $HOME/.tmux.conf.local" # done |
