Sync changes from master branch.

This commit is contained in:
Darren 'Tadgy' Austin 2023-10-01 23:27:52 +01:00
commit 23c7c0cc6c
3 changed files with 17 additions and 8 deletions

18
.bashrc
View file

@ -195,7 +195,8 @@ __read_ssh_agents() {
# Do locking the sucky way on macOS. # Do locking the sucky way on macOS.
for ((I = 0; I <= 5; I++)); do for ((I = 0; I <= 5; I++)); do
if shlock -p "$$" -f "$HOME/.ssh/agents.lock"; then if shlock -p "$$" -f "$HOME/.ssh/agents.lock"; then
exec {FD}<"$HOME/.ssh/agents" exec 9<"$HOME/.ssh/agents"
FD="9"
# Make note of the mtime for use in write_ssh_agents. # Make note of the mtime for use in write_ssh_agents.
SSH_AGENTS_MTIME="$(stat -f %Fm "$HOME/.ssh/agents")" SSH_AGENTS_MTIME="$(stat -f %Fm "$HOME/.ssh/agents")"
ERR=0 ERR=0
@ -221,7 +222,7 @@ __read_ssh_agents() {
ERR=$? ERR=$?
# Close the file descriptor (which on Linux releases the flock too). # Close the file descriptor (which on Linux releases the flock too).
exec {FD}<&- : "$FD"<&-
# On Darwin, release the lock on the file. # On Darwin, release the lock on the file.
rm -f "$HOME/.ssh/agents.lock" rm -f "$HOME/.ssh/agents.lock"
@ -266,7 +267,7 @@ __write_ssh_agents() {
(( ${MTIME/\.} > SSH_AGENTS_MTIME )) && return 2 (( ${MTIME/\.} > SSH_AGENTS_MTIME )) && return 2
# Lock the agents file. # Lock the agents file.
exec {FD}<"$HOME/.ssh/agents" && flock -E 10 -e -w 0.5 "$FD" exec {FD}>"$HOME/.ssh/agents" && flock -E 10 -e -w 0.5 "$FD"
ERR=$? ERR=$?
if (( ERR == 10 )); then if (( ERR == 10 )); then
printf "\\033[1;31m%s\\033[39m\\n" "Failed to obtain lock on ~/.ssh/agents." >&2 printf "\\033[1;31m%s\\033[39m\\n" "Failed to obtain lock on ~/.ssh/agents." >&2
@ -277,13 +278,14 @@ __write_ssh_agents() {
fi fi
elif [[ "$(uname -s)" == "Darwin" ]]; then elif [[ "$(uname -s)" == "Darwin" ]]; then
# Make sure SSH_AUTH_SOCKS has the most up to date data. # Make sure SSH_AUTH_SOCKS has the most up to date data.
MTIME="$(stat --format=%.9Y "$HOME/.ssh/agents")" MTIME="$(stat -f %Fm "$HOME/.ssh/agents")"
(( ${MTIME/\.} > SSH_AGENTS_MTIME )) && return 2 (( ${MTIME/\.} > SSH_AGENTS_MTIME )) && return 2
# Do locking the sucky way on OSX. # Do locking the sucky way on OSX.
for ((I = 0; I <= 5; I++)); do for ((I = 0; I <= 5; I++)); do
if shlock -p "$$" -f "$HOME/.ssh/agents.lock"; then if shlock -p "$$" -f "$HOME/.ssh/agents.lock"; then
exec {FD}<"$HOME/.ssh/agents" exec 9>"$HOME/.ssh/agents"
FD="9"
ERR=0 ERR=0
break break
else else
@ -305,7 +307,7 @@ __write_ssh_agents() {
[[ -n "${SOCKS[*]}" ]] && { printf "%s\\n" "${SOCKS[@]}" >"$HOME/.ssh/agents" 2>/dev/null; ERR=$?; } [[ -n "${SOCKS[*]}" ]] && { printf "%s\\n" "${SOCKS[@]}" >"$HOME/.ssh/agents" 2>/dev/null; ERR=$?; }
# Release locks. # Release locks.
exec {FD}>&- : "$FD"<&-
rm -f "$HOME/.ssh/agents.lock" rm -f "$HOME/.ssh/agents.lock"
# Error out if the data couldn't be written. # Error out if the data couldn't be written.
@ -377,7 +379,7 @@ HISTCONTROL="ignoredups"
HISTFILE="$HOME/.bash_history-${HOSTNAME%%.*}" HISTFILE="$HOME/.bash_history-${HOSTNAME%%.*}"
HISTFILESIZE=1000000 HISTFILESIZE=1000000
HISTIGNORE="bg:bg *:fg:fg *:jobs:exit:clear:history" HISTIGNORE="bg:bg *:fg:fg *:jobs:exit:clear:history"
HISTSIZE=-1 HISTSIZE=1000000
HISTTIMEFORMAT="%d/%m/%y %H:%M:%S " HISTTIMEFORMAT="%d/%m/%y %H:%M:%S "
history -r history -r
@ -406,7 +408,7 @@ else
# Set the prompts. # Set the prompts.
# Coloured username + host + directory: # Coloured username + host + directory:
# shellcheck disable=SC2154 # shellcheck disable=SC2154
PS1='[\[\033[$(__prompt_user_colour)\]\u\[\033[39m\]@\[\033[1;33m\]\h\[\033[39m\]] \[\033[1;34m\]\$(printf \"%s\" \"\${PWD/#\$HOME/~}\" | awk -F/ '\''{if (NF>3) {printf \".../\" \$(NF-1) \"/\" \$NF} else {printf \$0}}'\'')\[\033[39m\]$(__prompt_git_status "\[\\033[1;35m\] (%s)\[\\033[39m\]") ->' PS1='[\[\033[$(__prompt_user_colour)\]\u\[\033[39m\]@\[\033[1;33m\]\h\[\033[39m\]] \[\033[1;34m\]$(printf "%s" "${PWD/#$HOME/~}" | awk -F/ '\''{if (NF>3) {printf ".../" $(NF-1) "/" $NF} else {printf $0}}'\'')\[\033[39m\]$(__prompt_git_status "\[\\033[1;35m\] (%s)\[\\033[39m\]") ->'
fi fi
# Set the debugger prompt. # Set the debugger prompt.

1
.config/.gitignore vendored
View file

@ -3,6 +3,7 @@ QtProject.conf
VirtualBox/ VirtualBox/
chromium/ chromium/
evince/ evince/
iterm2/
libreoffice/ libreoffice/
mimeapps.list mimeapps.list
pulse/ pulse/

6
.gitignore vendored
View file

@ -6,24 +6,30 @@
.nfs* .nfs*
*.save *.save
.*.swp .*.swp
.CFUserTextEncoding
.DS_Store
/.ICEauthority /.ICEauthority
/.Trash/
/.Xauthority* /.Xauthority*
/.ab* /.ab*
/.alpine-smime/ /.alpine-smime/
/.aspell.* /.aspell.*
/.bash_history* /.bash_history*
/.cache/ /.cache/
/.cups/
/.dbus/ /.dbus/
/.fltk/ /.fltk/
/.lesshst /.lesshst
/.lynx.cookies /.lynx.cookies
/.mozilla/ /.mozilla/
/.nanorc /.nanorc
/.nano_history
/.pki/ /.pki/
/.rnd /.rnd
/.screen-*/ /.screen-*/
/.sqlite_history /.sqlite_history
/.thumbnails/ /.thumbnails/
/.viminfo
/.vmware/ /.vmware/
/.vnc/ /.vnc/
/.wget-hsts /.wget-hsts