Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 190 lines (169 sloc) 4.514 kb
6fdf249 @gregkh initial import from old git tree
authored
1 #!/bin/bash
2
629bce1 @gregkh prettied up added-to-stable
authored
3 KERNEL_MINOR_VERSION='34'
6fdf249 @gregkh initial import from old git tree
authored
4 KERNEL="2.6.$KERNEL_MINOR_VERSION"
5
4c16799 @gregkh change my email address to be linuxfoundation.org instead of suse.de
authored
6 EMAIL_ADDRESS='<gregkh@linuxfoundation.org>'
6fdf249 @gregkh initial import from old git tree
authored
7
c598ba1 @gregkh fix up stable@ email addresses now that it has moved to vger.
authored
8 STABLE='<stable@vger.kernel.org>'
6fdf249 @gregkh initial import from old git tree
authored
9 STABLE_COMMITS='<stable-commits@vger.kernel.org>'
10
11 extract_addr()
12 {
13 read l
14 read l
15 read l
16 read l
17 a=$(echo "$l" | sed -n -e 's/.*<\(.*@[^>]*\).*/\1/p')
18 echo $a
19 }
20
21 if [ x"$SMTP_SERVER" = x ]
22 then
23 SMTP_SERVER=localhost:25
24 fi
25
26 if [ x"$EMAIL_ADDRESS" = x ]
27 then
28 echo "You must set the EMAIL_ADDRESS environment variable to your email address"
29 exit 1
30 fi
31 FROM=$EMAIL_ADDRESS
32
33 TO=""
34 CC=""
35
36 author()
37 {
38 first_author=""
39 TXT=$2
40 if [ ! -f $TXT ]
41 then
42 echo "$TXT is missing"
43 exit 1
44 fi
45 author=""
46 while read l
47 do
48 # skip the Message-ID: line so we don't send email to the wrong place
49 echo "$l"
e3c4d50 @gregkh ascii grep for stable scripts
authored
50 reply=$(echo "$l" | grep -a -i Message-ID:)
6fdf249 @gregkh initial import from old git tree
authored
51 if [ x"$reply" != x ]
52 then
53 continue
54 fi
55
56 # if this is the start of the diff, then it's time to stop looking
57 diff=$(echo "$l" | grep "^---")
58 if [ x"$diff" != x ]
59 then
60 echo "diffstart!!!!!"
61 break
62 fi
63
64 for x in $l
65 do
66 a=$(echo "$x" | sed -n -e 's/.*<\(.*@[^>]*\).*/\1/p')
67 if [ x"$a" != x ]
68 then
69 if [ x"$author" == x ]
70 then
71 author=$a
72 first_author=$a
73 else
74 author="$author $a"
75 fi
76 fi
77 done
78 done < $TXT
79 author=$(echo "$author" | tr ' ' '\n' | grep -v "$first_author" |
80 sort | uniq)
81 author="$first_author $author"
82 eval $1=$(echo $author | sed -e 's/ /,/g')
83 if [ x"$3" != x ]
84 then
85 eval $3=$first_author
86 fi
87 }
88
89
90
91 reply()
92 {
93 PATCH=$1
94 # patch_name=$(stripit $1)
95 # PATCH=$P/patches/$patch_name.patch
96 # TXT=$P/txt/$patch_name.txt
97 # if [ ! -f $TXT ]
98 # then
99 # echo $TXT is missing
100 # exit 1
101 # fi
102 echo "PATCH=$PATCH"
e3c4d50 @gregkh ascii grep for stable scripts
authored
103 # SUBJECT=`grep -a "Subject:" $PATCH`
104 SUBJECT=`grep -a "Subject:" $PATCH | sed s/Subject\:\ //`
629bce1 @gregkh prettied up added-to-stable
authored
105 # SUBJECT=$(head -n 2 $PATCH | tail -n 1)
e3c4d50 @gregkh ascii grep for stable scripts
authored
106 MESSAGE_ID=`grep -a -i "^Message-ID:" $PATCH | cut -f 2 -d ' ' | cut -f 2 -d '<' | cut -f 1 -d '>'`
6fdf249 @gregkh initial import from old git tree
authored
107 author AUTHOR $1 FIRST_AUTHOR
108 echo "author said $AUTHOR"
109 echo "first_author said $FIRST_AUTHOR"
110 if [ x"$AUTHOR" == "x" ]
111 then
112 echo "nobody to notify"
113 exit 0
114 fi
115 to=""
116 for i in $(echo "$AUTHOR" | sed -e 's/,/ /g')
117 do
118 if ! echo "$TO" | grep "$i"
119 then
120 to=$to" -to $i"
121 fi
122 done
123 if [ x"$cc" != x ]
124 then
125 cc="-cc $cc"
126 fi
127
629bce1 @gregkh prettied up added-to-stable
authored
128 # SUBJECT="patch $PATCH added to $KERNEL-stable tree"
6fdf249 @gregkh initial import from old git tree
authored
129
130 CHARSET=$(guess-charset "$PATCH")
131 if test "x$CHARSET" = "ANSI_X3.4-1968"; then
132 CHARSET=
133 else
134 CHARCMD="-charset=$CHARSET"
135 fi
136
137 ID=`make_message_id`
138
139 echo "makemail -to $AUTHOR -from=$FROM -subject=\"$SUBJECT\" -date=\"$(date -R)\" -reply_to=$MESSAGE_ID --message=$ID $CHARCMD"
140 # echo "smtpsend -server=$SMTP_SERVER $to -from=$FROM"
141
142
143 (
144 echo
629bce1 @gregkh prettied up added-to-stable
authored
145 echo "This is a note to let you know that I've just added the patch titled"
6fdf249 @gregkh initial import from old git tree
authored
146 echo
629bce1 @gregkh prettied up added-to-stable
authored
147 echo " $SUBJECT"
6fdf249 @gregkh initial import from old git tree
authored
148 echo
629bce1 @gregkh prettied up added-to-stable
authored
149 echo "to the $KERNEL-stable tree which can be found at:"
150 echo " http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary"
6fdf249 @gregkh initial import from old git tree
authored
151 echo
629bce1 @gregkh prettied up added-to-stable
authored
152 echo "The filename of the patch is:"
be27dce @gregkh make added-to-stable handle the name of the patch correctly
authored
153 echo " " `basename "$PATCH"`
629bce1 @gregkh prettied up added-to-stable
authored
154 echo "and it can be found in the queue-$KERNEL subdirectory."
6fdf249 @gregkh initial import from old git tree
authored
155 echo
629bce1 @gregkh prettied up added-to-stable
authored
156 echo "If you, or anyone else, feels it should not be added to the stable tree,"
c598ba1 @gregkh fix up stable@ email addresses now that it has moved to vger.
authored
157 echo "please let <stable@vger.kernel.org> know about it."
6fdf249 @gregkh initial import from old git tree
authored
158 echo
159 echo
160 cat $PATCH
161 echo
162 echo
163 echo -n "Patches currently in stable-queue which might be from "
164 echo "$FIRST_AUTHOR are"
165 echo
166 grep -lR $FIRST_AUTHOR /home/gregkh/linux/stable/stable-queue/queue-$KERNEL/ 2> /dev/null |
167 sed -e 's/\/home\/gregkh\/linux\/stable\/stable-queue\///'
168 ) |
169 makemail -to "$AUTHOR" \
170 -from="$FROM" \
171 -cc="$STABLE, $STABLE_COMMITS" \
629bce1 @gregkh prettied up added-to-stable
authored
172 -subject="Patch \"$SUBJECT\" has been added to the $KERNEL-stable tree" \
6fdf249 @gregkh initial import from old git tree
authored
173 -date="$(date -R)" \
174 -reply_to="$MESSAGE_ID" \
175 -message_id="$ID" \
176 "$CHARCMD" \
177 | \
b1e5493 @gregkh stable fixes for default email server
authored
178 ~/bin/msmtp-enqueue.sh "$to"
179 # ~/bin/msmtp-enqueue.sh -a coco "$to"
6fdf249 @gregkh initial import from old git tree
authored
180 #msmtp $to
181 }
182
183 for patch_file in $*
184 do
185 reply $patch_file
186 echo "acknowledged $patch_file"
187 echo "-----------------------------------------------"
188 echo
189 done
Something went wrong with that request. Please try again.