changelog shortlog tags branches changeset files revisions annotate raw help

Mercurial > hg > plan9front / rc/bin/srvtls

changeset 7243: 34f64dcbbc25
parent: e33933289bf9
author: cinap_lenrek@felloff.net
date: Fri, 17 May 2019 18:14:10 +0200
permissions: -rwxr-xr-x
description: 7l: don't hardcode 4k pagesize, use INITRND
1 #!/bin/rc
2 rfork e
3 
4 fn usage {
5  echo 'usage: srvtls [ -abcCnq ] [ -k keyspec ] [net!]system[!service] [ srvname [ mtpt ] ]' >[1=2]
6  exit usage
7 }
8 
9 mopt=()
10 mtpt=()
11 client=(/bin/tlsclient -a)
12 
13 while(~ $1 -*){
14  switch($1){
15  case -[abcCnq]*; mopt=($mopt $1)
16  case *
17  ~ $#* 1 && usage
18  switch($1){
19  case -k; client=($client $1 $2)
20  case *; usage
21  }
22  shift
23  }
24  shift
25 }
26 
27 switch($#*){
28 case 1; srv=/srv/$1
29 case 2; srv=/srv/$2
30 case 3; srv=/srv/$2; mtpt=$3
31 case *; usage
32 }
33 
34 switch($1){
35 case *!*!*; host=$1
36 case *!*; host=$1!t9fs
37 case *; host=net!$1!t9fs
38 }
39 
40 fn post {
41  echo 0 >$srv
42 }
43 if(test -f $srv || $client $host /bin/rc -c post){
44  ~ $#mtpt 0 || mount $mopt $srv $mtpt
45 }