]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/C
git: fix non-interruptible temporary warning
[plan9front.git] / rc / bin / C
1 #!/bin/rc
2 # C system - connect to system's console
3 rfork en
4 oflag=()
5 opt=-r
6 while(~ $1 -*)
7         switch($1){
8         case -r
9                 shift
10                 opt=''
11         case -O -o
12                 oflag=-O
13                 shift
14         case *
15                 opt=-r
16                 shift
17         }
18
19 switch($1){
20 case ella
21         exec C office0
22         exit
23 case erika
24         exec C office1
25         exit
26 case *
27         # look for server in /lib/ndb
28         server=`{ndb/query sys $1 console}
29         switch($server){
30         case ''
31                 echo C: unknown console server for $1
32                 exit 1
33         }
34 }
35
36 # can't cpu to old servers any more
37 switch($server){
38 case dinar bones
39         ssh $server C $1
40         exit 0
41 }
42
43 if(! test -e /mnt/consoles/$1){
44         switch($sysname){
45         case $server
46                 mount /srv/consoles /mnt/consoles
47         case *
48                 import $oflag $server /mnt/consoles
49         }
50 }
51
52 if(! test -e /mnt/consoles/$1 && test -e /srv/consoles)
53         mount /srv/consoles /mnt/consoles
54
55 if(! test -e /mnt/consoles/$1){
56         echo console not found
57         exit 'console not found'
58 }
59
60 if (test -w /dev/label) {
61         olab=`{cat /dev/label}
62         label $1
63 }
64 con -l $opt /mnt/consoles/$1
65 if (test -w /dev/label)
66         label $olab