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 ##### ##### connection settings #####
# #
mpd_host = locksmith.thuis mpd_host = locksmith.nm.deboone.nl
# #
mpd_port = 6600 mpd_port = 6600
# #

View File

@ -1,11 +1,11 @@
# Define DOTFILES for easy access # Define XDG_DOTFILES_DIR for easy access
DOTFILES="$HOME/.dotfiles" export XDG_DOTFILES_DIR="$HOME/.dotfiles"
# Source main profile # 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 # 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 # Always source a local profile
[ -r "$HOME/.profile.local" ] && source "$HOME/.profile.local" [ -r "$HOME/.profile.local" ] && source "$HOME/.profile.local"

View File

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