Add gitattributesdb support. Update bash startup files. Small changes to other files.

This commit is contained in:
Darren 'Tadgy' Austin 2024-08-25 21:20:56 +01:00
commit 93e8fe1e3f
22 changed files with 742 additions and 620 deletions

21
.bash_profile.d/gitconfig Normal file
View file

@ -0,0 +1,21 @@
#!/bin/bash - not strictly necessary, but helps nano with syntax highlighting.
# Symlink the .gitconfig file to the most specific .gitconfig-* file.
if [[ -e "$HOME/.gitconfig-$USER@$HOSTNAME" ]]; then
FILE=".gitconfig-$USER@$HOSTNAME"
elif [[ -e "$HOME/.gitconfig-$USER@*.${HOSTNAME#*.}" ]]; then
FILE=".gitconfig-$USER@*.${HOSTNAME#*.}"
elif [[ -e "$HOME/.gitconfig-$USER@*" ]]; then
FILE=".gitconfig-$USER@*"
elif [[ -e "$HOME/.gitconfig-*@$HOSTNAME" ]]; then
FILE=".gitconfig-*@$HOSTNAME"
elif [[ -e "$HOME/.gitconfig-*.${HOSTNAME#*.}" ]]; then
FILE=".gitconfig-*.${HOSTNAME#*.}"
elif [[ -e "$HOME/.gitconfig-default" ]]; then
FILE=".gitconfig-default"
else
(cd "$HOME" && [[ -L ".gitconfig" ]] && rm -f ".gitconfig")
printf "%s: %s\\n" "${BASH_SOURCE##*/}" "failed to update .gitconfig symlink" >&2
fi
[[ -n "$FILE" ]] && (cd "$HOME" && ln -sf "$FILE" ".gitconfig")
unset FILE

8
.bash_profile.d/perl5 Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash - not strictly necessary, but helps nano with syntax highlighting.
hash perl >/dev/null 2>&1 && {
export PERL_MB_OPT="--install_base \"$HOME/.local/perl5\""
export PERL_MM_OPT="INSTALL_BASE=$HOME/.local/perl5"
export PERL_LOCAL_LIB_ROOT="$HOME/.local/perl5${PERL_LOCAL_LIB_ROOT:+:$PERL_LOCAL_LIB_ROOT}"
export PERL5LIB="$HOME/.local/perl5/lib/perl5${PERL5LIB:+:$PERL5LIB}"
}

48
.bash_profile.d/screen Executable file
View file

@ -0,0 +1,48 @@
#!/bin/bash - not strictly necessary, but helps nano with syntax highlighting.
hash screen >/dev/null 2>&1 && {
[[ -e "$HOME/.screenrc-${HOSTNAME%%.*}" ]] && export SCREENRC="$HOME/.screenrc-${HOSTNAME%%.*}"
export SCREENDIR="$HOME/.screen-${HOSTNAME%%.*}"
if [[ -n "$SSH_TTY" ]]; then
if [[ -n "$STY" ]]; then
printf "%s\\n\\n" "Screen $STY, window $WINDOW."
else
SCREENS="$(screen -ls | command grep '[[:alpha:]]' | command grep -E -v '^([[:digit:]]+|No) Socket(s)?')"
if [[ -n "$SCREENS" ]]; then
printf "%s\\n\\n" "$SCREENS"
else
printf "%s\\n\\n" "No screens."
fi
unset SCREENS
fi
elif [[ -n "$STY" ]]; then
printf "%s\\n\\n" "Screen $STY, window $WINDOW."
else
TTY="$(tty | cut -d/ -f3-)"
SCREENS="$(screen -ls | command grep -F "${HOSTNAME%%.*}" | command grep -F "${TTY//\//-}")"
# This has to be an echo, not printf.
case "$(echo "${SCREENS:--n}" | wc -l)" in
0)
# No screens found - start a new instance if on a tty.
# Disabled this because screens should be started on chuckie not the desktop/laptop.
# [[ "$TTY" == tty* ]] && screen
:
;;
1)
# Just one screen - reconnect if it's not dead.
if (( $(printf "%s" "$SCREENS" | command grep -c -F 'Dead') == 1 )); then
printf "%s:\\n" "Found dead screen for $TTY"
printf "%s\\n" "$SCREENS" | sed -e 's/^/ /g'
else
screen -dr "${TTY//\//-}.${HOSTNAME%%.*}"
fi
;;
*)
# Multiple screens - output a list
printf "%s:\\n" "Multiple screens found for $TTY"
printf "%s\\n" "$SCREENS" | sed -e 's/^/ /g'
;;
esac
fi
unset SCREENS TTY
}