diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile index 93a3959f..d13ff627 100644 --- a/.config/zsh/.zprofile +++ b/.config/zsh/.zprofile @@ -45,7 +45,11 @@ export LESS_TERMCAP_us="$(printf '%b' '')" export LESS_TERMCAP_ue="$(printf '%b' '')" export LESSOPEN="| /usr/bin/highlight -O ansi %s 2>/dev/null" export ANSIBLE_NOCOWS=1 # Stop those fucking cows in Ansible + +# dotfiles management export DOTS_PACKAGE="dots" +export STOW_DIR="$XDG_DATA_HOME/stow" +export DOTS_REPO="git@git.snaile.de:luca/dotfiles" # Color palette for console dialogs in tools such as nmtui and whiptail export NEWT_COLORS=' @@ -82,7 +86,6 @@ export XDG_CACHE_HOME="$HOME/.cache" export XDG_STATE_HOME="$HOME/.local/state" export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc" -export STOW_DIR="$XDG_DATA_HOME/stow" set -a source $XDG_CONFIG_HOME/user-dirs.dirs set +a diff --git a/.local/bin/dotsync b/.local/bin/dotsync index f5016301..1002f6de 100755 --- a/.local/bin/dotsync +++ b/.local/bin/dotsync @@ -6,6 +6,16 @@ GREEN="$(tput setaf 2)" BLUE="$(tput setaf 4)" NC="$(tput sgr0)" +mkdir -p "$STOW_DIR/$DOTS_PACKAGE" + +# First run +if [ ! -e "$STOW_DIR/$DOTS_PACKAGE/.git" ]; then + printf "%b" "${BOLD}${BLUE}Cloning dotfiles...$NC\n\n" + git clone -j4 --recursive "$DOTS_REPO" "$STOW_DIR/$DOTS_PACKAGE" + stow --no-fold -d "$STOW_DIR" -t "$HOME" "$DOTS_PACKAGE" || printf "%b" "${RED}Failed to run stow!$NC\n" + exit 0 +fi + dgit() { git -C "$STOW_DIR/$DOTS_PACKAGE" "$@" } @@ -42,6 +52,6 @@ if [ -n "$unmerged_files" ]; then fi printf "%b" "${BOLD}${BLUE}Symlinking dotfiles...$NC\n\n" -stow -d "$STOW_DIR" -t "$HOME" "$DOTS_PACKAGE" || printf "%b" "${RED}Failed to run stow!$NC\n" +stow --no-fold -d "$STOW_DIR" -t "$HOME" "$DOTS_PACKAGE" || printf "%b" "${RED}Failed to run stow!$NC\n" printf "%b" "${BOLD}${GREEN}Dotfiles synced successfully!$NC\n" diff --git a/.stow-local-ignore b/.stow-local-ignore new file mode 100644 index 00000000..d49f9742 --- /dev/null +++ b/.stow-local-ignore @@ -0,0 +1,7 @@ +README\.md +TODO\.md +\.editorconfig +\.git +\.gitignore +\.gitmodules +\.local/share/service