dotwryn/setup
2020-01-10 09:04:45 -07:00

60 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
[ ! -f "$HOME/.bashrc" ] && touch "$HOME/.bashrc";
[ ! -f "$HOME/.vimrc" ] && touch "$HOME/.vimrc";
[ ! -d "$HOME/.config" ] && mkdir "$HOME/.config";
[ ! -d "$HOME/.config/wryn" ] && mkdir "$HOME/.config/wryn";
# Source RCs
grep '.wryn' $HOME/.bashrc >/dev/null 2>/dev/null \
&& echo already set up bash rc \
|| echo source $HOME/.wryn/bash/rc >> $HOME/.bashrc;
grep '.wryn' $HOME/.vimrc >/dev/null 2>/dev/null \
&& echo already set up vim rc \
|| echo source $HOME/.wryn/vim/rc.vim >> $HOME/.vimrc;
grep '.wryn' $HOME/.zshrc >/dev/null 2>/dev/null \
&& echo already set up zsh rc \
|| echo source $HOME/.wryn/zsh/rc >> $HOME/.zshrc;
# setup local environments
which sh >/dev/null && "$HOME/.wryn/env/env.sh";
which bash >/dev/null && "$HOME/.wryn/env/env.bash";
which zsh >/dev/null && "$HOME/.wryn/env/env.zsh";
LOCAL_VIM_ENV="$HOME/.config/wryn/env.vim"
[ ! -f "$LOCAL_VIM_ENV" ] \
&& {
touch "$LOCAL_VIM_ENV";
which google-chrome-stable \
&& echo 'let $WEBBROWSER="'$(which google-chrome-stable)'"' >> $LOCAL_VIM_ENV\
|| echo 'let $WEBBROWSER=""' >> $LOCAL_VIM_ENV;
} || {
echo 'vim environment variables already set up';
}
# setup config symlinks
[ -f "$HOME/.tmux.conf" ] && mv "$HOME/.tmux.conf" "$HOME/.tmux.conf.bak";
ln -s "$HOME/.wryn/tmux/tmux.conf" "$HOME/.tmux.conf";
xfce4-panel --version >/dev/null 2>&1 \
&& [ ! -f "$HOME/.xinitrc" ] \
&& ln -s "$HOME/.wryn/config/xserver/xinitrc" "$HOME/.xinitrc";
function SYMLINK_CONFIG() {
# $1 = config directory name
# $2 = filename
[ ! -d "$HOME/.config/$1" ] && mkdir "$HOME/.config/$1";
[ -f "$HOME/.config/$1/$2" ] && mv "$HOME/.config/$1/$2" "$HOME/.config/$1/$2.bak";
ln -s "$HOME/.wryn/config/$1/$2" "$HOME/.config/$1/$2";
}
SYMLINK_CONFIG "compton" "compton.conf";
SYMLINK_CONFIG "i3" "config";
SYMLINK_CONFIG "kitty" "kitty.conf";
SYMLINK_CONFIG "kitty" "theme.conf";