This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
U/perl/i_wchar.U: Fix typo
[metaconfig.git] / dist / U / MailAuthor.U
1 ?RCS: $Id: MailAuthor.U 1 2006-08-24 12:32:52Z rmanfredi $
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
4 ?RCS:
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 4.0.
10 ?RCS:
11 ?RCS: Original Author: Graham Stoney <greyham@research.canon.oz.au>
12 ?RCS:
13 ?RCS: $Log: MailAuthor.U,v $
14 ?RCS: Revision 3.0.1.5  1997/02/28  15:04:41  ram
15 ?RCS: patch61: added support for src.U
16 ?RCS:
17 ?RCS: Revision 3.0.1.4  1994/08/29  16:05:09  ram
18 ?RCS: patch32: avoid message sending if they said no previously
19 ?RCS:
20 ?RCS: Revision 3.0.1.3  1993/10/16  13:47:30  ram
21 ?RCS: patch12: now makes sure user-specified address is in Internet format
22 ?RCS:
23 ?RCS: Revision 3.0.1.2  1993/09/13  15:48:49  ram
24 ?RCS: patch10: reverted to original intent by the Author himself
25 ?RCS:
26 ?RCS: Revision 3.0.1.1  1993/08/27  14:38:38  ram
27 ?RCS: patch7: now prompts user for its e-mail address
28 ?RCS: patch7: no longer silent when mail has been sent
29 ?RCS:
30 ?RCS: Revision 3.0  1993/08/18  12:05:06  ram
31 ?RCS: Baseline for dist 3.0 netwide release.
32 ?RCS:
33 ?RCS:
34 ?X:
35 ?X:     This unit asks the user to please send a message to the author.
36 ?X:     To force inclusion of this unit, you must add it's name to the
37 ?X:     dependancies on the MAKE line in your private copy of End.U.
38 ?X:     This allows a smart mailagent program to automatically let users know
39 ?X:     when their package is out of date, and to allow users to be notified of
40 ?X:     any future patches.
41 ?X:
42 ?MAKE:MailAuthor mailpatches notifypatches usermail: test cat mailer \
43         package Myread patchlevel baserev rm rsrc Oldconfig Configdir
44 ?MAKE:  -pick wipe $@ %<
45 ?S:mailpatches:
46 ?S:     Indicates whether the user would like future patches to be mailed
47 ?S:     directly to them.
48 ?S:.
49 ?S:notifypatches:
50 ?S:     Indicates whether the user would like notification of future patches
51 ?S:     mailed to them.
52 ?S:.
53 ?S:usermail:
54 ?S:     This variable is used internally by Configure to keep track of the
55 ?S:     user e-mail address, where notifications or patches should be sent.
56 ?S:     A '-' value means the return address will be extracted by parsing
57 ?S:     the mail headers.
58 ?S:.
59 ?T:opt mailpatches notifypatches atsh status
60 : notify author that his package is used
61 if $test -f ../.config/mailauthor &&
62         cmp $rsrc/patchlevel.h ../.config/mailauthor >/dev/null 2>&1
63 then
64         status="say that you're using $package";
65         case "$mailpatches" in
66         true) status='have patches mailed to you as they are issued';;
67         esac
68         case "$notifypatches" in
69         true) status='be notified when new patches are issued';;
70         esac
71         $cat <<EOM
72
73 You have already sent the author of $package (<MAINTLOC>) mail to
74 $status. If you wish, you may modify
75 your previous request by sending a new mail with different options.
76
77 EOM
78         rp='Should I send a status update to <MAINTLOC>?'
79         dflt=n
80 else
81         $cat <<EOM
82
83 If you are able to send mail to the Internet, the author of $package would
84 really appreciate you letting me send off a quick note, just to say that you've
85 tried it. The author is more likely to spend time maintaining $package if it's
86 known that many people are using it, and you can even ask to get sent new
87 patches automagically this way if you wish. To protect your privacy, all I'll
88 say in the mail is the version of $package that you're using.
89
90 EOM
91         rp='Should I send mail to <MAINTLOC>?'
92         dflt=y
93 ?X: Ensure default is 'n' if question has been asked already, in case they
94 ?X: run Configure -d next time and answered 'n' the first time. Therefore,
95 ?X: an empty nomail will be created later on even if no mail is sent.
96         $test -f ../.config/nomail && dflt=n
97 fi
98 . ./myread
99 case "$ans" in
100 [yY]*)
101         echo " "
102         echo "Great! Your cooperation is really appreciated."
103         $cat <<EOM
104
105 Some braindead sites do not set a proper return address in the From: header of
106 their outgoing mail, making it impossible to reply to mail they generate.
107 If your site is broken in this way, write to your system administrator and get
108 it fixed!!! In the mean time, you can manually specify the Internet e-mail
109 address by which the author can get back to you, should there be a need to do
110 so. If manually specified, it should be something like "user@domain.top".
111 If your mail system generates addresses correctly, specify "none".
112
113 EOM
114         case "$usermail" in
115         '-'|'') dflt=none;;
116         *) dflt="$usermail";;
117         esac
118         rp='Manually specify a return address to use:'
119         . ./myread
120         case "$ans" in
121         none|*@*.*)
122                 case "$ans" in
123                 none) usermail='-';;
124                 *) usermail="$ans";;
125                 esac
126                 ;;
127         *)
128                 echo "(Address does not look like an Internet one -- ignoring it.)"
129 ?X:
130 ?X: If we can't trust their mailer or their return address, it's highly
131 ?X: suggested that they only register and don't ask to get anything from
132 ?X: the author, since it's likely to bounce in null-land -- RAM.
133 ?X:
134                 usermail='-'
135                 mailpatches=false
136                 notifypatches=false
137                 ;;
138         esac
139         echo " "
140         opt=''
141         rp='Would you like to have new patches automatically mailed to you?'
142         case "$mailpatches" in
143         true) dflt=y;;
144         *) dflt=n;;
145         esac
146         . ./myread
147         case "$ans" in
148         [yY]*) opt=' mailpatches'; mailpatches=true;;
149         *)
150                 mailpatches=false
151                 echo " "
152                 rp='Ok, would you like to simply be notified of new patches?'
153                 case "$notifypatches" in
154                 false) dflt=n;;
155                 *) dflt=y;;
156                 esac
157                 . ./myread
158                 echo " "
159                 case "$ans" in
160                 [yY]*) opt=' notifypatches'; notifypatches=true;;
161                 *)
162                         echo "Fine, I'll simply say that you've tried it then."
163                         notifypatches=false
164                         ;;
165                 esac
166                 ;;
167         esac
168         echo "Sending mail to <MAINTLOC>..." >&4
169 ?X: Bizarre hack here. We can't just put @SH in the hereis lines below, because
170 ?X: metaconfig will interpret it as a command, and there's no quoting mechanism.
171 ?X: Do it via a variable instead.
172         atsh='@SH'
173         $mailer <MAINTLOC> <<EOM >/dev/null 2>&1
174 Subject: Command
175 Precedence: junk
176 To: <MAINTLOC>
177
178 $atsh package $usermail $package $baserev $patchlevel$opt
179 EOM
180         $rm -f ../.config/mailauthor ../.config/nomail
181         cp $rsrc/patchlevel.h ../.config/mailauthor
182         ;;
183 *)
184         case "$dflt" in
185         "y")
186                 echo "Oh well, maybe next time."
187                 cp /dev/null ../.config/nomail
188                 ;;
189         esac
190         ;;
191 esac
192