3 # program to submit a bug report
6 # encrypt the report. Use chacha20 and a public key
7 # for bug submissions. This key will need to be set up
8 # for zoranix. Should probably use the packager's public
11 # allow a bug report from stdin
15 [ -f /etc/rc.conf ] && . /etc/rc.conf
16 [ -f /etc/zoranix.conf ] && . /etc/zoranix.conf
20 from=${REPLYTO:-${name}@${host}}
23 if [ -r $HOME/.signature ]; then
24 signature=$(cat $HOME/.signature)
26 signature=$(printf '-- \n%s\n' $name)
29 # -n <note> -- make a bug report out of a note
30 file=$(mktemp ${TMPDIR:-/tmp}/bugreport-XXXXXX)
34 subject='zoranix bug report'
36 if [ "$1" = "-n" ]; then
43 package=$(zpm note category $1)
44 subject=$(zpm note show $1 | head -1)
45 if [ $subject = "" ]; then
46 subject='zoranix bug report'
53 X-SupportId: $SUPPORTID
55 To: ${BUGREPORTEMAIL:-bugreport@zoranix.net}
59 if [ -n "$note" ]; then
60 zpm note show $note > $file
61 elif [ -f /etc/zpm/bugtemplate ]; then
62 cat /etc/zpm/bugtemplate >> $file
65 Please write your bug report here. This note will be submitted via
66 ${BUGSUBMITVIA:-https}.
78 # TODO encrypt the file, possibly sign
79 # if encrypted, should uuencode the lot
81 # submit the file to the bug destination
83 case ${BUGSUBMITVIA:-https} in
85 mail -s 'zoranix bug report' ${BUGREPORTEMAIL:-bugreport@zoranix.net} < $file
89 sendmail ${BUGREPORTEMAIL:-bugreport@zoranix.net} < $file
93 curl -F bug=@$file ${BUGREPORTDEST:-https://zoranix.net/bugreport.cgi}
97 echo "zpm-bug: unknown submission method '${BUGSUBMITVIA:-smtp}'" 1>&2
98 echo "a copy of your report is in $file" 1>&2