mirror of
https://mau.dev/andreijiroh-dev/dotfiles.git
synced 2024-11-10 00:59:38 +00:00
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>
This commit is contained in:
parent
f9ca813505
commit
076ddb88b5
2 changed files with 12 additions and 7 deletions
15
.bashrc
15
.bashrc
|
@ -12,9 +12,11 @@
|
||||||
if [[ $TERMUX ]]; then
|
if [[ $TERMUX ]]; then
|
||||||
export SSH_AGENT_=todo
|
export SSH_AGENT_=todo
|
||||||
elif command -v keychain >> /dev/null; then
|
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)
|
eval $(keychain --agents gpg,ssh --eval)
|
||||||
fi
|
fi
|
||||||
|
# shellcheck disable=SC2155
|
||||||
export GPG_TTY=$(tty)
|
export GPG_TTY=$(tty)
|
||||||
|
|
||||||
# how about detecting local configs
|
# how about detecting local configs
|
||||||
|
@ -28,6 +30,7 @@ else
|
||||||
if [[ $PROMPT_THEME == "disabled" ]]; then
|
if [[ $PROMPT_THEME == "disabled" ]]; then
|
||||||
true
|
true
|
||||||
elif [[ -f "$HOME/.config/bash/shell-prompts/${PROMPT_THEME}.bashrc" ]]; then
|
elif [[ -f "$HOME/.config/bash/shell-prompts/${PROMPT_THEME}.bashrc" ]]; then
|
||||||
|
# shellcheck disable=SC1090
|
||||||
source "$HOME/.config/bash/shell-prompts/${PROMPT_THEME}.bashrc"
|
source "$HOME/.config/bash/shell-prompts/${PROMPT_THEME}.bashrc"
|
||||||
else
|
else
|
||||||
source "$HOME/.config/bash/shell-prompts/vern.bashrc"
|
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 ##
|
## Stage 2: Source literally everything else ##
|
||||||
if [[ -d "$HOME/.bashbox" ]]; then
|
if [[ -d "$HOME/.bashbox" ]]; then
|
||||||
|
# shellcheck disable=SC1091
|
||||||
source "$HOME/.bashbox/env"
|
source "$HOME/.bashbox/env"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# handle hostname generation for importing host-specific configs
|
# handle hostname generation for importing host-specific configs
|
||||||
# TODO: Handle detection when we don't have WSL_* variables on tmux shell sessions
|
# TODO: Handle detection when we don't have WSL_* variables on tmux shell sessions
|
||||||
if [[ $WSL_DISTRO_NAME ]] && [[ $WSL_INTEROP ]]; then
|
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
|
export WSL=1 # similar to CODESPACES and GITPOD_WORKSPACE_ID vars
|
||||||
else
|
else
|
||||||
HOSTNAME_BASH="${HOSTNAME}"
|
HOSTNAME_BASH="$(cat /etc/hostname)"
|
||||||
fi
|
fi
|
||||||
|
export HOSTNAME_BASH
|
||||||
|
|
||||||
for file in "$HOME/.config/bash/hosts/${HOSTNAME_BASH}.bashrc" "${HOME}/.config/bash/bashrc"; do
|
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
|
done
|
||||||
|
|
||||||
|
|
|
@ -11,5 +11,5 @@ elif [ -d "$HOME/.git" ] && [ ! -d "$HOME/.local/share/yadm/repo.git" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Setting git remote URLs to SSH"
|
echo "Setting git remote URLs to SSH"
|
||||||
git remote set-url origin ssh://git@mau.dev/andreijiroh.dev/dotfiles || true
|
git remote set-url --add 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 hut ssh://git@git.sr.ht/~ajhalili2006/dotfiles || git remote add hut ssh://git@git.sr.ht/~ajhalili2006/dotfiles
|
||||||
|
|
Loading…
Reference in a new issue