]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/dialog/samples/copifuncs/common.funcs
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / contrib / dialog / samples / copifuncs / common.funcs
1 #
2 #  ComeOn Point Functions! v0.9.2
3 #  - usate da vari altri moduli ComeOn Point...
4 #
5 #  AUTHOR: Beppe (beppe.dem@nsm.it)
6 #
7 #  This program is free software; you can redistribute it and/or
8 #  modify it under the terms of the GNU General Public License
9 #  as published by the Free Software Foundation; either version 2
10 #  of the License, or (at your option) any later version.
11 #
12 #  This program is distributed in the hope that it will be useful,
13 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 #  GNU General Public License for more details.
16 #
17 #  You should have received a copy of the GNU General Public License
18 #  along with this program; if not, write to the Free Software
19 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #
21
22 save() {
23   if [ -f $1 ]
24   then
25     mv $1 $1~
26   fi
27 }
28
29 # Returns $PKG_TO_REMOVE
30 find_incompatible_packages() {
31   dialog --backtitle "$TITLE" --infobox "Vediamo innanzitutto se c'e' qualche pacchetto di troppo ... ;-)" 0 0
32
33   PKG_TO_REMOVE=""
34   for i in sendmail smailcfg cnews
35   do
36     if [ -f /var/adm/packages/$i ]
37     then
38       PKG_TO_REMOVE="$PKG_TO_REMOVE $i"
39     fi
40   done
41 }
42
43 # Returns $PKG_TO_INSTALL
44 find_necessary_packages() {
45   dialog --backtitle "$TITLE" --infobox "Controlliamo se manca qualche pacchetto..." 0 0
46
47   PKG_TO_INSTALL=""
48   for i in tcpip mailx inn
49   do
50     if [ ! -f /var/adm/packages/$i ]
51     then
52       PKG_TO_INSTALL="$PKG_TO_INSTALL $i"
53     fi
54   done
55 }
56
57 # Args: user, editor
58 configure_trn() {
59   dialog --backtitle "$TITLE" --infobox "Configuro trn all'user $1..." 0 0
60
61   SHELL_USED="`basename \`cut /etc/passwd -f1,7 -d: | grep $1: | cut -f2 -d:\``"
62   USER_HOME="`cut /etc/passwd -f1,6 -d: | grep $1: | cut -f2 -d:`"
63   TRNRC="$USER_HOME/.trnrc"
64
65   case $SHELL_USED in
66   bash)
67     if [ -f $USER_HOME/.bash_profile ]
68     then
69       PROF=$USER_HOME/.bash_profile
70     else
71       PROF=$USER_HOME/.profile
72     fi;;
73   zsh)
74     PROF=$USER_HOME/.zprofile;;
75   *)
76     PROF=$USER_HOME/.profile;;
77   esac
78
79   if [ ! -f $PROF ]
80   then
81     :>$PROF
82     chown $1.mail $PROF
83   elif [ ! "`grep -x \". ~/.trnrc\" $PROF`" ]
84   then
85     echo -e "\n. ~/.trnrc" >>$PROF
86   fi
87
88   save $TRNRC
89
90   echo "EDITOR=\"$2\"" > $TRNRC
91   cat copi.trnrc  >> $TRNRC
92   chown $1.mail $TRNRC
93 }
94
95 # Args: user, editor
96 configure_elm() {
97   USER=$1
98   EDIT=$2
99
100   dialog --backtitle "$TITLE" --infobox "Configuro elm all'user $USER..." 0 0
101
102   USER_HOME="`cut /etc/passwd -f1,6 -d: | grep $USER: | cut -f2 -d:`"
103   DIRRC="$USER_HOME/.elm"
104   ELMRC="$DIRRC/elmrc"
105
106   mkdir -p $DIRRC -m 700
107   chown $USER.mail $USERHOME $DIRRC
108
109   save $ELMRC
110
111   cat <<EOF >$ELMRC
112 #
113 # .elm/elmrc - options file for the ELM mail system
114 #
115 # Generated by $PKTNAME for $USER
116 #
117
118 # For yes/no settings with ?, ON means yes, OFF means no
119
120 # how to sort the alias list, "Name" by default
121 ### aliassortby = Name
122
123 # name of editor to use for replies that have text
124 alteditor = $EDIT
125
126 # alternative addresses that I could receive mail from (usually a
127 # forwarding mailbox) and don't want to have listed...
128 ### alternatives =
129
130 # should the default be to delete messages we've marked for deletion?
131 alwaysdelete = ON
132
133 # should the default be to keep unread messages in the incoming mailbox?
134 alwayskeep = ON
135
136 # should the default be to store read messages to the "received" folder?
137 alwaysstore = OFF
138
139 # should we use the "->" rather than the inverse video bar?
140 arrow = OFF
141
142 # should the message disposition questions be displayed(ON) or
143 # auto-answered(OFF) with the default answers when we resync or
144 # change folders?
145 ask = OFF
146
147 # would you like to be asked for Carbon-Copies information each msg?
148 askcc = OFF
149
150 # attribution string for replies ('%s' is the author of original message)
151 attribution = %s wrote:
152
153 # automatically copy message being replied to into buffer?
154 autocopy = ON
155
156 # threshold for bouncing copies of remote uucp messages...
157 # zero = disable function.
158 ### bounceback = 0
159
160 # This is used to determine if the builtin pager should be used on some
161 # messages even if you would usually use an external pager program.
162 # There are two ways of determining whether the builtin pager should be
163 # used. If you want any message that is shorter than "n" lines to use the
164 # internal pager, set the parameter to "n".  If you want the builtin
165 # pager to be used if the message is "m" lines shorter than the number of
166 # lines on your screen set the parameter to be "-m".  Setting the
167 # parameter to zero will result in the message always being sent through
168 # your external pager.
169 ### builtinlines = -3
170
171 # where to save calendar entries
172 #calendar = /root/calendar
173
174 # list of options that can be configured at the "o)ptions" screen
175 configoptions = ^_cdefsopyv_am_un
176
177 # Should elm always ask the user to confirm before it appends
178 # messages to any existing file?
179 # This is used for both folders in the user's mail directory
180 # and ordinary files.
181 confirmappend = OFF
182
183 # Should elm always ask the user to confirm before it creates
184 # any new files?
185 # This is used for both folders in the user's mail directory
186 # and ordinary files.
187 confirmcreate = OFF
188
189 # Should elm ask for confirmation before it appends a message
190 # to an existing file that is not a folder in the user's Mail
191 # directory?
192 # This is used for ordinary files only and does not affect
193 # folders in the user's mail directory.
194 confirmfiles = OFF
195
196 # Should elm ask for confirmation before it creates a new folder
197 # in the user's Mail directory?
198 # This is used only for folders in the user's mail directory and
199 # does not affect ordinary files.
200 confirmfolders = OFF
201
202 # save a copy of all outbound messages?
203 copy = ON
204
205 # name of editor for ~e command (when editor="builtin")
206 easyeditor = $EDIT
207
208 # what editor to use ("none" means simulate Berkeley Mail)
209 editor = $EDIT
210
211 # the character to use in the builtin editor for entering commands
212 ### escape = ~
213
214 # save outbound messages by login name of sender/recipient even if the
215 # associated folder doesn't already exist?
216 ### forcename = OFF
217
218 # do we want to be able to mail out AT&T Mail Forms?
219 ### forms = OFF
220
221 # The full user name for outbound mail
222 ### fullname = $PKTNAME User
223
224 # should we keep folders from which all messages are deleted?
225 ### keepempty = OFF
226
227 # are we running on an HP terminal and want HOME, PREV, NEXT, etc...?
228 ### keypad = OFF
229
230 # local ".signature" file to append to appropriate messages...
231 localsignature = ~/.signature 
232
233 # where to save my mail to, default directory is "Mail"
234 maildir = ~/Mail
235
236 # should we display the three-line 'mini' menu?
237 menu = ON
238
239 # would you like a copy of a message you send to an alias you are on?
240 ### metoo = OFF
241
242 # when using the page commands (+ - <NEXT> <PREV>) change the current
243 # message pointer...?
244 ### movepage = OFF
245
246 # just show the names when expanding aliases?
247 names = OFF
248
249 # when messages are copied into the outbound buffer, don't include headers?
250 noheader = ON
251
252 # program to use for displaying messages ('builtin' is recommended)
253 ### pager = builtin+
254
255 # start up by pointing to the first new message received, if possible?
256 ### pointnew = ON
257
258 # list of delivery precedences allowed, or empty to allow anything
259 # precedence may be followed by optional ":priority" specification
260 ### precedences = 
261
262 # prefix sequence for indenting included message text in outgoing messages...
263 prefix = _:>_
264
265 # how to print a message ('%s' is the filename)
266 ### print = /bin/cat %s | /usr/bin/lpr
267
268 # prompt for a command after the external pager exits?
269 ### promptafter = ON
270
271 # Value by which message count is incremented while reading a new mailbox.
272 # Setting this value to a number larger than one will speed up the time it
273 # takes to read a large mailbox when using a slow terminal.
274 ### readmsginc = 1
275
276 # where to save received messages to, default file is "=received"
277 receivedmail = =received
278
279 # remote ".signature" file to append to appropriate messages...
280 remotesignature = ~/.signature
281
282 # emulate the mailx message increment mode (only increment after
283 # something has been 'done' to a message, either saved or deleted,
284 # as opposed to simply each time something is touched)?
285 ### resolve = ON
286
287 # save messages, incoming and outbound, by login name of sender/recipient?
288 savename = ON
289
290 # where to save copies of outgoing mail to, default file is "=sent"
291 sentmail = =sent
292
293 # The shell to use for shell escapes
294 shell = /bin/sh
295
296 # do we want dashes above signatures? (News 2.11 compatibility and convention)
297 ### sigdashes = ON
298
299 # time in seconds which Elm will wait after displaying a transient message
300 # and before erasing it.  Can be 0 or positive integer.
301 ### sleepmsg = 2
302
303 # are we running on an HP terminal and want softkeys available too?
304 # (this implies "keypad=ON" too)
305 ### softkeys = OFF
306
307 # how to sort folders, "Reverse Sent" by default
308 ### sortby = Reverse-Sent
309
310 # Set the main prompt timeout for resynching...
311 ### timeout = 600
312
313 # display message title when displaying pages of message?
314 titles = ON
315
316 # where to place temporary files, default directory is "/tmp"
317 ### tmpdir = /tmp/
318
319 # are we good at it?  0=beginner, 1=intermediate, 2+ = expert!
320 userlevel = 0
321
322 # would you like to use termcap/terminfo ti/te entries?
323 usetite = ON
324
325 # name of editor for ~v command (when editor="builtin")
326 visualeditor = $EDIT
327
328 # enable the weedout list to be read?
329 ### weed = ON
330
331 # what headers I DON'T want to see, ever.
332 weedout = "*end-of-user-headers*"
333
334 EOF
335
336   chmod 600 $ELMRC
337   chown $USER.mail $ELMRC
338 }