chiark / gitweb /
dot/mykermrc, bin/guest-console: Kermit configuration.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 17 Feb 2012 01:23:43 +0000 (01:23 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 17 Feb 2012 01:23:43 +0000 (01:23 +0000)
This seems the best solution to the guest-serial-comms problem.

bin/guest-console [new file with mode: 0755]
dot/kermrc [new file with mode: 0644]
setup

diff --git a/bin/guest-console b/bin/guest-console
new file mode 100755 (executable)
index 0000000..0ff8848
--- /dev/null
@@ -0,0 +1,17 @@
+#! /usr/bin/kermit +
+
+take /etc/kermit/kermrc
+
+set exit on-disconnect on
+
+def GUESTDIR /mnt/guests
+if def \$(GUESTDIR) assign GUESTDIR \$(GUESTDIR)
+
+local guest
+if != \v(argc) 2 -
+       exit 1 Usage: GUEST [user/]guest
+assign guest \%1
+if not match {\m(guest)} */* -
+       assign guest \v(userid)/\m(guest)
+
+pipe nc -U \m(GUESTDIR)/\m(guest)/console
diff --git a/dot/kermrc b/dot/kermrc
new file mode 100644 (file)
index 0000000..9620593
--- /dev/null
@@ -0,0 +1,27 @@
+;;; ---kermit---
+;;;
+;;; Configuration and definitions for Kermit.
+
+set escape-character ^]
+set terminal trigger KERMIT READY TO SERVE...
+
+;; If my terminal is UTF8 then try to use that consistently.  This may not
+;; work, but in my world as it is it's quite likely to.
+local _lc_ctype
+if not def _lc_ctype if def \$(LC_ALL) assign _lc_ctype \$(LC_ALL)
+if not def _lc_ctype if def \$(LC_CTYPE) assign _lc_ctype \$(LC_CTYPE)
+if not def _lc_ctype if def \$(LANG) assign _lc_ctype \$(LANG)
+if match \m(_lc_ctype) *.utf8 {
+       set file character-set utf8
+       set terminal character-set utf8
+}
+
+;; Guest virtual consoles are frequently presented as Unix-domain sockets.
+def UNIX {
+       if < \v(argc) 1 -
+               end 1 Usage: UNIX socket
+       pipe nc -U \%1
+}
+
+;; Synchronize remote terminal size with local window.
+def syncwinsz output stty rows \v(rows) columns \v(cols)\13
diff --git a/setup b/setup
index c90e390f99d0642f8a09e27fc32ad58410913cf9..09e3005b031f58ed7d4306dc0e7ddf740017babf 100755 (executable)
--- a/setup
+++ b/setup
@@ -141,6 +141,7 @@ dotfiles="
   guile
   rcrc
   toprc
+  kermrc
   mc-ini:.mc/ini mc-panels.ini:.mc/panels.ini
   aspell.conf
   tclshrc:.tclshrc tclshrc:.wishrc
@@ -241,6 +242,7 @@ scripts="
   lesspipe.sh
   start-ssh-agent
   svnwrap
+  guest-console
   hyperspec"
 [ "$xstuff" ] && scripts="$scripts
   xinitcmd