aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2022-03-26 19:31:39 +1300
committerTom Ryder <tom@sanctum.geek.nz>2022-03-26 19:31:39 +1300
commit945a9583d7e66f7489d7902b50d35a7235d122c8 (patch)
tree41a1eb2789ad28688d626c144fb6aad7828783b0
parentMerge branch 'release/v11.13.0' (diff)
parentUpdate dotfiles(7) manual page (diff)
downloaddotfiles-945a9583d7e66f7489d7902b50d35a7235d122c8.tar.gz
dotfiles-945a9583d7e66f7489d7902b50d35a7235d122c8.zip
Merge branch 'release/v11.14.0'v11.14.0
* release/v11.14.0: Update dotfiles(7) manual page Add Torsocks management function `tor` Shorten some long lines in path.sh
-rw-r--r--README.md2
-rw-r--r--VERSION4
-rw-r--r--man/man7/dotfiles.7df3
-rw-r--r--sh/shrc.d/path.sh8
-rw-r--r--sh/shrc.d/tor.sh33
5 files changed, 45 insertions, 5 deletions
diff --git a/README.md b/README.md
index 15a46b71..dc609744 100644
--- a/README.md
+++ b/README.md
@@ -249,6 +249,8 @@ in `sh/shrc.d` to be loaded by any POSIX interactive shell. Those include:
- `scp()` tries to detect forgotten hostnames in `scp(1)` command calls.
- `sudo()` forces `-H` for `sudo(8)` calls so that `$HOME` is never preserved;
I hate having `root`-owned files in my home directory.
+- `tor()` is just a terse shortcut for using Torsocks to anonymize TCP
+ connections from the current shell.
- `tree()` colorizes GNU `tree(1)` output if possible (without having
`LS_COLORS` set).
- `x()` is a one-key shortcut for `exec startx`.
diff --git a/VERSION b/VERSION
index 7d02c1b9..a2b39528 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-tejr dotfiles v11.13.0
-Sat, 26 Mar 2022 04:31:22 +0000
+tejr dotfiles v11.14.0
+Sat, 26 Mar 2022 06:31:37 +0000
diff --git a/man/man7/dotfiles.7df b/man/man7/dotfiles.7df
index 73055a24..ea6d3080 100644
--- a/man/man7/dotfiles.7df
+++ b/man/man7/dotfiles.7df
@@ -379,6 +379,9 @@ command calls.
\f[C]$HOME\f[R] is never preserved; I hate having \f[C]root\f[R]-owned
files in my home directory.
.IP \[bu] 2
+\f[C]tor()\f[R] is just a terse shortcut for using Torsocks to anonymize
+TCP connections from the current shell.
+.IP \[bu] 2
\f[C]tree()\f[R] colorizes GNU \f[C]tree(1)\f[R] output if possible
(without having \f[C]LS_COLORS\f[R] set).
.IP \[bu] 2
diff --git a/sh/shrc.d/path.sh b/sh/shrc.d/path.sh
index a854e148..812f5f0f 100644
--- a/sh/shrc.d/path.sh
+++ b/sh/shrc.d/path.sh
@@ -130,7 +130,7 @@ path(): Manage contents of PATH variable
USAGE:
path [list]
- Print the current directories in PATH, one per line (default command)
+ Print the current directories in PATH, one per line (default)
path insert [DIR]
Add directory DIR (default $PWD) to the front of PATH
path append [DIR]
@@ -142,7 +142,7 @@ USAGE:
path pop
Remove the last directory from PATH
path check [DIR]
- Return whether directory DIR (default $PWD) is a component of PATH
+ Return whether directory DIR (default $PWD) is in PATH
path help
Print this help message
EOF
@@ -150,7 +150,9 @@ EOF
# Command not found
*)
- printf >&2 'path(): %s: Unknown command (try "help")\n' "$1"
+ printf >&2 \
+ 'path(): %s: Unknown command (try "help")\n' \
+ "$1"
return 2
;;
esac
diff --git a/sh/shrc.d/tor.sh b/sh/shrc.d/tor.sh
new file mode 100644
index 00000000..e6e31341
--- /dev/null
+++ b/sh/shrc.d/tor.sh
@@ -0,0 +1,33 @@
+# Manage Torsocks for the current shell
+tor() {
+
+ # Check first argument to figure out operation
+ case $1 in
+
+ # Show whether Torsocks
+ show|'')
+ case $LD_PRELOAD: in
+ (*/libtorsocks.so:*)
+ printf 'on\n'
+ ;;
+ (*)
+ printf 'off\n'
+ ;;
+ esac
+ ;;
+
+ # Turn Torsocks on or off
+ on|off)
+ command -v torsocks >/dev/null 2>&1 || return
+ . "$(command -v torsocks)"
+ ;;
+
+ # Command not found
+ *)
+ printf >&2 \
+ 'tor(): %s: Unknown command (try "help")\n' \
+ "$1"
+ return 2
+ ;;
+ esac
+}