Automatic configuration of dotfile-dir on install

This commit is contained in:
2025-08-31 03:12:03 +00:00
parent 6d43be3029
commit caa3d4a286
2 changed files with 7 additions and 5 deletions
+4 -3
View File
@@ -59,13 +59,14 @@ function check_dotfiles_version {
# Return 2 if the repo is behind the remote
# Return 3 if the repo is ahead of the remote
# Return 4 if the repo has diverged from the remote
if [ ! -d $HOME/dotfiles ]; then
if [ ! -d $DOTFILES_DIR ]; then
return 2
fi
pushd $HOME/dotfiles > /dev/null
pushd $DOTFILES_DIR > /dev/null
git fetch origin
# TODO: This may be gitbox
git fetch
UPSTREAM=${1:-'@{u}'}
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse "$UPSTREAM")
+3 -2
View File
@@ -1,16 +1,17 @@
# Dotfiles directory should be in environment or
if [ -f "$HOME/.dotfiles-dir" ]; then
$DOTFILES_DIR=$(cat "$HOME/.dotfiles-dir")
source "$HOME/.dotfiles-dir"
fi
echo "Dotfiles: $DOTFILES_DIR"
if [ -n "$DOTFILES_DIR" ] && [ -d "$DOTFILES_DIR" ]; then
# Gruvbox colors
# source "$HOME/.vim/bundle/gruvbox/gruvbox_256palette.sh"
[[ -f "$DOTFILES_DIR/dependencies/gruvbox/gruvbox_256palette.sh" ]] && source "$HOME/dotfiles/dependencies/gruvbox/gruvbox_256palette.sh"
if [ ! -f "$DOTFILES_DIR/dependencies/ohmyzsh/oh-my-zsh.sh" ]; then
cd "$DOTFILES_DIR"
git submodule update --init
cd -
fi
[[ -f "$DOTFILES_DIR/dependencies/gruvbox/gruvbox_256palette.sh" ]] && source "$DOTFILES_DIR/dependencies/gruvbox/gruvbox_256palette.sh"
export ZSH=$DOTFILES_DIR/dependencies/ohmyzsh
fi