diff options
| -rwxr-xr-x | install.sh | 134 | ||||
| -rw-r--r-- | linking_example.sh | 37 | ||||
| -rwxr-xr-x | test.sh | 12 |
3 files changed, 37 insertions, 146 deletions
diff --git a/install.sh b/install.sh deleted file mode 100755 index aaf906c..0000000 --- a/install.sh +++ /dev/null @@ -1,134 +0,0 @@ -# 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. -# -# 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. -# -# As always, ArchLinux's Wiki has a great article explaining dotfiles and how -# people usually manage them. -# https://wiki.archlinux.org/title/Dotfiles - - -# FIXME: This is broken since I moved the directories. Change all $PWD with -# $PWD/config and it should work. But make this simpler. The "copy" -# mode is useless. Each user should have a copy of this and then use the -# "slink" mode. That way you can keep track of changes made, and then -# even add a branch (e.g., pulse15, x220) to the repo. -exit - - -# Config -# ====== - -mode=$1 # copy,slink - - -# Prepare -# ======= - -# HOME variable must be available - -if [[ -z $XDG_CONFIG_HOME ]]; then - XDG_CONFIG_HOME="$HOME/.config" - mkdir -p $XDG_CONFIG_HOME -fi - -if [[ $mode = "--help" ]]; then - echo "You might want to first run: $0 echo" - echo "Revise the output" - echo "And only then run: $0 slink" - exit -elif [[ $mode = "copy" ]]; then - cp_or_ln="cp" - echo Why? Custom modifications will be difficult to track. - echo Maybe not a good idea. Good bye. - exit -elif [[ $mode = "slink" ]]; then - cp_or_ln="ln -siv" # if you are fearless add the `-f` option -elif [[ $mode = "echo" ]]; then - cp_or_ln="echo ln -siv" -else - echo "Usage: $0 copy|slink|echo" - exit -fi - -prompt() { - read -p "Install $1 configuration files? [Y/n/e(exit)] " yesno - yesno=$(echo $yesno | tr '[:upper:]' '[:lower:]') - case $yesno in - y | yes | "" ) - return 0;; - e | exit ) - exit;; - * ) - return 1;; - esac -} - - -# Install -# ======= - -# FIXME: If $PWD has spaces in it, this might fail. - -# Filewise -# -------- - -if prompt "bash"; then - eval $cp_or_ln " ${PWD}/bash/bash_profile $HOME/.bash_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" -fi - -if prompt "vim"; then - # `~/.vimrc` takes priority over `~/.vim/vimrc`. Remove the former if it - # exists. - # - # In windows it's `%userprofile%/vimfiles/` - - VIMFILES="$HOME/.vim" - mkdir -p $VIMFILES/{undo,swap,backup,plugins} - chmod 0700 $VIMFILES/swap - - eval $cp_or_ln " ${PWD}/vim/vimrc $VIMFILES/vimrc" - eval $cp_or_ln " ${PWD}/vim/fun.vim $VIMFILES/fun.vim" -fi - -if prompt "Xorg"; then - eval $cp_or_ln " ${PWD}/xorg/xinitrc $HOME/.xinitrc" - eval $cp_or_ln " ${PWD}/xorg/xbindkeysrc $HOME/.xbindkeysrc" -fi - -# Directorywise -# ------------- - -if prompt "nvim"; then - eval $cp_or_ln " ${PWD}/nvim $XDG_CONFIG_HOME" -fi - -if prompt "tmux"; then - eval $cp_or_ln " ${PWD}/tmux $XDG_CONFIG_HOME" -fi - -if prompt "git"; then - eval $cp_or_ln " ${PWD}/git $XDG_CONFIG_HOME" - eval $cp_or_ln " ${PWD}/git/git-prompt.sh $HOME/.git-prompt.sh" -fi - - -if prompt "zathura"; then - eval $cp_or_ln " ${PWD}/zathura $XDG_CONFIG_HOME" -fi - -if prompt "mpv"; then - eval $cp_or_ln " ${PWD}/mpv $XDG_CONFIG_HOME" -fi - -echo "all done :)" diff --git a/linking_example.sh b/linking_example.sh new file mode 100644 index 0000000..2c539e6 --- /dev/null +++ b/linking_example.sh @@ -0,0 +1,37 @@ +# If dotfiles is placed in home directory, the following commands should work. +# Nevertheless, I don't maintain this file, so just use it as reference. + +# WARNING: if $HOME contains spaces this breaks + +dotfiles=$HOME/dotfiles + +# you can play with ln options (e.g., `ln -siv`) + +cd $HOME +ln -sf $dotfiles/public/.xbindkeysrc .xbindkeysrc +ln -sf $dotfiles/public/.xinitrc .xinitrc +ln -sf $dotfiles/public/.inputrc .inputrc +ln -sf $dotfiles/public/.infokey .infokey +ln -sf $dotfiles/public/.git-prompt.sh .git-prompt.sh +ln -sf $dotfiles/public/.bashrc .bashrc +ln -sf $dotfiles/public/.bash_profile .bash_profile +ln -sf $dotfiles/public/.bash_aliases .bash_aliases +mkdir -p .config +ln -sf $dotfiles/public/.config/git .config/git +ln -sf $dotfiles/public/.config/gtk-3.0 .config/gtk-3.0 +ln -sf $dotfiles/public/.config/locale.conf .config/locale.conf +ln -sf $dotfiles/public/.config/mpv .config/mpv +ln -sf $dotfiles/public/.config/nsxiv .config/nsxiv +ln -sf $dotfiles/public/.config/nvim .config/nvim +ln -sf $dotfiles/public/.config/tmux .config/tmux +ln -sf $dotfiles/public/.config/zathura .config/zathura +mkdir -p .vim +ln -sf $dotfiles/public/.vim/fun.vim .vim/fun.vim +ln -sf $dotfiles/public/.vim/vimrc .vim/vimrc + +mkdir -p code/dwm +ln -sf $dotfiles/public/code/dwm/config.h code/dwm/config.h +mkdir -p code/dwmblocks +ln -sf $dotfiles/public/code/dwmblocks/config.h code/dwmblocks/config.h +mkdir -p code/st +ln -sf $dotfiles/public/code/st/config.h code/st/config.h diff --git a/test.sh b/test.sh deleted file mode 100755 index 6aaee71..0000000 --- a/test.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Test installation script - -HOME=build -XDG_CONFIG_HOME=build/.config -mkdir -p build/.config - -./install.sh $1 - -tree -a build -#rm -r build |
