From a2ad2f61c2ded037083cfa93f48951b90b1a2644 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Thu, 22 Nov 2012 00:28:46 +0100 Subject: some code cleanups --- bin/d-i_manual.sh | 4 +++- bin/email2irc.sh | 29 ++++++++++++++++------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/bin/d-i_manual.sh b/bin/d-i_manual.sh index b1e29e2b..1ed8c92f 100755 --- a/bin/d-i_manual.sh +++ b/bin/d-i_manual.sh @@ -82,7 +82,9 @@ init_workspace # if $1 is not given, build the whole manual, # else just the language $1 in format $2 # -# FIXME: use variable names +# $1 = LANG +# $2 = FORMAT +# $3 if set, manual is translated using po files (else xml files are the default) if [ "$1" = "" ] ; then pdebuild_package else diff --git a/bin/email2irc.sh b/bin/email2irc.sh index 3c02a71f..81017910 100755 --- a/bin/email2irc.sh +++ b/bin/email2irc.sh @@ -1,8 +1,12 @@ #!/bin/bash +# Copyright 2012 Holger Levsen +# released under the GPLv=2 + # -# FIXME: this needs cleanup soo much +# FIXME: email2irc still needs cleanup / documentation # +LOGFILE=/var/lib/jenkins/email_log HEADER=true VALID_MAIL=false @@ -19,9 +23,9 @@ while read line ; do SUBJECT=${line:9} fi if [[ $line =~ ^(To: .*) ]] ; then - echo $line >> /var/lib/jenkins/email_log + echo $line >> $LOGFILE CHANNEL=$(echo $line | cut -d "+" -f2| cut -d "@" -f1) - echo "CHANNEL = $CHANNEL" >> /var/lib/jenkins/email_log + echo "CHANNEL = $CHANNEL" >> $LOGFILE fi if [[ $line =~ ^(X-Jenkins-Job: .*) ]] ; then JENKINS_JOB=${line:15} @@ -37,20 +41,19 @@ if [ -z $JENKINS_JOB ] ; then fi if [ "$VALID_MAIL" == "true" ] ; then - echo -e "----------\nvalid email\n-----------" >> /var/lib/jenkins/email_log - echo $JENKINS_JOB | cut -d ":" -f1 >> /var/lib/jenkins/email_log + echo -e "----------\nvalid email\n-----------" >> $LOGFILE + echo $JENKINS_JOB | cut -d ":" -f1 >> $LOGFILE SUBJECT=$(echo $SUBJECT | cut -d ":" -f1) - echo $SUBJECT >> /var/lib/jenkins/email_log - echo $FIRST_LINE >> /var/lib/jenkins/email_log + echo $SUBJECT >> $LOGFILE + echo $FIRST_LINE >> $LOGFILE if [ ! -z $CHANNEL ] ; then - echo "#$CHANNEL: $SUBJECT. $FIRST_LINE" >> /var/lib/jenkins/email_log - kgb-client --conf /srv/jenkins/kgb/$CHANNEL.conf --relay-msg "$SUBJECT. $FIRST_LINE" && echo "kgb informed successfully." >> /var/lib/jenkins/email_log - echo >> /var/lib/jenkins/email_log + echo "#$CHANNEL: $SUBJECT. $FIRST_LINE" >> $LOGFILE + kgb-client --conf /srv/jenkins/kgb/$CHANNEL.conf --relay-msg "$SUBJECT. $FIRST_LINE" && echo "kgb informed successfully." >> $LOGFILE + echo >> $LOGFILE else - echo "But no irc channel detected." >> /var/lib/jenkins/email_log + echo "But no irc channel detected." >> $LOGFILE fi else - echo -e "----------\nbad luck\n-----------" >> /var/lib/jenkins/email_log + echo -e "----------\nbad luck\n-----------" >> $LOGFILE fi -# FIXME /var/lib/jenkins/email_log will grow and grow -- cgit v1.2.3-54-g00ecf