#!/bin/sh # set for dryrun #dryrun= installed() { type "$1" >/dev/null 2>&1 } link() { local src="$(pwd)/$1" local dst="$2" if test -e "$dst"; then if ! test -L "$dst"; then echo "File $dst exists and is no symlink." echo "Ignore and continue? (y/N)" read answer case $answer in [Yy]*) return ;; *) exit 1 ;; esac else # symlink already exists and will be removed rm "$dst" fi fi if installed printf; then printf "%-48s -> %s\n" "$dst" "$src" else echo "Linking $dst -> $src" fi [ -z "${dryrun+x}" ] && ln -sf "$src" "$dst" } if installed vim; then echo "Setting up vim:" link vimrc ~/.vimrc #link vim ~/.vim echo fi if installed zsh; then echo "Setting up zsh:" link zshrc ~/.zshrc link zsh ~/.zsh echo fi if installed tmux; then echo "Setting up tmux:" link tmux.conf ~/.tmux.conf echo fi if installed git; then echo "Setting up git:" link gitconfig ~/.gitconfig echo fi if installed ssh; then echo "Setting up ssh:" mkdir -p ~/.ssh link ssh/config ~/.ssh/config echo fi if installed gpg || installed gpg2; then echo "Setting up gpg:" mkdir -p ~/.gnupg link gnupg/gpg-agent.conf ~/.gnupg/gpg-agent.conf link gnupg/gpg.conf ~/.gnupg/gpg.conf echo fi if installed X; then echo "Setting up X:" link xinitrc ~/.xinitrc link xsession ~/.xsession link Xresources ~/.Xresources echo fi if installed herbstluftwm; then echo "Setting up herbstluftwm:" mkdir -p ~/.config/herbstluftwm link config/herbstluftwm/autostart ~/.config/herbstluftwm/autostart link config/herbstluftwm/panel.sh ~/.config/herbstluftwm/panel.sh link config/herbstluftwm/q3terminal.sh ~/.config/herbstluftwm/q3terminal.sh link config/herbstluftwm/icons ~/.config/herbstluftwm/icons link config/herbstluftwm/icons_large ~/.config/herbstluftwm/icons_large # barpyrus mkdir -p ~/.config/barpyrus link config/barpyrus/config.py ~/.config/barpyrus/config.py echo fi if installed i3; then echo "Setting up i3:" mkdir -p ~/.config/i3 link config/i3/config ~/.config/i3/config mkdir -p ~/.config/i3status link config/i3status/config ~/.config/i3status/config fi if installed redshift; then link config/redshift.conf ~/.config/redshift.conf fi