Merge remote-tracking branch 'refs/remotes/origin/minimal' into minimal

This commit is contained in:
Darren 'Tadgy' Austin 2023-10-05 21:36:20 +01:00
commit 120d7941fc
5 changed files with 228 additions and 103 deletions

View file

@ -15,7 +15,7 @@ export VISUAL="$EDITOR"
hash lesspipe >/dev/null 2>&1 && eval "$(SHELL=/bin/sh lesspipe)" hash lesspipe >/dev/null 2>&1 && eval "$(SHELL=/bin/sh lesspipe)"
# Platform specific set up. # Platform specific set up.
PLATFORM="$(uname -s)" PLATFORM="${PLATFORM:-$(uname -s)}"
if [[ "$PLATFORM" = "Linux" ]]; then if [[ "$PLATFORM" = "Linux" ]]; then
# shellcheck disable=SC2155 # shellcheck disable=SC2155
export GPG_TTY="$(tty)" export GPG_TTY="$(tty)"
@ -45,7 +45,6 @@ elif [[ "$PLATFORM" = "Darwin" ]]; then
else else
printf "%s: %s\\n" "${BASH_SOURCE##*/}" "unsupported platform: $PLATFORM" >&2 printf "%s: %s\\n" "${BASH_SOURCE##*/}" "unsupported platform: $PLATFORM" >&2
fi fi
unset PLATFORM
# Add bin directories to PATH. # Add bin directories to PATH.
[[ -d "$HOME/.local/bin" ]] && export PATH="$HOME/.local/bin:$PATH" [[ -d "$HOME/.local/bin" ]] && export PATH="$HOME/.local/bin:$PATH"

258
.bashrc
View file

