diff options
-rwxr-xr-x | firma | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -7,6 +7,7 @@ # where you put PARAMETER=value (whithout spaces) # # MAIL= path for mail program +# MAIL_ARGS= command-line arguments passed to the smtp wrapper # GPG= path for gnupg binary # LISTNAME= list email # LISTADMIN= list administrator email addresses (space separated) @@ -17,11 +18,9 @@ FIRMA_LIST_PATH="/usr/local/etc/lists" VERSION="0.3" -# todo: # errase all vars before quit the game # unset MESSAGE # unset GPG_MESSAGE -# umask .... function usage { echo "usage: $(basename $0) OPTION [LIST-NAME]" @@ -91,7 +90,7 @@ function get_subscribers_list { } function get_message { - LINES=0 + LINES=0 ; unset MESSAGE while read STDIN; do MESSAGE[$LINES]="$STDIN\n" ((++LINES)) @@ -99,7 +98,7 @@ function get_message { } function get_gpg_message { - signal=0 + signal=0; unset GPG_MESSAGE if [ ! -z "$LINES" ]; then x=0; n=$LINES for ((count=0;count<=n;count++)); do @@ -136,7 +135,7 @@ function message_list { # compose and send a message to the list # $1: subscriber email # sorry no identation :P -n=0 +n=0; unset LIST_MESSAGE unset LIST_MESSAGE echo "$PASSWD Message from: $FROM @@ -162,6 +161,7 @@ $(echo -e "${LIST_MESSAGE[@]}")" | $MAIL $MAIL_ARGS function message_list_error { # compose and send an error message # sorry no identation :P +n=0; unset LIST_MESSAGE echo "$PASSWD Message from: $FROM Subject: [BAD SIGNATURE] $SUBJECT @@ -242,7 +242,8 @@ function newlist { mkdir "$CONFIG_PATH" # || (echo "error creating $CONFIG_PATH: installation aborted"; exit 1) echo "creating list config file and will ask some questions." - read -p "path to nail command (eg, /usr/bin/nail): " MAIL + read -p "path to smtp command (eg, /usr/sbin/sendmail): " MAIL + read -p "command-line arguments passed to the smtp wrapper (eg, -oem -oi -t): " MAIL_ARGS read -p "path to gpg binary (eg, /usr/bin/gpg): " GPG # if [ ! -x $GPG ]; then @@ -263,7 +264,7 @@ function newlist { chmod 600 $CONFIG if [ -f $CONFIG ]; then gpg_args - echo -e "MAIL=$MAIL\nGPG=$GPG\nGPGDIR=$GPGDIR\nLISTNAME=$LISTNAME\nLISTADMIN=$LISTADMIN\nPASSWD=$PASSWD" > $CONFIG + echo -e "MAIL=$MAIL\n$MAIL_ARGS\nGPG=$GPG\nGPGDIR=$GPGDIR\nLISTNAME=$LISTNAME\nLISTADMIN=$LISTADMIN\nPASSWD=$PASSWD" > $CONFIG echo "now generating your keyring..." $GPGCOMMAND --gen-key <<EOF @@ -365,6 +366,9 @@ EOF } # main - + +umask 0777 + # command line checking if [ -z "$2" -a "$1" != "-c" -a "$1" != "-h" -a "$1" != "-v" ]; then usage @@ -428,4 +432,4 @@ else exit 1 fi - +unset MESSAGE; unset GPG_MESSAGE; unset LIST_MESSAGE |