~ajhalili2006/dotfiles

076ddb88b5161bc0e8882e38c01fd254a67e17d4 — Andrei Jiroh Halili 2 months ago f9ca813
Fix hostname detection on bashrc

Also in this commit, I do "git remote add" to the sourcehut mirror
of my dotfiles if not exists locally

Signed-off-by: Andrei Jiroh Halili <ajhalili2006@andreijiroh.xyz>
2 files changed, 12 insertions(+), 7 deletions(-)

M .bashrc
M .config/yadm/bootstrap.d/00-post-clone-repo.sh
M .bashrc => .bashrc +10 -5
@@ 12,9 12,11 @@
if [[ $TERMUX ]]; then
  export SSH_AGENT_=todo
elif command -v keychain >> /dev/null; then
  export KEYCHAIN_PATh=$(command -v keychain)
  # shellcheck disable=SC2155
  export KEYCHAIN_PATH=$(command -v keychain)
  eval $(keychain --agents gpg,ssh --eval)
fi
# shellcheck disable=SC2155
export GPG_TTY=$(tty)

# how about detecting local configs


@@ 28,6 30,7 @@ else
  if [[ $PROMPT_THEME == "disabled" ]]; then
    true
  elif [[ -f "$HOME/.config/bash/shell-prompts/${PROMPT_THEME}.bashrc" ]]; then
    # shellcheck disable=SC1090
    source "$HOME/.config/bash/shell-prompts/${PROMPT_THEME}.bashrc"
  else
    source "$HOME/.config/bash/shell-prompts/vern.bashrc"


@@ 56,19 59,21 @@ export LOCALE_ARCHIVE="$HOME/.nix-profile/lib/locale/locale-archive"

## Stage 2: Source literally everything else                       ##
if [[ -d "$HOME/.bashbox" ]]; then
  # shellcheck disable=SC1091
  source "$HOME/.bashbox/env"
fi

# handle hostname generation for importing host-specific configs
# TODO: Handle detection when we don't have WSL_* variables on tmux shell sessions
if [[ $WSL_DISTRO_NAME ]] && [[ $WSL_INTEROP ]]; then
  HOSTNAME_BASH="${HOSTNAME}-wsl-${WSL_DISTRO_NAME}"
  HOSTNAME_BASH="$(cat /etc/hostname)-wsl-${WSL_DISTRO_NAME}"
  export WSL=1 # similar to CODESPACES and GITPOD_WORKSPACE_ID vars
else
  HOSTNAME_BASH="${HOSTNAME}"
  HOSTNAME_BASH="$(cat /etc/hostname)"
fi
export HOSTNAME_BASH

for file in "$HOME/.config/bash/hosts/${HOSTNAME_BASH}.bashrc" "${HOME}/.config/bash/bashrc"; do
    [ -f $file ] && . "$file"
    # shellcheck disable=SC1090
    [ -f "$file" ] && . "$file"
done


M .config/yadm/bootstrap.d/00-post-clone-repo.sh => .config/yadm/bootstrap.d/00-post-clone-repo.sh +2 -2
@@ 11,5 11,5 @@ elif [ -d "$HOME/.git" ] && [ ! -d "$HOME/.local/share/yadm/repo.git" ]; then
fi

echo "Setting git remote URLs to SSH"
git remote set-url origin ssh://git@mau.dev/andreijiroh.dev/dotfiles || true
git remote set-url hut ssh://git@git.sr.ht/~ajhalili2006/dotfiles || true
git remote set-url --add origin ssh://git@mau.dev/andreijiroh.dev/dotfiles || true
git remote set-url --add hut ssh://git@git.sr.ht/~ajhalili2006/dotfiles || git remote add hut ssh://git@git.sr.ht/~ajhalili2006/dotfiles