sysinfo: add -e to include a reply-to e-mail address

This commit is contained in:
stanley lieber 2013-07-05 15:42:45 -04:00
parent 33e13fa09c
commit 252b0ff3c9
2 changed files with 34 additions and 10 deletions

View file

@ -1,12 +1,10 @@
#!/bin/rc #!/bin/rc
rfork e rfork e
fn logprog{ fn logprog{
echo % `{echo $"* | sed 's/#/''#''/g'} echo % `{echo $"* | sed 's/#/''#''/g'}
$* $*
echo echo
} }
fn print{ fn print{
echo '% cd ''#ec''; for(i in *){echo $i ''='' `{cat $i}}' echo '% cd ''#ec''; for(i in *){echo $i ''='' `{cat $i}}'
cd '#ec'; for(i in *){echo $i '=' `{cat $i}} cd '#ec'; for(i in *){echo $i '=' `{cat $i}}
@ -42,10 +40,11 @@ fn print{
logprog cat '#A/volume' logprog cat '#A/volume'
logprog cat /mnt/apm/ctl logprog cat /mnt/apm/ctl
} }
fn post{ fn post{
file=/tmp/sysinfo.$user.$pid file=/tmp/sysinfo.$user.$pid
print >$file >[2=1] if(! ~ $#e 0)
echo $e >$file
print >>$file >[2=1]
@{ @{
rfork n rfork n
webfs webfs
@ -55,11 +54,28 @@ fn post{
rm -f $file rm -f $file
} }
} }
argv0=$0
switch($1){ fn usage {
case -p echo usage: $argv0 '[ -e e-mail ] [ -p ]' >[1=2]
exit usage
}
e=()
p=()
while(~ $1 -*){
switch($1){
case -e
e=$2
shift
case -p
p=1
shift
case *
usage
}
shift
}
if(~ $p 1)
post post
case * if not
print print
}

View file

@ -4,6 +4,9 @@ sysinfo, sysupdate \- report information about, update the system
.SH SYNOPSIS .SH SYNOPSIS
.B sysinfo .B sysinfo
[ [
.B -e e-mail
]
[
.B -p .B -p
] ]
.br .br
@ -27,7 +30,12 @@ which in turn forwards the message to a
mailing list, mailing list,
.B 9front-sysinfo@9front.org. .B 9front-sysinfo@9front.org.
A URL pointing to the archived output is returned. A URL pointing to the archived output is returned.
This flag is useful for reporting new installs to the The
.B -e
flag causes a reply-to e-mail address to be included
in the message (the e-mail address is not divulged
to the mailing list).
These flags are useful for reporting new installs to the
development team. development team.
.PP .PP
.I Sysupdate .I Sysupdate