55 lines
1.3 KiB
Bash
55 lines
1.3 KiB
Bash
# If not running interactively, don't do anything!
|
|
[[ $- != *i* ]] && return
|
|
|
|
# Resolve DOTFILES_DIR (assuming ~/.dotfiles on distros without readlink and/or $BASH_SOURCE/$0)
|
|
|
|
READLINK=$(which greadlink || which readlink)
|
|
CURRENT_SCRIPT=$BASH_SOURCE
|
|
|
|
if [[ -n $CURRENT_SCRIPT && -x "$READLINK" ]]; then
|
|
SCRIPT_PATH=$($READLINK -f "$CURRENT_SCRIPT")
|
|
DOTFILES_DIR=$(dirname "$(dirname "$SCRIPT_PATH")")
|
|
elif [ -d "$HOME/.dotfiles" ]; then
|
|
DOTFILES_DIR="$HOME/.dotfiles"
|
|
else
|
|
echo "Unable to find dotfiles, exiting."
|
|
return # `exit 1` would quit the shell itself
|
|
fi
|
|
|
|
# Finally we can source the dotfiles (order matters)
|
|
|
|
for DOTFILE in "$DOTFILES_DIR"/system/.{function,,env,alias,prompt,vimrc}; do
|
|
[ -f "$DOTFILE" ] && . "$DOTFILE"
|
|
done
|
|
|
|
# Set LSCOLORS
|
|
|
|
eval "$(dircolors "$DOTFILES_DIR"/system/.dir_colors)"
|
|
|
|
# Hook for extra/custom stuff
|
|
|
|
EXTRA_DIR="$HOME/.extra"
|
|
|
|
if [ -d "$EXTRA_DIR" ]; then
|
|
for EXTRAFILE in "$EXTRA_DIR"/run/*.sh; do
|
|
[ -f "$EXTRAFILE" ] && . "$EXTRAFILE"
|
|
done
|
|
fi
|
|
|
|
# BEGIN ANSIBLE MANAGED BLOCK
|
|
if [ -f `which powerline-daemon` ]; then
|
|
powerline-daemon -q
|
|
POWERLINE_BASH_CONTINUATION=1
|
|
POWERLINE_BASH_SELECT=1
|
|
. /usr/share/powerline/bindings/bash/powerline.sh
|
|
fi
|
|
|
|
|
|
# Clean up
|
|
|
|
unset READLINK CURRENT_SCRIPT SCRIPT_PATH DOTFILE
|
|
|
|
# Export
|
|
|
|
export OS DOTFILES_DIR EXTRA_DIR
|