dotfiles/setup.sh

114 lines
1.9 KiB
Bash
Executable file

#!/bin/sh
installed()
{
type "$1" >/dev/null 2>&1
}
link()
{
local src="$(pwd)/$1"
local dst="$2"
if test -e "$dst" && ! test -L "$dst"; then
echo "No symlink $dst"
exit 1
fi
if installed printf; then
printf "%-48s -> %s\n" "$dst" "$src"
else
echo "Linking $dst -> $src"
fi
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
mkdir -p ~/.zsh
link zsh/aliases.zsh ~/.zsh/aliases.zsh
link zsh/checks.zsh ~/.zsh/checks.zsh
link zsh/colors.zsh ~/.zsh/colors.zsh
link zsh/completion.zsh ~/.zsh/completion.zsh
link zsh/history.zsh ~/.zsh/history.zsh
link zsh/prompt.zsh ~/.zsh/prompt.zsh
link zsh/setopt.zsh ~/.zsh/setopt.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
link config/barpyrus/config.py ~/.config/barpyrus/config.py
echo
fi