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