new environment setup

This commit is contained in:
Wryn Wagner 2020-01-08 12:40:53 -07:00
parent c81f237993
commit c4ed1fb8d8
8 changed files with 73 additions and 42 deletions

View File

@ -1,5 +1,5 @@
#!/bin/bash
source "$HOME/.my_bash_env"
source "$HOME/.wryn/env/env.bash"
RC_DIR="$DOTWRYN/bash"

15
env/env.bash vendored Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
# Default bash environment
RD_PATH="$HOME/RentDynamics"
SCHOOL_DIR="$HOME/School"
DOTWRYN="$HOME/.wryn"
LOCAL_OVERRIDES="$HOME/.config/wryn/env.bash"
[ -f "$LOCAL_OVERRIDES" ] \
&& source "$LOCAL_OVERRIDES" \
|| {
touch $LOCAL_OVERRIDES \
&& echo '#!/bin/bash' > $LOCAL_OVERRIDES \
&& echo '# Local overrides of .wryn environment variables' >> $LOCAL_OVERRIDES
}

10
env/env.sh vendored Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# Default shell environment
LOCAL_OVERRIDES="$HOME/.config/wryn/env.sh"
[ -f "$LOCAL_OVERRIDES" ] \
&& source "$LOCAL_OVERRIDES" \
|| {
touch $LOCAL_OVERRIDES \
&& echo '#!/bin/sh' > $LOCAL_OVERRIDES \
&& echo '# Local overrides of .wryn environment variables '>> $LOCAL_OVERRIDES
}

8
env/env.vim vendored Normal file
View File

@ -0,0 +1,8 @@
let $RC_DIR=expand("$HOME/.wryn")
let $VIM_DIR=expand("$RC_DIR/vim")
let $WRYNVIMRC=expand("$VIM_DIR/rc.vim")
let $WRYNBASH=expand("$RC_DIR/bashrc")
let $MYBASHRC=expand("$HOME/.bashrc")
" Local environment and environment overrides
source $HOME/.config/wryn/env.vim

14
env/env.zsh vendored Executable file
View File

@ -0,0 +1,14 @@
#!/bin/zsh
# Default zsh environment
RD_PATH="$HOME/RentDynamics"
SCHOOL_DIR="$HOME/School"
DOTWRYN="$HOME/.wryn"
LOCAL_OVERRIDES="$HOME/.config/wryn/env.zsh"
[ -f "$LOCAL_OVERRIDES" ] \
&& source "$LOCAL_OVERRIDES" \
|| {
touch $LOCAL_OVERRIDES \
&& echo '#!/bin/zsh' > $LOCAL_OVERRIDES \
&& echo '# Local overrides of .wryn environment variables '>> $LOCAL_OVERRIDES
}

62
setup
View File

@ -1,54 +1,38 @@
#!/bin/bash
RC_DIR='$HOME/.wryn'
[ ! -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 $RC_DIR/bash/rc >> $HOME/.bashrc;
|| 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 $RC_DIR/vim/rc.vim >> $HOME/.vimrc;
|| 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 $RC_DIR/zsh/rc >> $HOME/.zshrc;
LOCAL_DIR_SETUP="$HOME/.my_bash_env"
if [ ! -f "$LOCAL_DIR_SETUP" ]; then
touch "$LOCAL_DIR_SETUP";
echo '#!/bin/bash' >> $LOCAL_DIR_SETUP
echo 'RD_PATH="$HOME/RentDynamics";' >> $LOCAL_DIR_SETUP
echo 'SCHOOL_DIR="$HOME/School";' >> $LOCAL_DIR_SETUP
echo 'DOTWRYN="$HOME/.wryn";' >> $LOCAL_DIR_SETUP
else
echo 'bash environment variables already set up'
fi
LOCAL_ZSH_SETUP="$HOME/.my_zsh_env"
if [ ! -f "$LOCAL_ZSH_SETUP" ]; then
touch "$LOCAL_ZSH_SETUP";
echo '#!/bin/zsh' >> $LOCAL_ZSH_SETUP
echo 'RD_PATH="$HOME/RentDynamics";' >> $LOCAL_ZSH_SETUP
echo 'SCHOOL_ZSH="$HOME/School";' >> $LOCAL_ZSH_SETUP
echo 'DOTWRYN="$HOME/.wryn";' >> $LOCAL_ZSH_SETUP
else
echo 'zsh environment already set up';
fi
|| echo source $HOME/.wryn/zsh/rc >> $HOME/.zshrc;
LOCAL_VIM_SETUP="$HOME/.my_vim_env"
if [ ! -f "$LOCAL_VIM_SETUP" ]; then
touch "$LOCAL_VIM_SETUP";
echo 'let $RC_DIR=expand("$HOME/.wryn")' >> $LOCAL_VIM_SETUP
echo 'let $VIM_DIR=expand("$RC_DIR/vim")' >> $LOCAL_VIM_SETUP
echo 'let $WRYNVIMRC=expand("$VIM_DIR/rc.vim")' >> $LOCAL_VIM_SETUP
echo 'let $WRYNBASH=expand("$RC_DIR/bashrc")' >> $LOCAL_VIM_SETUP
echo 'let $MYBASHRC=expand("$HOME/.bashrc")' >> $LOCAL_VIM_SETUP
echo 'let $WEBBROWSER="' $(which google-chrome-stable) '"' >> $LOCAL_VIM_SETUP
else
echo 'vim environment variables already set up'
fi
# 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'
}

View File

@ -1,5 +1,5 @@
" -- Environment Variables --------------------------------------- {{{
source $HOME/.my_vim_env
source $HOME/.wryn/env/env.vim
"sets the following variables:
"$RC_DIR $VIM_DIR $WRYNVIMRC $WRYNBASH $MYBASHRC $WEBBROWSER

2
zsh/rc
View File

@ -1,5 +1,5 @@
#!/bin/zsh
source "$HOME/.my_zsh_env"
source "$HOME/.wryn/env/env.zsh"
RC_DIR="$DOTWRYN/zsh"