Use XDG_DOTFILES_DIR to find the dotfiles directory

This commit is contained in:
Eric Teunis de Boone 2020-03-07 01:49:13 +01:00
parent a1e0f231eb
commit 5fb588478a
3 changed files with 20 additions and 15 deletions

View File

@ -24,7 +24,7 @@ lyrics_directory = ~/.lyrics
#
##### connection settings #####
#
mpd_host = locksmith.thuis
mpd_host = locksmith.nm.deboone.nl
#
mpd_port = 6600
#

View File

@ -1,11 +1,11 @@
# Define DOTFILES for easy access
DOTFILES="$HOME/.dotfiles"
# Define XDG_DOTFILES_DIR for easy access
export XDG_DOTFILES_DIR="$HOME/.dotfiles"
# Source main profile
[ -r "$DOTFILES/profiles/main.sh" ] && source "$DOTFILES/profiles/main.sh"
[ -r "$XDG_DOTFILES_DIR/profiles/main.sh" ] && source "$XDG_DOTFILES_DIR/profiles/main.sh"
# Source machine specific profile
[ -r "$DOTFILES/profiles/$HOSTNAME.profile" ] && source "$DOTFILES/profiles/$HOSTNAME.profile"
[ -r "$XDG_DOTFILES_DIR/profiles/$HOSTNAME.profile" ] && source "$XDG_DOTFILES_DIR/profiles/$HOSTNAME.profile"
# Always source a local profile
[ -r "$HOME/.profile.local" ] && source "$HOME/.profile.local"

View File

@ -1,22 +1,27 @@
DOTFILES="$HOME/.dotfiles"
#Add DOTFILES/bin/ to PATH
DOTBIN="$DOTFILES/bin"
#
# ~/.dotfiles/profiles/main.sh
#
DOTFILES="$XDG_DOTFILES_DIR"
addpath() { case ":${PATH:=$1}:" in *:$1:*) ;; *) PATH="$1:$PATH" ;; esac; }
if [ -d "$DOTBIN" ]
then
addpath "$DOTBIN"
fi
# add ~/.local/bin to PATH
if [ -d "~/.local/bin" ]
then
addpath "~/.local/bin"
fi
# add DOTFILES/bin to PATH
DOTBIN="$DOTFILES/bin"
if [ -d "$DOTBIN" ]
then
addpath "$DOTBIN"
fi
# Always try to use vi(m) if possible
# use vi(m) if possible
export EDITOR="vi"
export VISUAL="vi"
# Source Envs
@ -34,7 +39,7 @@ then
done
fi
# Source Bashrc if BASH
# if this is BASH source BASHRC
if [ "$BASH" ] && [ -f $DOTFILES/bash/rc ]
then
source $DOTFILES/bash/rc