182 lines
4.6 KiB
Bash
Executable File
182 lines
4.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
################################################################################
|
|
### SHELL SETUP ################################################################
|
|
################################################################################
|
|
|
|
[ ! -d "$HOME/.config" ] && mkdir "$HOME/.config";
|
|
[ ! -d "$HOME/.config/wryn" ] && mkdir "$HOME/.config/wryn";
|
|
|
|
function SOURCE_DOTWRYN_RC {
|
|
local HOME_RC="$1";
|
|
local WRYN_RC="$2";
|
|
|
|
[ ! -f "$HOME/$HOME_RC" ] && touch "$HOME/$HOME_RC";
|
|
|
|
grep -q '\.wryn' "$HOME/$HOME_RC" \
|
|
&& echo "already set up $HOME_RC" \
|
|
|| {
|
|
echo "source $WRYN_RC" >> "$HOME/$HOME_RC";
|
|
echo "successfully set up $HOME_RC";
|
|
}
|
|
}
|
|
|
|
function SHELL__SETUP {
|
|
SOURCE_DOTWRYN_RC '.bashrc' '$HOME/.wryn/bash/rc'
|
|
which bash >/dev/null && "$HOME/.wryn/env/env.bash";
|
|
|
|
SOURCE_DOTWRYN_RC '.zshrc' '$HOME/.wryn/zsh/rc';
|
|
which zsh >/dev/null && "$HOME/.wryn/env/env.zsh";
|
|
}
|
|
|
|
################################################################################
|
|
### VIM SETUP ##################################################################
|
|
################################################################################
|
|
|
|
function VIM__SETUP_ENVIRONMENT_VARIABLES() {
|
|
VIM_ENV="$HOME/.config/wryn/env.vim";
|
|
|
|
[ ! -f "$VIM_ENV" ] && {
|
|
touch "$VIM_ENV";
|
|
which google-chrome-stable \
|
|
&& echo 'let $WEBBROWSER="'$(which google-chrome-stable)'"' >> $VIM_ENV\
|
|
|| echo 'let $WEBBROWSER=""' >> $VIM_ENV;
|
|
} || {
|
|
echo 'vim environment variables already set up';
|
|
}
|
|
}
|
|
|
|
function VIM__UPDATE_COLORSCHEMES() {
|
|
pushd $HOME/.wryn/config/colorschemes/vim >/dev/null
|
|
./update_colorschemes
|
|
popd >/dev/null
|
|
}
|
|
|
|
function VIM__INSTALL_VUNDLE_PLUGINS() {
|
|
[ ! -d "$HOME/.vim" ] && mkdir "$HOME/.vim"
|
|
[ ! -d "$HOME/.vim/bundle" ] && mkdir "$HOME/.vim/bundle"
|
|
[ ! -d "$HOME/.vim/bundle/Vundle.vim" ] && {
|
|
echo "installing vundle";
|
|
git clone https://github.com/VundleVim/Vundle.vim.git "$HOME/.vim/bundle/Vundle.vim";
|
|
}
|
|
|
|
echo "installing vundle plugins"
|
|
vim +PluginInstall +qall;
|
|
|
|
echo "building plugins"
|
|
$HOME/.wryn/vim/rebuild_plugins;
|
|
}
|
|
|
|
function VIM__SETUP() {
|
|
echo 'setting up vim';
|
|
|
|
SOURCE_DOTWRYN_RC '.vimrc' '$HOME/.wryn/vim/rc.vim';
|
|
|
|
VIM__SETUP_ENVIRONMENT_VARIABLES;
|
|
VIM__UPDATE_COLORSCHEMES;
|
|
VIM__INSTALL_VUNDLE_PLUGINS;
|
|
|
|
echo 'vim setup complete';
|
|
}
|
|
|
|
#VIM__SETUP;
|
|
|
|
|
|
################################################################################
|
|
### LINK CONFIGURATION FILES ###################################################
|
|
################################################################################
|
|
|
|
# setup config symlinks
|
|
|
|
xfce4-panel --version >/dev/null 2>&1 \
|
|
&& [ ! -f "$HOME/.xinitrc" ] \
|
|
&& ln -s "$HOME/.wryn/config/xserver/xinitrc" "$HOME/.xinitrc";
|
|
|
|
function CONFIG__BASIC_SYMLINK() {
|
|
local HOME_CONFIG="$1";
|
|
local WRYN_CONFIG="$2";
|
|
|
|
mv "$HOME_CONFIG" "$HOME_CONFIG.bak"; # >/dev/null 2>&1;
|
|
ln -s "$WRYN_CONFIG" "$HOME_CONFIG";
|
|
}
|
|
|
|
function CONFIG__SYMLINK() {
|
|
local CONFIG_DIR="$1";
|
|
local FILENAME="$2";
|
|
|
|
local HOME_CONFIG_DIR="$HOME/.config/$CONFIG_DIR";
|
|
local HOME_CONFIG="$HOME_CONFIG_DIR/$FILENAME";
|
|
|
|
local WRYN_CONFIG="$HOME/.wryn/.config/$CONFIG_DIR/$FILENAME";
|
|
|
|
[ ! -d "$HOME_CONFIG_DIR" ] && mkdir "$HOME_CONFIG_DIR";
|
|
|
|
CONFIG__BASIC_SYMLINK $HOME_CONFIG $WRYN_CONFIG;
|
|
}
|
|
|
|
|
|
function CONFIG__I3() {
|
|
CONFIG__SYMLINK "i3" "config";
|
|
|
|
echo "linked i3 configuration"
|
|
}
|
|
|
|
function CONFIG__COMPTON() {
|
|
CONFIG__SYMLINK "compton" "compton.conf";
|
|
|
|
echo "linked compton configuration"
|
|
}
|
|
|
|
function CONFIG__KITTY() {
|
|
CONFIG__SYMLINK "kitty" "kitty.conf";
|
|
CONFIG__SYMLINK "kitty" "theme.conf";
|
|
|
|
echo "linked kitty configuration"
|
|
}
|
|
|
|
function CONFIG__GIT() {
|
|
CONFIG__BASIC_SYMLINK "$HOME/.gitconfig" "$HOME/.wryn/config/git/gitconfig";
|
|
}
|
|
|
|
function CONFIG__PYLINT() {
|
|
CONFIG__BASIC_SYMLINK "$HOME/.config/pylintrc" "$HOME/.wryn/config/pylint/pylintrc";
|
|
|
|
echo "linked pylint configuration"
|
|
}
|
|
|
|
function CONFIG__TMUX() {
|
|
CONFIG__BASIC_SYMLINK "$HOME/.tmux.conf" "$HOME/.wryn/tmux/tmux.conf";
|
|
|
|
echo "linked tmux configuration"
|
|
}
|
|
|
|
function CONFIG__TERMINFO() {
|
|
echo "adding terminfo files"
|
|
for file in $(find "$HOME/.wryn/config/terminfo" -type f); do
|
|
tic -x $file >/dev/null 2>&1 || echo "failed to add $file" ;
|
|
done
|
|
}
|
|
|
|
|
|
function CONFIG__SETUP() {
|
|
CONFIG__I3;
|
|
CONFIG__COMPTON;
|
|
CONFIG__KITTY;
|
|
|
|
CONFIG__GIT;
|
|
CONFIG__PYLINT;
|
|
CONFIG__TMUX;
|
|
|
|
CONFIG__TERMINFO;
|
|
}
|
|
|
|
################################################################################
|
|
### RUN CONFIG #################################################################
|
|
################################################################################
|
|
|
|
SHELL__SETUP;
|
|
VIM__SETUP;
|
|
CONFIG__SETUP;
|
|
|
|
echo -e "\nsetup complete"
|