Sync changes from master branch.
This commit is contained in:
parent
49b7d08938
commit
23c7c0cc6c
3 changed files with 17 additions and 8 deletions
18
.bashrc
18
.bashrc
|
|
@ -195,7 +195,8 @@ __read_ssh_agents() {
|
|||
# Do locking the sucky way on macOS.
|
||||
for ((I = 0; I <= 5; I++)); do
|
||||
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.
|
||||
SSH_AGENTS_MTIME="$(stat -f %Fm "$HOME/.ssh/agents")"
|
||||
ERR=0
|
||||
|
|
@ -221,7 +222,7 @@ __read_ssh_agents() {
|
|||
ERR=$?
|
||||
|
||||
# Close the file descriptor (which on Linux releases the flock too).
|
||||
exec {FD}<&-
|
||||
: "$FD"<&-
|
||||
|
||||
# On Darwin, release the lock on the file.
|
||||
rm -f "$HOME/.ssh/agents.lock"
|
||||
|
|
@ -266,7 +267,7 @@ __write_ssh_agents() {
|
|||
(( ${MTIME/\.} > SSH_AGENTS_MTIME )) && return 2
|
||||
|
||||
# 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=$?
|
||||
if (( ERR == 10 )); then
|
||||
printf "\\033[1;31m%s\\033[39m\\n" "Failed to obtain lock on ~/.ssh/agents." >&2
|
||||
|
|
@ -277,13 +278,14 @@ __write_ssh_agents() {
|
|||
fi
|
||||
elif [[ "$(uname -s)" == "Darwin" ]]; then
|
||||
# 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
|
||||
|
||||
# Do locking the sucky way on OSX.
|
||||
for ((I = 0; I <= 5; I++)); do
|
||||
if shlock -p "$$" -f "$HOME/.ssh/agents.lock"; then
|
||||
exec {FD}<"$HOME/.ssh/agents"
|
||||
exec 9>"$HOME/.ssh/agents"
|
||||
FD="9"
|
||||
ERR=0
|
||||
break
|
||||
else
|
||||
|
|
@ -305,7 +307,7 @@ __write_ssh_agents() {
|
|||
[[ -n "${SOCKS[*]}" ]] && { printf "%s\\n" "${SOCKS[@]}" >"$HOME/.ssh/agents" 2>/dev/null; ERR=$?; }
|
||||
|
||||
# Release locks.
|
||||
exec {FD}>&-
|
||||
: "$FD"<&-
|
||||
rm -f "$HOME/.ssh/agents.lock"
|
||||
|
||||
# Error out if the data couldn't be written.
|
||||
|
|
@ -377,7 +379,7 @@ HISTCONTROL="ignoredups"
|
|||
HISTFILE="$HOME/.bash_history-${HOSTNAME%%.*}"
|
||||
HISTFILESIZE=1000000
|
||||
HISTIGNORE="bg:bg *:fg:fg *:jobs:exit:clear:history"
|
||||
HISTSIZE=-1
|
||||
HISTSIZE=1000000
|
||||
HISTTIMEFORMAT="%d/%m/%y %H:%M:%S "
|
||||
history -r
|
||||
|
||||
|
|
@ -406,7 +408,7 @@ else
|
|||
# Set the prompts.
|
||||
# Coloured username + host + directory:
|
||||
# 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
|
||||
|
||||
# Set the debugger prompt.
|
||||
|
|
|
|||
1
.config/.gitignore
vendored
1
.config/.gitignore
vendored
|
|
@ -3,6 +3,7 @@ QtProject.conf
|
|||
VirtualBox/
|
||||
chromium/
|
||||
evince/
|
||||
iterm2/
|
||||
libreoffice/
|
||||
mimeapps.list
|
||||
pulse/
|
||||
|
|
|
|||
6
.gitignore
vendored
6
.gitignore
vendored
|
|
@ -6,24 +6,30 @@
|
|||
.nfs*
|
||||
*.save
|
||||
.*.swp
|
||||
.CFUserTextEncoding
|
||||
.DS_Store
|
||||
/.ICEauthority
|
||||
/.Trash/
|
||||
/.Xauthority*
|
||||
/.ab*
|
||||
/.alpine-smime/
|
||||
/.aspell.*
|
||||
/.bash_history*
|
||||
/.cache/
|
||||
/.cups/
|
||||
/.dbus/
|
||||
/.fltk/
|
||||
/.lesshst
|
||||
/.lynx.cookies
|
||||
/.mozilla/
|
||||
/.nanorc
|
||||
/.nano_history
|
||||
/.pki/
|
||||
/.rnd
|
||||
/.screen-*/
|
||||
/.sqlite_history
|
||||
/.thumbnails/
|
||||
/.viminfo
|
||||
/.vmware/
|
||||
/.vnc/
|
||||
/.wget-hsts
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue