commit 1e08109ef0be597173a3cb4d24ad472ff462cd02
parent a3bfe92b163f94ede73686dfddf6c7e11690b98b
Author: pyratebeard <root@pyratebeard.net>
Date: Thu, 9 May 2024 14:56:30 +0100
Include tag compatibility
added an extra arg to pass a tag name that can be used to match configuration in ssh_config
updated man page accordingly
Diffstat:
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drist b/drist
@@ -6,9 +6,11 @@ EXEC=""
SSHONCE=0
TRUNCATE=0
TEMPDIR=""
+USETAG=0
+TAG=""
usage() {
- echo "$0 [-p] [-d] [-s [-e sudo|doas]] server [...]"
+ echo "$0 [-p] [-d] [-s [-e sudo|doas]] [-P tag] server [...]"
exit 0
}
@@ -66,12 +68,13 @@ delete_temp() {
# RUNTIME BEGINS HERE
-while getopts pndse: arg; do
+while getopts pndse:P: arg; do
case ${arg} in
d) TRUNCATE=1 ;;
s) SUDO=1 ;;
e) SUDO_BIN="${OPTARG}" ;;
p) SSHONCE=1 ;;
+ P) USETAG=1 ; TAG="${OPTARG}" ;;
*) usage ;;
esac
done
@@ -89,6 +92,11 @@ then
SSH_PARAMS=-o"ControlMaster=auto"" "-o"ControlPath=/tmp/drist_ssh_%h_%p_%r.sock"" "-o"ControlPersist=1m"
fi
+if [ "$USETAG" -eq 1 ]
+then
+ SSH_PARAMS="${SSH_PARAMS}"" "-P"${TAG}"
+fi
+
# start looping over server list
if [ -f "$1" ]
then
diff --git a/drist.1 b/drist.1
@@ -8,6 +8,7 @@
.Op Fl p
.Op Fl d
.Op Fl s Op Fl e Ar sudo|doas
+.Op Fl P Ar tag
.Ar destination
.Sh OPTIONS
.Bl -tag -width Ds
@@ -28,6 +29,9 @@ Default is sudo.
binary to use for executing the commands as root.
This flag is only useful when used with
.Fl s .
+.It Op Fl P Ar tag
+specify a tag name that may be used to select configuration in
+.Xr ssh_config 5 .
.It Ar destination
Specify the remote servers you want drist to work on.
.Ar destination