summaryrefslogtreecommitdiffstats
path: root/bin/email2irc.sh
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2012-11-22 00:28:46 +0100
committerHolger Levsen <holger@layer-acht.org>2012-11-22 00:28:46 +0100
commita2ad2f61c2ded037083cfa93f48951b90b1a2644 (patch)
tree2e55d6ec9883a11f69ace51498fe2daf53fecf33 /bin/email2irc.sh
parent5cfe126681d8f0e3e0e7dd29eb0b5b68297a5f28 (diff)
downloadjenkins.debian.net-a2ad2f61c2ded037083cfa93f48951b90b1a2644.tar.xz
some code cleanups
Diffstat (limited to 'bin/email2irc.sh')
-rwxr-xr-xbin/email2irc.sh29
1 files changed, 16 insertions, 13 deletions
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 <holger@layer-acht.org>
+# 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