diff options
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | bash/bash_completion.d/_ssh_config_hosts.bash | 29 | ||||
-rw-r--r-- | bin/sls.sh | 3 | ||||
-rw-r--r-- | bin/slsf.awk | 29 | ||||
-rw-r--r-- | check/x.sh | 2 | ||||
-rw-r--r-- | lint/x.sh | 2 | ||||
-rw-r--r-- | man/man1/sls.1df | 8 | ||||
-rw-r--r-- | man/man1/slsf.1df | 8 | ||||
-rw-r--r-- | man/man7/dotfiles.7df | 4 | ||||
-rw-r--r-- | parcellite/xsession.d/redshift.sh | 2 | ||||
-rw-r--r-- | plenv/profile.d/plenv.sh | 4 | ||||
-rw-r--r-- | plenv/shrc.d/plenv.sh | 1 | ||||
-rw-r--r-- | pyenv/profile.d/pyenv.sh | 4 | ||||
-rw-r--r-- | pyenv/shrc.d/pyenv.sh | 1 | ||||
-rw-r--r-- | rbenv/profile.d/rbenv.sh | 4 | ||||
-rw-r--r-- | rbenv/shrc.d/rbenv.sh | 1 | ||||
-rw-r--r-- | redshift/xsession.d/redshift.sh | 2 | ||||
-rw-r--r-- | sh/shrc.d/gdb.sh | 2 | ||||
-rw-r--r-- | sh/shrc.d/pd.sh | 2 | ||||
-rw-r--r-- | sh/shrc.d/rd.sh | 1 | ||||
-rw-r--r-- | sh/shrc.d/sd.sh | 1 | ||||
-rw-r--r-- | sh/shrc.d/which.sh | 2 | ||||
-rw-r--r-- | sxhkd/xsession.d/sxhkd.sh | 5 | ||||
-rw-r--r-- | thunar/xsession.d/thunar.sh | 2 | ||||
-rw-r--r-- | tmux/tmux.conf | 12 | ||||
-rw-r--r-- | urxvt/xsession.d/urxvt.sh | 2 | ||||
-rw-r--r-- | vim/filetype.vim | 15 | ||||
-rw-r--r-- | x/shrc.d/x.sh (renamed from sh/shrc.d/x.sh) | 0 |
30 files changed, 86 insertions, 75 deletions
@@ -48,7 +48,6 @@ install-sxhkd \ install-systemd \ install-terminfo \ - install-thunar \ install-tidy \ install-tmux \ install-urxvt \ @@ -618,9 +617,6 @@ install-terminfo: tic terminfo/screen.ti tic terminfo/screen-256color.ti -install-thunar: install-x - cp -p -- thunar/xsession.d/* $(HOME)/.xsession.d - install-tidy: install-sh cp -p -- tidy/profile.d/*.sh $(HOME)/.profile.d mkdir -p -- $(XDG_CONFIG_HOME)/tidy @@ -678,7 +674,7 @@ install-wget: install-sh mkdir -p -- $(XDG_CACHE_HOME)/wget $(XDG_CONFIG_HOME)/wget cp -p -- wget/wgetrc $(XDG_CONFIG_HOME)/wget/wgetrc -install-x: x/xsession check-x install-logrotate +install-x: x/xsession check-x install-logrotate install-sh mkdir -p -- \ $(HOME)/.xsession.d \ $(HOME)/.Xresources.d \ @@ -688,6 +684,7 @@ install-x: x/xsession check-x install-logrotate cp -p -- x/Xresources $(HOME)/.Xresources cp -p -- x/Xresources.d/* $(HOME)/.Xresources.d cp -p -- x/logrotate/config.d/* $(XDG_CONFIG_HOME)/logrotate/config.d + cp -p -- x/shrc.d/*.sh $(HOME)/.shrc.d install-yt-dlp install-youtube-dl: mkdir -p -- $(XDG_CONFIG_HOME)/yt-dlp @@ -417,7 +417,7 @@ interactive shells. These scripts are installed by the `install-bin` target: - Three SSH-related scripts: - - `sls(1df)` prints hostnames read from a `ssh_config(5)` file. It uses + - `sls(1df)` prints hostnames read from `ssh_config(5)` files. It uses `slsf(1df)` to read each one. - `sra(1df)` runs a command on multiple hosts read from `sls(1df)` and prints output. @@ -1,2 +1,2 @@ -tejr dotfiles v12.14.0 -Thu, 28 Jul 2022 21:16:58 +0000 +tejr dotfiles v12.15.0 +Thu, 04 Aug 2022 01:57:51 +0000 diff --git a/bash/bash_completion.d/_ssh_config_hosts.bash b/bash/bash_completion.d/_ssh_config_hosts.bash index 0959f52b..16265e8a 100644 --- a/bash/bash_completion.d/_ssh_config_hosts.bash +++ b/bash/bash_completion.d/_ssh_config_hosts.bash @@ -3,23 +3,28 @@ _ssh_config_hosts() { # Iterate through SSH client config paths local config - for config in "$HOME"/.ssh/config /etc/ssh/ssh_config ; do + for config in /etc/ssh/ssh_config.d/*.conf /etc/ssh/ssh_config \ + "$HOME"/.ssh/config.d/*.conf "$HOME"/.ssh/config ; do [[ -e $config ]] || continue - # Read 'Host' options and their first value from file - local option value ci - while read -r option value _ ; do + # Read 'Host' options and their patterns from file + local option value patterns pattern ci + while read -r option value ; do [[ $option == Host ]] || continue + read -a patterns -r \ + < <(printf '%s\n' "$value") # Check host value - case $value in - # No empties - '') ;; - # No wildcards - *'*'*) ;; - # Found a match; print it - "$2"*) COMPREPLY[ci++]=$value ;; - esac + for pattern in "${patterns[@]}" ; do + case $pattern in + # No empties + '') ;; + # No wildcards + *'*'*) ;; + # Found a match; print it + "$2"*) COMPREPLY[ci++]=$pattern ;; + esac + done done < "$config" done @@ -3,7 +3,8 @@ # If we weren't given a file explicitly, we'll try to read both /etc/ssh_config # and ~/.ssh_config in that order if they exist if [ "$#" -eq 0 ] ; then - for cfg in /etc/ssh_config "$HOME"/.ssh/config ; do + for cfg in /etc/ssh_config.d/*.conf /etc/ssh_config \ + "$HOME"/.ssh/config.d/*.conf "$HOME"/.ssh/config ; do [ -e "$cfg" ] || continue set -- "$@" "$cfg" done diff --git a/bin/slsf.awk b/bin/slsf.awk index 3d5c190f..87127a2c 100644 --- a/bin/slsf.awk +++ b/bin/slsf.awk @@ -1,9 +1,28 @@ -# Print the first non-glob "Host" name from each line of ssh_config(5) files +# Print all the hosts from ssh_config(1) files # Manage the processing flag (starts set in each file) -FNR == 1 || /### sls/ { sls = 1 } +BEGIN { sls = 1 } +FNR { sls = 1 } +/### sls/ { sls = 1 } /### nosls/ { sls = 0 } -# If processing flag set, directive is "Host", and hostname has no wildcards, -# then print it -sls && $1 == "Host" && $2 !~ /\*/ { print $2 } +# Skip if we're ignoring hosts +!sls { next } +# Skip if this isn't a host line +$1 != "Host" { next } + +# Add all the patterns after the keyword that don't have wildcards +{ + for (i = 2; i <= NF; i++) { + if ($i !~ /[?*]/) { + hosts[$i]++ + } + } +} + +# Print the complete list of hosts, sorted +END { + for (host in hosts) { + print host | "sort" + } +} @@ -1 +1 @@ -sh -n -- x/xprofile x/xsession +sh -n -- x/xprofile x/xsession x/shrc.d/*.sh @@ -1 +1 @@ -shellcheck -e SC1090 -e SC1091 -s sh -- x/xprofile x/xsession +shellcheck -e SC1090 -e SC1091 -s sh -- x/xprofile x/xsession x/shrc.d/*.sh diff --git a/man/man1/sls.1df b/man/man1/sls.1df index 83c13201..dde8e622 100644 --- a/man/man1/sls.1df +++ b/man/man1/sls.1df @@ -1,4 +1,4 @@ -.TH SLS 1df "May 2014" "Manual page for sls" +.TH SLS 1df "August 2022" "Manual page for sls" .SH NAME .B sls \- list the first hostname on each line of an ssh_config(5) file @@ -10,9 +10,9 @@ ssh_config_alt1 ssh_config_alt2 .SH DESCRIPTION .B sls runs slsf(1df) on the given set of ssh_config(5) files to print the first -non-wildcard hostname on each "Host" line, defaulting to /etc/ssh/ssh_config -and ~/.ssh/config if they exist. Suitable for use in batch scripts like -sra(1df). +non-wildcard hostname on each "Host" line, defaulting to +/etc/ssh/ssh_config.d/*.conf, /etc/ssh/ssh_config, ~/.ssh/config.d/*.conf, and +~/.ssh/config if they exist. Suitable for use in batch scripts like sra(1df). .SH SEE ALSO slsf(1df), sra(1df), sta(1df), ssh(1), ssh_config(5) .SH AUTHOR diff --git a/man/man1/slsf.1df b/man/man1/slsf.1df index 31453dca..6d59ba3d 100644 --- a/man/man1/slsf.1df +++ b/man/man1/slsf.1df @@ -1,4 +1,4 @@ -.TH SLSF 1df "July 2016" "Manual page for slsf" +.TH SLSF 1df "August 2022" "Manual page for slsf" .SH NAME .B slsf \- list the first hostname on each line of ssh_config(5) files @@ -10,9 +10,9 @@ cat ~/.ssh_config | .br .SH DESCRIPTION .B slsf -iterates through the ssh_config(5) files given as its input and prints the -first name given on each "Host" line, as long as it contains no wildcards. -Most users will probably want the sls(1df) frontend. +iterates through the ssh_config(5) files given as its input and prints a unique +list of the patterns given on each "Host" line containing no wildcards. Most +users will probably want the sls(1df) frontend instead. .P Within the file, a comment "### nosls" on its own line will exclude all following output unless an "### sls" comment is read to resume it again: diff --git a/man/man7/dotfiles.7df b/man/man7/dotfiles.7df index 8c766c05..cae361a2 100644 --- a/man/man7/dotfiles.7df +++ b/man/man7/dotfiles.7df @@ -573,8 +573,8 @@ These scripts are installed by the \f[C]install-bin\f[R] target: Three SSH-related scripts: .RS 2 .IP \[bu] 2 -\f[C]sls(1df)\f[R] prints hostnames read from a \f[C]ssh_config(5)\f[R] -file. +\f[C]sls(1df)\f[R] prints hostnames read from \f[C]ssh_config(5)\f[R] +files. It uses \f[C]slsf(1df)\f[R] to read each one. .IP \[bu] 2 \f[C]sra(1df)\f[R] runs a command on multiple hosts read from diff --git a/parcellite/xsession.d/redshift.sh b/parcellite/xsession.d/redshift.sh index 25241ab3..39fb6c4e 100644 --- a/parcellite/xsession.d/redshift.sh +++ b/parcellite/xsession.d/redshift.sh @@ -1,2 +1,2 @@ -# Start parcellite(1) +# Start X clipboard manager parcellite & diff --git a/plenv/profile.d/plenv.sh b/plenv/profile.d/plenv.sh index 36d6289b..5bfc2d24 100644 --- a/plenv/profile.d/plenv.sh +++ b/plenv/profile.d/plenv.sh @@ -1,2 +1,2 @@ -# Add plenv shims and bindir to PATH -PATH=$HOME/.plenv/shims:$HOME/.plenv/bin:$PATH +# Add plenv bindir and shims to PATH +PATH=$HOME/.plenv/bin:$HOME/.plenv/shims:$PATH diff --git a/plenv/shrc.d/plenv.sh b/plenv/shrc.d/plenv.sh index bb52ffe2..938bcbf6 100644 --- a/plenv/shrc.d/plenv.sh +++ b/plenv/shrc.d/plenv.sh @@ -1,5 +1,4 @@ # POSIX-compatible version of the plenv Bash shell wrapper -[ -d "$HOME"/.plenv ] || return plenv() { case $1 in rehash) diff --git a/pyenv/profile.d/pyenv.sh b/pyenv/profile.d/pyenv.sh index 3ad73c68..ea2455fb 100644 --- a/pyenv/profile.d/pyenv.sh +++ b/pyenv/profile.d/pyenv.sh @@ -1,2 +1,2 @@ -# Add pyenv shims and bindir to PATH -PATH=$HOME/.pyenv/shims:$HOME/.pyenv/bin:$PATH +# Add pyenv bindir and shims to PATH +PATH=$HOME/.pyenv/bin:$HOME/.pyenv/shims:$PATH diff --git a/pyenv/shrc.d/pyenv.sh b/pyenv/shrc.d/pyenv.sh index 0a946164..60ed8ac7 100644 --- a/pyenv/shrc.d/pyenv.sh +++ b/pyenv/shrc.d/pyenv.sh @@ -1,5 +1,4 @@ # POSIX-compatible version of the pyenv Bash shell wrapper -[ -d "$HOME"/.pyenv ] || return pyenv() { case $1 in rehash) diff --git a/rbenv/profile.d/rbenv.sh b/rbenv/profile.d/rbenv.sh index 522ff247..5295584c 100644 --- a/rbenv/profile.d/rbenv.sh +++ b/rbenv/profile.d/rbenv.sh @@ -1,2 +1,2 @@ -# Add rbenv shims and bindir to PATH -PATH=$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH +# Add rbenv bindir and shims to PATH +PATH=$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH diff --git a/rbenv/shrc.d/rbenv.sh b/rbenv/shrc.d/rbenv.sh index ed9ddd03..14403680 100644 --- a/rbenv/shrc.d/rbenv.sh +++ b/rbenv/shrc.d/rbenv.sh @@ -1,5 +1,4 @@ # POSIX-compatible version of the rbenv Bash shell wrapper -[ -d "$HOME"/.rbenv ] || return rbenv() { case $1 in rehash) diff --git a/redshift/xsession.d/redshift.sh b/redshift/xsession.d/redshift.sh index 929f564e..503877dc 100644 --- a/redshift/xsession.d/redshift.sh +++ b/redshift/xsession.d/redshift.sh @@ -1,2 +1,2 @@ -# Start redshift(1) +# Start X color temperature manager redshift & diff --git a/sh/shrc.d/gdb.sh b/sh/shrc.d/gdb.sh index ec9d4137..4fb459cb 100644 --- a/sh/shrc.d/gdb.sh +++ b/sh/shrc.d/gdb.sh @@ -1,4 +1,4 @@ # Don't print the GDB copyright message on every invocation gdb() { - command gdb -q "$@" + command gdb --quiet "$@" } diff --git a/sh/shrc.d/pd.sh b/sh/shrc.d/pd.sh index 77f6bae9..e99049d3 100644 --- a/sh/shrc.d/pd.sh +++ b/sh/shrc.d/pd.sh @@ -2,8 +2,6 @@ # use when you've got a file path in a variable, or in history, or in Alt+., # and want to quickly move to its containing directory. In the absence of an # argument, this just shifts up a directory, i.e. `cd ..` -# -# Note this is equivalent to `ud 1`. pd() { # Check arguments; default to $PWD diff --git a/sh/shrc.d/rd.sh b/sh/shrc.d/rd.sh index e6d761a6..3e1b4d9c 100644 --- a/sh/shrc.d/rd.sh +++ b/sh/shrc.d/rd.sh @@ -11,6 +11,7 @@ # $ rd usr opt # $ pwd # /opt/bin +# rd() { # Check argument count diff --git a/sh/shrc.d/sd.sh b/sh/shrc.d/sd.sh index 10597832..1fe748c4 100644 --- a/sh/shrc.d/sd.sh +++ b/sh/shrc.d/sd.sh @@ -30,6 +30,7 @@ # /tmp/tmp.ZSunna5Eup/a # # Seems to work for symbolic links. +# sd() { # Check argument count diff --git a/sh/shrc.d/which.sh b/sh/shrc.d/which.sh index 9d8c899a..528e5048 100644 --- a/sh/shrc.d/which.sh +++ b/sh/shrc.d/which.sh @@ -1,3 +1,5 @@ +# Try to stop me using the non-standard `which`: +# <http://mywiki.wooledge.org/BadUtils#which> which() { printf >&2 'Whichcraft detected! Did you mean: command -v %s\n' "$*" return 2 diff --git a/sxhkd/xsession.d/sxhkd.sh b/sxhkd/xsession.d/sxhkd.sh index d52396c9..ca0e27e3 100644 --- a/sxhkd/xsession.d/sxhkd.sh +++ b/sxhkd/xsession.d/sxhkd.sh @@ -1,3 +1,2 @@ -# Start sxhkd(1) -SXHKD_SHELL=$(command -pv sh) \ - sxhkd & +# Start X hotkey daemon +sxhkd & diff --git a/thunar/xsession.d/thunar.sh b/thunar/xsession.d/thunar.sh deleted file mode 100644 index 9d35a3ce..00000000 --- a/thunar/xsession.d/thunar.sh +++ /dev/null @@ -1,2 +0,0 @@ -# Start Thunar's daemon mode -thunar --daemon & diff --git a/tmux/tmux.conf b/tmux/tmux.conf index ca4e7172..e7f088bd 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -1,15 +1,3 @@ -# Strip out a lot of machine and X11 dependent crap from the initial -# environment -set-environment -gru DISPLAY -set-environment -gru SSH_CLIENT -set-environment -gru SSH_CONNECTION -set-environment -gru SSH_TTY -set-environment -gru WINDOWID - -# Otherwise, use the environment we had when we started; don't touch it during -# a session unless I specifically ask -set-option -g update-environment 'COLORFGBG COLORTERM' - # Setting this makes each new pane a non-login shell, which suits me better set-option -g default-command "exec $SHELL" diff --git a/urxvt/xsession.d/urxvt.sh b/urxvt/xsession.d/urxvt.sh index 03b0efd5..766c2939 100644 --- a/urxvt/xsession.d/urxvt.sh +++ b/urxvt/xsession.d/urxvt.sh @@ -1,2 +1,2 @@ -# Run urxvtd(1) in the background +# Start X terminator emulator daemon urxvtd --fork --opendisplay diff --git a/vim/filetype.vim b/vim/filetype.vim index 01cc0f3a..c616babd 100644 --- a/vim/filetype.vim +++ b/vim/filetype.vim @@ -434,18 +434,23 @@ augroup filetypedetect \ ?*.sql \ setfiletype sql " OpenSSH configuration + "" client autocmd BufNewFile,BufRead - \ ssh_config,*/.ssh/config + \ ssh_config + \,*/ssh_config.d/*.conf + \,*/.ssh/config, + \,*/.ssh/config.d/*.conf \ setfiletype sshconfig + "" server + autocmd BufNewFile,BufRead + \ sshd_config + \,*/sshd_config.d/*.conf + \ setfiletype sshdconfig " sudoers(5) autocmd BufNewFile,BufRead \ sudoers \,sudoers.tmp \ setfiletype sudoers - " OpenSSH server configuration - autocmd BufNewFile,BufRead - \ sshd_config - \ setfiletype sshdconfig " Subversion commit autocmd BufNewFile,BufRead \ svn-commit*.tmp diff --git a/sh/shrc.d/x.sh b/x/shrc.d/x.sh index ed921c68..ed921c68 100644 --- a/sh/shrc.d/x.sh +++ b/x/shrc.d/x.sh |