From a6f833087a0220b1487cb5a4550f0b0d22ba55ec Mon Sep 17 00:00:00 2001 From: Runciter Date: Sun, 31 Mar 2024 19:52:10 +0800 Subject: Initial. A .gitignore A AUTHORS A COPYING A ChangeLog A HACKING A Makefile.am A NEWS A README A README.org A build-aux/test-driver.scm A configure.ac A doc/whispers.texi A guix.scm A hall.scm A pre-inst-env.in A scripts/whispers.in A whispers.scm A whispers/hconfig.scm --- scripts/whispers.in | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 scripts/whispers.in (limited to 'scripts') diff --git a/scripts/whispers.in b/scripts/whispers.in new file mode 100644 index 0000000..f6f3a9a --- /dev/null +++ b/scripts/whispers.in @@ -0,0 +1,108 @@ +#!@GUILE@ \ +--no-auto-compile -e main -s +!# + +;;; Whispers --- Stealth VPN and ssh tunneler +;;; Copyright © 2024 Runciter +;;; +;;; This file is part of Whispers. +;;; +;;; Whispers is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; Whispers is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Whispers. If not, see . + +(use-modules (config)) +(use-modules (whispers)) + +(define herd-path "/run/current-system/profile/bin/herd") + +(define config + (configuration + (name 'whispers) + (version "0.1") + (keywords + (list + (switch + (name 'lieutenant) + (character #\l) + (default "/") + (example "LIEUTENANT-PATH ACTION [SERVICE [ARG...]]") + (test (lambda (lieutenant-path) + (equal? "/" (substring lieutenant-path 0 1)))) + (synopsis "Absolute lieutenant path, and arguments passed to herd.")) + (switch + (name 'vers-herd) + (test boolean?) + (default #f) + (character #f) + (synopsis "Display the herd version.")) + (switch + (name 'help-herd) + (test boolean?) + (character #f) + (default #f) + (synopsis "Display the help message of herd.")) + (switch + (name 'usage-herd) + (test boolean?) + (character #f) + (default #f) + (synopsis "Display the short usage message of herd.")))) + (synopsis "Send commands to shepherd lieutenants of the whispers tree.") + (description "The whispers command is a simple convenience wrapper + around the herd program. Instead of specifying a file path +to the listening socket of a running shepherd in the whispers tree, the +user simply provides its absolute whispers tree path as an +argument to the --lieutenant option of this command. + +LIEUTENANT-PATH: absolute path to a shepherd lieutenant in the whispers +tree. Must start with a slash character. + +ACTION: the shepherd service action to perform. + +SERVICE: the shepherd service of which the ACTION is to be performed. + +ARG...: arguments passed to the procedure of the shepherd action. + +If the --lieutenant switch and its LIEUTENANT-PATH argument are omitted, +an action is performed on a service of the shepherd at the root of the +whispers tree, which is itself a child process of the root shepher PID 1 +handled as one of its services. As such, using +'whispers -l / ACTION [SERVICE [ARG...]]' +or +'whispers ACTION [SERVICE [ARG...]]' +have exactly the same effect."))) + +(define (main cmd-line) + (let ((options (getopt-config-auto cmd-line config))) + (cond ((option-ref options 'help-herd) + (system* herd-path + "--help")) + ((option-ref options 'vers-herd) + (system* herd-path + "--version")) + ((option-ref options 'usage-herd) + (system* herd-path + "--usage")) + (else (whispers #:lieutenant + (option-ref options 'lieutenant) + #:act + (cond ((or (equal? "-l" + (cadr (command-line))) + (equal? "--lieutenant" + (cadr (command-line)))) + (cdddr (command-line))) + (else (cdr (command-line))))))))) + +;;; Local Variables: +;;; mode: scheme +;;; End: -- cgit v1.2.3