@ -1,5 +1,153 @@
#!/bin/bash - not strictly necessary, but helps nano with syntax highlighting. #!/bin/bash - not strictly necessary, but helps nano with syntax highlighting.
__prompt_git_status() {
# Generate a git branch/status prompt.
# Based on git-prompt.sh by Shawn O. Pearce <spearce@spearce.org>.
# Environment variables:
# GIT_PROMPT_SHOW_TYPE=1 - Show type of repository (Bare, Shallow).
# GIT_PROMPT_SHOW_IGNORED=1 - Show a ! if the directory is ignored.
# GIT_PROMPT_SHOW_UNSTAGED=1 - Show a * if there are unstaged changes (superceeded by above).
# GIT_PROMPT_SHOW_UNTRACKED=1 - Show a ? if there are untracked files in the working directory (superceeded by above).
# GIT_PROMPT_SHOW_STASH=1 - Show a & if there is a stash in this repository (superceeded by above).
# GIT_PROMPT_SHOW_UPSTREAM=1 - Show status of this repository compaired to upstream:
# ?? - No upstream set.
# == - Working tree is equal to upstream.
# <> - Divergent from upstream.
# >> or >x - Working tree is ahead of upstream (x = commits ahead when used with next option).
# << or <x - Working tree is behind upstream (x = commits behind when used with next option).
# GIT_PROMPT_SHOW_UPSTREAM_EXTENDED=1 - In addition to upstream status, show the number of commits difference (inplies above).
local COUNT GIT_PROMPT GIT_REPO_INFO RET="$?"
# Bail out if there's no format argument given.
(( $# != 1 )) && return "$RET"
# Get some repository information.
# shellcheck disable=SC2207
GIT_REPO_INFO=( $(git rev-parse --is-bare-repository --is-shallow-repository --is-inside-git-dir --is-inside-work-tree --short HEAD 2>/dev/null) )
ERR="$?"
# Do nothing if there's an error.
(( ERR >= 1 )) || { (( ERR == 128 )) && (( ${#GIT_REPO_INFO[@]} != 3 )); } && return "$RET"
# Generate the prompt.
if [[ "${GIT_REPO_INFO[2]}" == "true" ]]; then
# If in the git directory, use a special branch marker.
GIT_PROMPT+="!GIT_DIR!"
elif [[ "${GIT_REPO_INFO[3]}" == "true" ]]; then
# If in the working directory, generate the prompt.
# Add status markers.
[[ -n "$GIT_PROMPT_SHOW_TYPE" ]] && {
if [[ "${GIT_REPO_INFO[0]}" == "true" ]]; then
GIT_PROMPT+="B:"
elif [[ "${GIT_REPO_INFO[1]}" == "true" ]]; then
GIT_PROMPT+="S:"
fi
}
# Add the branch.
GIT_PROMPT+="$(git describe --contains --all HEAD)"
# Add a marker if directory is ignored, there's untracked files or a stash.
if [[ -n "$GIT_PROMPT_SHOW_IGNORED" ]] && git check-ignore -q "${PWD#"$(git rev-parse --show-toplevel)/"}"; then
GIT_PROMPT+=" !"
elif [[ -n "$GIT_PROMPT_SHOW_UNSTAGED" ]] && git ls-files --modified --exclude-standard --directory --error-unmatch -- ':/*' >/dev/null 2>&1; then
GIT_PROMPT+=" *"
elif [[ -n "$GIT_PROMPT_SHOW_UNTRACKED" ]] && git ls-files --others --exclude-standard --directory --error-unmatch -- ':/*' >/dev/null 2>&1; then
GIT_PROMPT+=" ?"
elif [[ -n "$GIT_PROMPT_SHOW_STASH" ]] && git rev-parse --verify --quiet refs/stash >/dev/null; then
GIT_PROMPT+=" &"
fi
# Get upstream status.
[[ -n "$GIT_PROMPT_SHOW_UPSTREAM" ]] || [[ -n "$GIT_PROMPT_SHOW_UPSTREAM_EXTENDED" ]] && {
COUNT="$(git rev-list --count --left-right '@{upstream}'...HEAD 2>/dev/null | tr '[:blank:]' ' ')"
case "$COUNT" in
"")
# No upstream.
GIT_PROMPT+=" ??"
;;
"0 0")
# Equal to upstream.
GIT_PROMPT+=" =="
;;
"0 "*)
# Ahead of upstream.
GIT_PROMPT+=" >"
if [[ -n "$GIT_PROMPT_SHOW_UPSTREAM_EXTENDED" ]]; then
# Show the number of the difference.
GIT_PROMPT+="${COUNT#0 }"
else
GIT_PROMPT+=">"
fi
;;
*" 0")
# Behind upstream.
GIT_PROMPT+=" <"
if [[ -n "$GIT_PROMPT_SHOW_UPSTREAM_EXTENDED" ]]; then
# Show the number of the difference.
GIT_PROMPT+="${COUNT% 0}"
else
GIT_PROMPT+="<"
fi
;;
*)
# Divergent from upstream.
GIT_PROMPT+=" <>"
;;
esac
}
fi
# Output the prompt.
# shellcheck disable=SC2059
printf -- "$1" "$GIT_PROMPT"
# Return the original error code.
return "$RET"
}
__prompt_user_colour() {
# Determine the colour of the username in the prompt.
local RET="$?"
if [[ "$LOGNAME" == "root" ]]; then
printf "%s" "1;31m" # Bright Red.
elif [[ "$LOGNAME" == "tadgy" ]]; then
printf "%s" "1;32m" # Bright Green.
else
printf "%s" "1;36m" # Bright Cyan.
fi
return "$RET"
}
__nanorc_prompt_command() {
# Dynamically handle .nanorc file versions.
hash nano >/dev/null 2>&1 && {
# shellcheck disable=SC2155
local NANO_VER="$(command nano --version | awk '/version/ { print $4 }' | cut -d. -f1)"
# Darwin specifc .nanorc version.
[[ "$PLATFORM" == "Darwin" ]] && NANO_VER="darwin"
if [[ -f "$HOME/.nanorc-$NANO_VER" ]]; then
if (( NANO_VER <= 4 )); then
( cd "$HOME" && ln -sf ".nanorc-$NANO_VER" ".nanorc" )
else
# shellcheck disable=SC2139
alias nano="nano -f \"$HOME/.nanorc-$NANO_VER\""
fi
else
if (( NANO_VER <= 4 )); then
[[ -L "$HOME/.nanorc" ]] && rm -f "$HOME/.nanorc"
else
unalias nano
fi
printf "\\033[1;31m%s\\033[39m\\n" "No .nanorc for version '$NANO_VER'." >&2
fi
}
}
__find_ssh_agent_sock() { __find_ssh_agent_sock() {
# Find an *active* ssh agent socket. # Find an *active* ssh agent socket.
# Returns: 0 = Found an active socket. # Returns: 0 = Found an active socket.
@ -24,23 +172,20 @@ __read_ssh_agents() {
# Read all the known ssh agent sockets into an array. # Read all the known ssh agent sockets into an array.
# Returns: 0 = Processed and read the agents file without issue. # Returns: 0 = Processed and read the agents file without issue.
# 1 = Error processing/reading the agents file. # 1 = Error processing/reading the agents file.
local ERR FD I PLATFORM SOCK local ERR FD I SOCK
[[ ! -e "$HOME/.ssh/agents" ]] && touch "$HOME/.ssh/agents" [[ ! -e "$HOME/.ssh/agents" ]] && touch "$HOME/.ssh/agents"
# Determine the platform being logged into.
PLATFORM="$(uname -s)"
# Lock the ~/.ssh/agents file. # Lock the ~/.ssh/agents file.
if [[ "$PLATFORM" == "Linux" ]]; then if [[ "$PLATFORM" == "Linux" ]]; then
# Linux has 'flock', thankfully. # Linux has 'flock', thankfully.
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;31;40m%s\\033[0;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
return 1 return 1
elif (( ERR > 0 )); then elif (( ERR > 0 )); then
printf "\\033[1;31;40m%s\\033[0;39m\\n" "Flock usage error." >&2 printf "\\033[1;31m%s\\033[39m\\n" "Flock usage error." >&2
return 1 return 1
fi fi
@ -50,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
@ -61,11 +207,11 @@ __read_ssh_agents() {
fi fi
done done
(( ERR != 0 )) && { (( ERR != 0 )) && {
printf "\\033[1;31;40m%s\\033[0;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
return 1 return 1
} }
else else
printf "\\033[1;31;40m%s\\033[0;39m\\n" "File locking unsupported on '$PLATFORM'." >&2 printf "\\033[1;31m%s\\033[39m\\n" "File locking unsupported on '$PLATFORM'." >&2
return 1 return 1
fi fi
@ -76,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"
@ -86,7 +232,7 @@ __read_ssh_agents() {
# Error out if the data couldn't be read. # Error out if the data couldn't be read.
(( ERR != 0 )) && { (( ERR != 0 )) && {
printf "\\033[1;31;40m%s\\033[0;39m\\n" "Failed to read ssh-agent socket list." >&2 printf "\\033[1;31m%s\\033[39m\\n" "Failed to read ssh-agent socket list." >&2
unset SSH_AUTH_SOCKS SSH_AGENTS_MTIME unset SSH_AUTH_SOCKS SSH_AGENTS_MTIME
return 1 return 1
} }
@ -114,9 +260,6 @@ __write_ssh_agents() {
(( $? <= 1 )) && SOCKS+=("${SSH_AUTH_SOCKS[$I]}") (( $? <= 1 )) && SOCKS+=("${SSH_AUTH_SOCKS[$I]}")
done done
# Determine the platform being logged into.
PLATFORM="$(uname -s)"
# Lock the ~/.ssh/agents file. # Lock the ~/.ssh/agents file.
if [[ "$PLATFORM" == "Linux" ]]; then if [[ "$PLATFORM" == "Linux" ]]; 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.
@ -124,24 +267,25 @@ __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;31;40m%s\\033[0;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
return 1 return 1
elif (( ERR > 0 )); then elif (( ERR > 0 )); then
printf "\\033[1;31;40m%s\\033[0;39m\\n" "Flock usage error." >&2 printf "\\033[1;31m%s\\033[39m\\n" "Flock usage error." >&2
return 1 return 1
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
@ -150,11 +294,11 @@ __write_ssh_agents() {
fi fi
done done
(( ERR != 0 )) && { (( ERR != 0 )) && {
printf "\\033[1;31;40m%s\\033[0;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
return 1 return 1
} }
else else
printf "\\033[1;31;40m%s\\033[0;39m\\n" "File locking unsupported on '$PLATFORM'." >&2 printf "\\033[1;31m%s\\033[39m\\n" "File locking unsupported on '$PLATFORM'." >&2
return 1 return 1
fi fi
@ -163,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.
@ -171,7 +315,7 @@ __write_ssh_agents() {
rm -f "$HOME/.ssh/agents" 2>/dev/null rm -f "$HOME/.ssh/agents" 2>/dev/null
elif (( ERR >= 1 )); then elif (( ERR >= 1 )); then
rm -f "$HOME/.ssh/agents" 2>/dev/null rm -f "$HOME/.ssh/agents" 2>/dev/null
printf "\\033[1;31;40m%s\\033[0;39m\\n" "Failed to write ssh-agent socket list." >&2 printf "\\033[1;31m%s\\033[39m\\n" "Failed to write ssh-agent socket list." >&2
return 1 return 1
fi fi
return 0 return 0
@ -198,17 +342,17 @@ __ssh_agent_prompt_command() {
# Find a new socket to use. # Find a new socket to use.
if __find_ssh_agent_sock; then if __find_ssh_agent_sock; then
printf "\\033[1;33;40m%s\\033[0;39m\\n" "Connected to existing ssh-agent socket." printf "\\033[1;33m%s\\033[39m\\n" "Connected to existing ssh-agent socket."
sleep 0.5 sleep 0.5
else else
# Start a new agent. # Start a new agent.
eval "$(ssh-agent -s 2>/dev/null | grep -v 'echo'; printf "%s" "ERR=${PIPESTATUS[0]}")" eval "$(ssh-agent -s 2>/dev/null | grep -v 'echo'; printf "%s" "ERR=${PIPESTATUS[0]}")"
(( ERR > 0 )) && { (( ERR > 0 )) && {
printf "\\033[1;31;40m%s\\033[0;39m\\n" "Failed to start new ssh-agent - continuing with no agent." printf "\\033[1;31m%s\\033[39m\\n" "Failed to start new ssh-agent - continuing with no agent."
sleep 0.5 sleep 0.5
return 1 return 1
} }
printf "\\033[1;32;40m%s\\033[0;39m\\n" "Started new ssh-agent." printf "\\033[1;32m%s\\033[39m\\n" "Started new ssh-agent."
__write_ssh_agents __write_ssh_agents
sleep 0.5 sleep 0.5
fi fi
@ -235,18 +379,21 @@ 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
# Determine the colour of the username in the prompt. # The commands to execute before the prompt is displayed.
if [[ "$LOGNAME" == "root" ]]; then PROMPT_COMMAND="__nanorc_prompt_command; __ssh_agent_prompt_command"
COLOUR=1 # Red
elif [[ "$LOGNAME" == "tadgy" ]]; then # Git prompt options.
COLOUR=2 # Green GIT_PROMPT_SHOW_TYPE=1
else GIT_PROMPT_SHOW_IGNORED=1
COLOUR=5 # Purple GIT_PROMPT_SHOW_UNSTAGED=1
fi GIT_PROMPT_SHOW_UNTRACKED=1
GIT_PROMPT_SHOW_STASH=1
GIT_PROMPT_SHOW_UPSTREAM=1
GIT_PROMPT_SHOW_UPSTREAM_EXTENDED=1
# Version specific set up. # Version specific set up.
if (( BASH_VERSINFO[0] >= 4 )); then if (( BASH_VERSINFO[0] >= 4 )); then
@ -256,21 +403,17 @@ if (( BASH_VERSINFO[0] >= 4 )); then
# Trim the path in the prompt. # Trim the path in the prompt.
PROMPT_DIRTRIM=2 PROMPT_DIRTRIM=2
# Coloured username + host + directory: # Coloured username + host + directory:
PS1="[\[$(tput bold)$(tput setaf "$COLOUR")\]\u\[$(tput sgr0)\]@\[$(tput bold)$(tput setaf 3)\]\h\[$(tput sgr0)\]] \[$(tput bold)$(tput setaf 4)\]\w\[$(tput sgr0)\] ->" PS1='[\[\033[$(__prompt_user_colour)\]\u\[\033[39m\]@\[\033[1;33m\]\h\[\033[39m\]] \[\033[1;34m\]\w\[\033[39m\]$(__prompt_git_status "\[\\033[1;35m\] (%s)\[\\033[39m\]") ->'
else else
# Set the prompts. # Set the prompts.
# Coloured username + host + directory: # Coloured username + host + directory:
# shellcheck disable=SC2154 # shellcheck disable=SC2154
PS1="[\[$(tput bold)$(tput setaf "$COLOUR")\]\u\[$(tput sgr0)\]@\[$(tput bold)$(tput setaf 3)\]\h\[$(tput sgr0)\]] \[$(tput bold)$(tput setaf 4)\]\$(echo \"\${PWD/#\$HOME/~}\" | awk -F/ '{if (NF>3) {printf \".../\" \$(NF-1) \"/\" \$NF} else {printf \$0}}')\[$(tput sgr0)\] ->" 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
unset COLOUR
# Set the debugger prompt. # Set the debugger prompt.
# shellcheck disable=SC2155 # shellcheck disable=SC2155
export PS4="+(\[\e[1;33;40m\]\$?\[$(tput sgr0)\]) \[$(tput bold)$(tput setaf 4)\]\${BASH_SOURCE##*/}\[$(tput sgr0)\]\${FUNCNAME[0]:+(\[$(tput bold)$(tput setaf 2)\]\${FUNCNAME[0]}\[$(tput sgr0)\])}:\[$(tput bold)$(tput setaf 1)\]\$LINENO\[$(tput sgr0)\]: " export PS4='+(\[\033[1;33m\]$?\[\033[39m\]) \[\033[1;34m\]${BASH_SOURCE##*/}\[\033[39m\]${FUNCNAME[0]:+(\[\033[1;32m\]${FUNCNAME[0]}\[\033[39m\])}:\[\033[1;31m\]$LINENO\[\033[39m\]: '
# The commands to execute before the prompt is displayed.
PROMPT_COMMAND="__ssh_agent_prompt_command"
# Common aliases. # Common aliases.
hash bc >/dev/null 2>&1 && alias bc='bc -lq' hash bc >/dev/null 2>&1 && alias bc='bc -lq'
@ -314,22 +457,6 @@ PLATFORM="$(uname -s)"
# Platform specific set up. # Platform specific set up.
if [[ "$PLATFORM" = "Linux" ]]; then if [[ "$PLATFORM" = "Linux" ]]; then
# Linux specific functions. # Linux specific functions.
hash nano >/dev/null 2>&1 && nano() {
# shellcheck disable=SC2155
local NANO_VER="$(command nano --version | awk '/version/ { print $4 }' | cut -d. -f1)"
if [[ -f "$HOME/.nanorc-$NANO_VER" ]]; then
if (( NANO_VER <= 4 )); then
( cd "$HOME" && ln -sf ".nanorc-$NANO_VER" ".nanorc" )
command nano "$@"
rm -f "$HOME/.nanorc"
else
command nano -f "$HOME/.nanorc-$NANO_VER" "$@"
fi
else
printf "%s: %s\\n" "${FUNCNAME[0]}" "no .nanorc for version '$NANO_VER'" >&2
return 1
fi
}
hash ps grep >/dev/null 2>&1 && psgrep() { hash ps grep >/dev/null 2>&1 && psgrep() {
if [[ -n "$1" ]]; then if [[ -n "$1" ]]; then
# shellcheck disable=SC2009 # shellcheck disable=SC2009
@ -353,23 +480,10 @@ if [[ "$PLATFORM" = "Linux" ]]; then
hash pinfo >/dev/null 2>&1 && alias info='pinfo' hash pinfo >/dev/null 2>&1 && alias info='pinfo'
hash ping >/dev/null 2>&1 && alias ping='ping -b' hash ping >/dev/null 2>&1 && alias ping='ping -b'
elif [[ "$PLATFORM" = "Darwin" ]]; then elif [[ "$PLATFORM" = "Darwin" ]]; then
# Darwin specific functions.
hash nano >/dev/null 2>&1 && nano() {
if [[ -f "$HOME/.nanorc-darwin" ]]; then
( cd "$HOME" && ln -sf ".nanorc-darwin" ".nanorc" )
command nano "$@"
rm -f "$HOME/.nanorc"
else
printf "%s: %s\\n" "${FUNCNAME[0]}" "no .nanorc-darwin found" >&2
return 1
fi
}
# Darwin specific aliases. # Darwin specific aliases.
hash df >/dev/null 2>&1 && alias df='df -P' hash df >/dev/null 2>&1 && alias df='df -P'
hash ls >/dev/null 2>&1 && alias ls='ls -bFG' hash ls >/dev/null 2>&1 && alias ls='ls -bFG'
hash top >/dev/null 2>&1 && alias top='top -o cpu -S' hash top >/dev/null 2>&1 && alias top='top -o cpu -S'
else else
echo "${BASH_SOURCE##*/}: unsupported platform: $PLATFORM" >&2 printf "%s: %s\\n" "${BASH_SOURCE##*/}" "unsupported platform: $PLATFORM" >&2
fi fi
unset PLATFORM

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/

61
.gitignore vendored
View file

@ -1,32 +1,37 @@
* /*
!.* !/.*
!.*/** !/.*/
!/.*/**
*~ *~
.nfs* .nfs*
*.save *.save
.*.swp .*.swp
.ICEauthority .CFUserTextEncoding
.Xauthority .DS_Store
.Xauthority.orig /.ICEauthority
.ab* /.Trash/
.alpine-smime/ /.Xauthority*
.aspell.* /.ab*
.bash_history /.alpine-smime/
.bash_history-* /.aspell.*
.cache/ /.bash_history*
.dbus/ /.cache/
.fltk/ /.cups/
.lesshst /.dbus/
.lynx.cookies /.fltk/
.mozilla/ /.lesshst
.nanorc /.lynx.cookies
.pki/ /.mozilla/
.rnd /.nanorc
.screen-*/ /.nano_history
.sqlite_history /.pki/
.thumbnails/ /.rnd
.vmware /.screen-*/
.vnc /.sqlite_history
.wget-hsts /.thumbnails/
.xca /.viminfo
.xsession-errors* /.vmware/
/.vnc/
/.wget-hsts
/.xca/
/.xsession-errors*

View file

@ -25,7 +25,13 @@ Host amy amy.hosts.slackware.network bender bender.hosts.slackware.network fry f
CanonicalizeHostname yes CanonicalizeHostname yes
Port 9922 Port 9922
Host as.hosts.slackware.network esx0.hosts.slackware.network esx1.hosts.slackware.network Host as.hosts.slackware.network
Port 9922
User root
ForwardAgent no
ClearAllForwardings yes
Host esx0.hosts.slackware.network esx1.hosts.slackware.network
User root User root
ForwardAgent no ForwardAgent no
ClearAllForwardings yes ClearAllForwardings yes