]> git.ozlabs.org Git - next-scripts/commitdiff
refactor mail composing
authorStephen Rothwell <sfr@canb.auug.org.au>
Thu, 15 May 2014 23:41:01 +0000 (09:41 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 15 May 2014 23:41:01 +0000 (09:41 +1000)
split out the actual mail sending command

build_msg
build_warn
merge_msg
message_helper
send_email [new file with mode: 0755]

index f684d150331b6194f1951f44fcd59c0c1b8ef0b6..00268c152ecfa51dda948c0568291e2d9762db0f 100755 (executable)
--- a/build_msg
+++ b/build_msg
@@ -1,9 +1,10 @@
 #!/bin/bash
 
 subject="build failure after merge of the BRANCH tree"
-body="After merging the BRANCH tree, today's linux-next build ()%0A\
-failed like this:"
 
-$(dirname $0)/message_helper "$@" "$subject" "$body"
+$(dirname $0)/message_helper "$@" "$subject" <<EOF
+After merging the BRANCH tree, today's linux-next build ()
+failed like this:
+EOF
 
 exit 0
index c4d5ed64d7570e5f0e850838aa64871c47ae6f22..17ab2aa45169590495ed60a36bddb044fa57aa8c 100755 (executable)
@@ -1,9 +1,10 @@
 #!/bin/bash
 
 subject="build warning after merge of the BRANCH tree"
-body="After merging the BRANCH tree, today's linux-next build ()%0A\
-produced this warning:"
 
-$(dirname $0)/message_helper "$@" "$subject" "$body"
+$(dirname $0)/message_helper "$@" "$subject" <<EOF
+After merging the BRANCH tree, today's linux-next build ()
+produced this warning:
+EOF
 
 exit 0
index 626cf943460a1bd7a8b36a28217f53596cdfeeab..5b63b64c1e5e4fa010d9bad45812d45fac1a8342 100755 (executable)
--- a/merge_msg
+++ b/merge_msg
@@ -19,11 +19,12 @@ conf="a conflict"
 }
 
 subject="manual merge of the BRANCH tree with the  tree"
-body="Today's linux-next merge of the BRANCH tree got $conf in $file between commit  (%22%22) from the  tree and commit  (%22%22) from the BRANCH tree.%0A\
-%0A\
-I fixed it up (see below) and can carry the fix as necessary (no action%0A\
-is required)."
 
-$(dirname $0)/message_helper $branch "$subject" "$body"
+$(dirname $0)/message_helper $branch "$subject" <<EOF
+Today's linux-next merge of the BRANCH tree got $conf in $file between commit  ("") from the  tree and commit  ("") from the BRANCH tree.
+
+I fixed it up (see below) and can carry the fix as necessary (no action
+is required).
+EOF
 
 exit 0
index a35a65ed5964e069287af710e4654680decc2f51..0b14b26a86a0531302dca8e34fda049fa30a7565 100755 (executable)
@@ -24,10 +24,11 @@ greeting=${greeting#\"}
 [ "${contact%,*}" = "${contact}" ] || greeting="all"
 
 subject="${1//BRANCH/$branch}"
-body="${2//BRANCH/$branch}"
 
-sylpheed --compose "mailto:$contact?Cc=linux-next@vger.kernel.org,%20linux-kernel@vger.kernel.org&Subject=linux-next: $subject&Body=Hi $greeting,%0A\
-%0A\
-$body"
+$(dirname $0)/send_email "$contact" "linux-next@vger.kernel.org, linux-kernel@vger.kernel.org" "linux-next: $subject" <<EOF
+Hi $greeting,
+
+$(sed "s/BRANCH/$branch/g")
+EOF
 
 exit 0
diff --git a/send_email b/send_email
new file mode 100755 (executable)
index 0000000..84f3365
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+to="$1"
+cc="$2"
+subject="$3"
+
+claws-mail --compose-from-file - <<EOF
+To: $to
+CC: $cc
+Subject: $subject
+
+$(cat)
+EOF
+
+exit 0