Add a "screen" subcommand to krbroot
authorAlex Dehnert <adehnert@mit.edu>
Sun, 21 Apr 2013 20:26:59 +0000 (16:26 -0400)
committerAlex Dehnert <adehnert@mit.edu>
Sun, 21 Apr 2013 20:26:59 +0000 (16:26 -0400)
I have screen profiles for "all scripts web servers", "all scripts hosts",
etc., which means I often want to run screen with root tickets and pass it some
options. This makes that easy.

This uses the technique from ASA DB commit
08d4fa6744d2785023666d10a1936460811fcdb2
(https://asa.scripts.mit.edu/trac/changeset/08d4fa6744d2785023666d10a1936460811fcdb2)
to pass commands possibly containing metacharacters through pagsh without
quoting issues.

krbroot

diff --git a/krbroot b/krbroot
index 5f475afc78aeb706d73e127b6ba110cf7c751e85..ee98c870eb6435a7b1e305e587f37f371c09d8f3 100755 (executable)
--- a/krbroot
+++ b/krbroot
@@ -14,6 +14,10 @@ case $1 in
         klist -s || krbroot init || exit 1;
         HOST="`hostname` (krbroot)" pagsh -c $SHELL
         ;;
+    screen)
+        klist -s || krbroot init || exit 1;
+        HOST="`hostname` (krbroot)" pagsh -c 'exec "$@"' exec "$@"
+        ;;
     ssh)
         klist -s || krbroot init || exit 1;
         shift