diff options
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | Makefile | 20 | ||||
-rw-r--r-- | man.commons.in | 27 | ||||
-rw-r--r-- | sendmailadvanced.1.in | 53 | ||||
-rwxr-xr-x | sendmailadvanced.in | 31 |
5 files changed, 67 insertions, 68 deletions
@@ -1,2 +1,4 @@ sendmailadvanced -sendmailadvanced.1 +man.commons +*.common +*.1 @@ -26,10 +26,22 @@ MANDIR = /usr/share/man VERSION = 1.0.10 -all: sendmailadvanced sendmailadvanced.1 +all: man.commons sendmailadvanced sendmailadvanced.1 %: %.in - sed "s/#VERSION#/$(VERSION)/; s@#BINDIR#@$(BINDIR)@; s@#ETCDIR#@$(ETCDIR)@" $< > $@ + sed " \ + s/#VERSION#/$(VERSION)/; \ + s@#BINDIR#@$(BINDIR)@; \ + s@#ETCDIR#@$(ETCDIR)@; \ + s@#HELPTEXT#\(\s\+\)#@ --help \1display this help and exit\n --version\1display version and exit@; \ + " $< > $@ + [ "$@" = "sendmailadvanced" ] && chmod +x "$@" || true + +%.1: % man.commons + grep -v "^$<(" man.commons | sed '/^\[SEE ALSO]$$/{n;:a;N;/\[/b;s/\n/, /;ta;}' > "$<.common" && \ + help2man \ + -n 'Wrapper for sendmail which encrypts and generates stamps' \ + -o "$@" -N --include $<.common --no-discard-stderr "./$<" .PHONY: install dist clean @@ -39,7 +51,9 @@ install: all install -D -m0644 sendmailadvanced.conf $(DESTDIR)$(ETCDIR)/sendmailadvanced.conf clean: - rm -f sendmailadvanced sendmailadvanced.1 + ls -A | \ + grep "^\($(shell cat .gitignore | sed 's|\.|\\.|; s|\*|.*|; s|$$|\\|' | tr '\n' '\|' )\)\$$" | \ + xargs -r rm dist: clean git status --porcelain 2> /dev/null | grep -q "\S" && (git add .; git commit -m"neue Version: $(VERSION)") || true diff --git a/man.commons.in b/man.commons.in new file mode 100644 index 0000000..275ddb7 --- /dev/null +++ b/man.commons.in @@ -0,0 +1,27 @@ +[CONFIGURATION] +The configfile \fB#ETCDIR#/sendmailadvanced.conf\fP is a bash script, which defines the following variables and routines: +.TP +.B "gpg_recipient" +default recipient to encrypt to +.TP +.B "hashcash_bits" +stamp value +.TP +.B "body_header_hook" +routine printing things to put into head of (body of) email. +Parameter \fB$1\fP was given on the console via \fB--hook $1\fP. +.TP +.B "body_footer_hook" +routine printing things to put into foot of email. +Parameter \fB$1\fP was given on the console via \fB--hook $1\fP. +[FILES] +.TP +.B "#BINDIR#/sendmailadvanced" +program file +.TP +.B "#ETCDIR#/sendmailadvanced.conf" +contains configuration +[AUTHOR] +.nf +Erich Eckner <opensource at eckner dot net> +.fi diff --git a/sendmailadvanced.1.in b/sendmailadvanced.1.in deleted file mode 100644 index bdfb929..0000000 --- a/sendmailadvanced.1.in +++ /dev/null @@ -1,53 +0,0 @@ -.TH sendmailadvanced 1 "" "sendmailadvanced #VERSION#" "" -.SH NAME -sendmailadvanced \- wrapper for sendmail which encrypts and generates stamps -.SH SYNOPSIS -\fBsendmailadvanced [options]\fP -.SH DESCRIPTION -\fBsendmailadvanced\fP encrypts emails and generates stamps either in situ or in a pipe. For that it uses \fBhashcash\fP and \fBgnupg\fP. -.SH OPTIONS -.TP -.B "\-h, \-\-hook" -Activate specified hook. -.TP -.B "\-i, \-\-inline" -Enhance email file in situ. -\fB\-\-inline \-\fP has the same effect as option \fB\-t\fP. -Conflicts with \fB\-t, \-\-no\-inline\fP. -.TP -.B "\-t, \-\-no\-inline" -Enhance email from stdin to stdout. -Conflicts with \fB\-i, \-\-inline\fP. -.TP -.B "\-e, \-\-[no\-]encrypt" -Do (not) encrypt. -.TP -.B "\-s, \-\-[no\-]stamp" -Do (not) stamp. -.SH CONFIGURATION -The configfile \fB#ETCDIR#/sendmailadvanced.conf\fP is a bash script, which defines the following variables and routines: -.TP -.B "gpg_recipient" -default recipient to encrypt to -.TP -.B "hashcash_bits" -stamp value -.TP -.B "body_header_hook" -routine printing things to put into head of (body of) email. -Parameter \fB$1\fP was given on the console via \fB--hook $1\fP. -.TP -.B "body_footer_hook" -routine printing things to put into foot of email. -Parameter \fB$1\fP was given on the console via \fB--hook $1\fP. -.SH FILES -.TP -.B "#BINDIR#/sendmailadvanced" -program file -.TP -.B "#ETCDIR#/sendmailadvanced.conf" -contains configuration -.SH AUTHOR -.nf -Erich Eckner <opensource at eckner dot net> -.fi diff --git a/sendmailadvanced.in b/sendmailadvanced.in index 2bb69ce..c1aef2e 100755 --- a/sendmailadvanced.in +++ b/sendmailadvanced.in @@ -1,17 +1,19 @@ #!/bin/bash verwendung() { - >&2 echo 'This is sendmailadvanced version #VERSION#' + >&2 echo 'sendmailadvanced encrypts emails and generates stamps either in situ or in a pipe. For that it uses hashcash and gnupg.' >&2 echo '' - >&2 echo 'usage: sendmailadvanced [(-h|--hook) hook] [(-i|--inline) file | -t|--no-inline] [-e|--[no-]encrypt] [-s|--[no-]stamp]' - >&2 echo ' -h|--hook: activate hook' - >&2 echo ' -i|--inline: enhance email file in situ' - >&2 echo ' "--inline -" has the same effect as "-t"' - >&2 echo ' conflicts with -t|--no-inline' - >&2 echo ' -t|--no-inline: enhance email from stdin to stdout' - >&2 echo ' conflicts with -i|--inline' - >&2 echo ' -e|--[no-]encrypt: do (not) encrypt' - >&2 echo ' -s|--[no-]stamp: do (not) stamp' + >&2 echo 'Usage: sendmailadvanced [OPTIONS]' + >&2 echo ' -h,--hook=hook activate hook' + >&2 echo ' -i,--inline=file enhance email file in situ.' + >&2 echo ' "--inline -" has the same effect as "-t".' + >&2 echo ' Conflicts with -t|--no-inline.' + >&2 echo ' -t,--no-inline enhance email from stdin to stdout.' + >&2 echo ' Conflicts with -i|--inline.' + >&2 echo ' -e,--[no-]encrypt do (not) encrypt' + >&2 echo ' -s,--[no-]stamp do (not) stamp' + >&2 echo \ +'#HELPTEXT# #' exit 1 } @@ -62,7 +64,7 @@ fi gpg --list-keys "${gpg_recipient}" &> /dev/null || encrypt=false which hashcash &> /dev/null || stamp=false -eval set -- "$(getopt -o eh:i:st --long encrypt,no-encrypt,hook:,inline:,no-inline,stamp,no-stamp -n "$(basename "$0")" -- "$@" || echo verwendung)" +eval set -- "$(getopt -o eh:i:st --long encrypt,no-encrypt,hook:,help,inline:,no-inline,stamp,no-stamp,version -n "$(basename "$0")" -- "$@" || echo verwendung)" while true do @@ -71,6 +73,13 @@ do shift hooks[${#hooks[@]}]="$1" ;; + --help) + verwendung 0 + ;; + --version) + echo '#VERSION#' + exit 0 + ;; -i|--inline) ${dForced} && verwendung shift |