From d47333930fa48b56bb3b4e77ce495b1d4a14cd65 Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Mon, 26 Sep 2016 18:11:51 +0200 Subject: [PATCH] Made separate bashrc and profile which parse eachother. So everythin is always defined in a bash shell --- bash/bashrc | 7 ++++++- bash/profile | 1 + install.conf.yaml | 6 +++--- profile | 25 ------------------------- profile.sh | 9 +++++++++ profiles/{main => main.sh} | 6 +++--- 6 files changed, 22 insertions(+), 32 deletions(-) create mode 100644 bash/profile delete mode 100644 profile create mode 100644 profile.sh rename profiles/{main => main.sh} (73%) diff --git a/bash/bashrc b/bash/bashrc index 25608a8..3b0d098 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -5,7 +5,12 @@ # If not running interactively, don't do anything [ -z "$PS1" ] && return -[ ! -z "$DOTFILES" ] && DOTBASH="$DOTFILES/bash" +[ -z "$DOTFILES" ] && source ~/.profile +## +[ -z "$DOTFILES" ] && echo ".profile missing" && exit 1 + + +DOTBASH="$DOTFILES/bash" # make less more friendly for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" diff --git a/bash/profile b/bash/profile new file mode 100644 index 0000000..478d29b --- /dev/null +++ b/bash/profile @@ -0,0 +1 @@ +[ -z "$DOTFILES" ] && source "$HOME/.profile" diff --git a/install.conf.yaml b/install.conf.yaml index 4c5f9b9..f7306c5 100644 --- a/install.conf.yaml +++ b/install.conf.yaml @@ -7,10 +7,10 @@ - link: ~/.bashrc: bash/bashrc - ~/.profile: profiles/main + ~/.profile: profile.sh ~/.gitconfig: git/gitconfig ~/.tmux.conf: tmux/tmux.conf ~/.vimrc: vim/vimrc -- shell: - - git submodules update # after linking ~/.gitconfig +#- shell: +# - git submodules update # after linking ~/.gitconfig diff --git a/profile b/profile deleted file mode 100644 index 62b354a..0000000 --- a/profile +++ /dev/null @@ -1,25 +0,0 @@ -# Define DOTFILES for easy access -DOTFILES="$HOME/.dotfiles" - -# Add DOTFILES/bin/ to PATH -DOTBIN="$HOME/.bin" -if [ -d "$DOTBIN" ]; then - export PATH="$PATH:$DOTBIN" -fi - - -# Always try to use vi(m) if possible -export EDITOR="vi" - - -# Source Envs -DOTENVS="$HOME/.envs" -if [ -d "DOTENVS" ]; then - source "$DOTENVS/*.active" -fi - - -# Source Bashrc if BASH -if [ "$BASH" ] && [ -f ~/.bashrc ]; then - source ~/.bashrc -fi diff --git a/profile.sh b/profile.sh new file mode 100644 index 0000000..480cce3 --- /dev/null +++ b/profile.sh @@ -0,0 +1,9 @@ +# Define DOTFILES for easy access +DOTFILES="$HOME/.dotfiles" + +# Source main profile +[ -r "$DOTFILES/profiles/main.sh" ] && source "$DOTFILES/profiles/main.sh" + + +# Source machine specific profile +[ -r "$DOTFILES/profiles/$HOSTNAME.profile"] && source "$DOTFILES/profiles/$HOSTNAME.profile" diff --git a/profiles/main b/profiles/main.sh similarity index 73% rename from profiles/main rename to profiles/main.sh index d3253f9..7668bf1 100644 --- a/profiles/main +++ b/profiles/main.sh @@ -1,6 +1,6 @@ DOTFILES="$HOME/.dotfiles" #Add DOTFILES/bin/ to PATH -DOTBIN="$HOME/.bin" +DOTBIN="$DOTFILES/bin" if [ -d "$DOTBIN" ]; then export PATH="$PATH:$DOTBIN" fi @@ -19,6 +19,6 @@ fi # Source Bashrc if BASH -if [ "$BASH" ] && [ -f ~/.bashrc ]; then - source ~/.bashrc +if [ "$BASH" ] && [ -f $DOTFILES/bash/bashrc ]; then + source $DOTFILES/bash/bashrc fi