summaryrefslogtreecommitdiff
path: root/Build/source/utils/dialog/dialog-1.1-20080819/samples/copifuncs/common.funcs
blob: 04eca9a84000fbb00fbb89ffcf9a997d9a033565 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
#
#  ComeOn Point Functions! v0.9.2
#  - usate da vari altri moduli ComeOn Point...
#
#  AUTHOR: Beppe (beppe.dem@nsm.it)
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

save() {
  if [ -f $1 ]
  then
    mv $1 $1~
  fi
}

# Returns $PKG_TO_REMOVE
find_incompatible_packages() {
  dialog --backtitle "$TITLE" --infobox "Vediamo innanzitutto se c'e' qualche pacchetto di troppo ... ;-)" 0 0

  PKG_TO_REMOVE=""
  for i in sendmail smailcfg cnews
  do
    if [ -f /var/adm/packages/$i ]
    then
      PKG_TO_REMOVE="$PKG_TO_REMOVE $i"
    fi
  done
}

# Returns $PKG_TO_INSTALL
find_necessary_packages() {
  dialog --backtitle "$TITLE" --infobox "Controlliamo se manca qualche pacchetto..." 0 0

  PKG_TO_INSTALL=""
  for i in tcpip mailx inn
  do
    if [ ! -f /var/adm/packages/$i ]
    then
      PKG_TO_INSTALL="$PKG_TO_INSTALL $i"
    fi
  done
}

# Args: user, editor
configure_trn() {
  dialog --backtitle "$TITLE" --infobox "Configuro trn all'user $1..." 0 0

  SHELL_USED="`basename \`cut /etc/passwd -f1,7 -d: | grep $1: | cut -f2 -d:\``"
  USER_HOME="`cut /etc/passwd -f1,6 -d: | grep $1: | cut -f2 -d:`"
  TRNRC="$USER_HOME/.trnrc"

  case $SHELL_USED in
  bash)
    if [ -f $USER_HOME/.bash_profile ]
    then
      PROF=$USER_HOME/.bash_profile
    else
      PROF=$USER_HOME/.profile
    fi;;
  zsh)
    PROF=$USER_HOME/.zprofile;;
  *)
    PROF=$USER_HOME/.profile;;
  esac

  if [ ! -f $PROF ]
  then
    :>$PROF
    chown $1.mail $PROF
  elif [ ! "`grep -x \". ~/.trnrc\" $PROF`" ]
  then
    echo -e "\n. ~/.trnrc" >>$PROF
  fi

  save $TRNRC

  echo "EDITOR=\"$2\"" > $TRNRC
  cat copi.trnrc  >> $TRNRC
  chown $1.mail $TRNRC
}

# Args: user, editor
configure_elm() {
  USER=$1
  EDIT=$2

  dialog --backtitle "$TITLE" --infobox "Configuro elm all'user $USER..." 0 0

  USER_HOME="`cut /etc/passwd -f1,6 -d: | grep $USER: | cut -f2 -d:`"
  DIRRC="$USER_HOME/.elm"
  ELMRC="$DIRRC/elmrc"

  mkdir -p $DIRRC -m 700
  chown $USER.mail $USERHOME $DIRRC

  save $ELMRC

  cat <<EOF >$ELMRC
#
# .elm/elmrc - options file for the ELM mail system
#
# Generated by $PKTNAME for $USER
#

# For yes/no settings with ?, ON means yes, OFF means no

# how to sort the alias list, "Name" by default
### aliassortby = Name

# name of editor to use for replies that have text
alteditor = $EDIT

# alternative addresses that I could receive mail from (usually a
# forwarding mailbox) and don't want to have listed...
### alternatives =

# should the default be to delete messages we've marked for deletion?
alwaysdelete = ON

# should the default be to keep unread messages in the incoming mailbox?
alwayskeep = ON

# should the default be to store read messages to the "received" folder?
alwaysstore = OFF

# should we use the "->" rather than the inverse video bar?
arrow = OFF

# should the message disposition questions be displayed(ON) or
# auto-answered(OFF) with the default answers when we resync or
# change folders?
ask = OFF

# would you like to be asked for Carbon-Copies information each msg?
askcc = OFF

# attribution string for replies ('%s' is the author of original message)
attribution = %s wrote:

# automatically copy message being replied to into buffer?
autocopy = ON

# threshold for bouncing copies of remote uucp messages...
# zero = disable function.
### bounceback = 0

# This is used to determine if the builtin pager should be used on some
# messages even if you would usually use an external pager program.
# There are two ways of determining whether the builtin pager should be
# used. If you want any message that is shorter than "n" lines to use the
# internal pager, set the parameter to "n".  If you want the builtin
# pager to be used if the message is "m" lines shorter than the number of
# lines on your screen set the parameter to be "-m".  Setting the
# parameter to zero will result in the message always being sent through
# your external pager.
### builtinlines = -3

# where to save calendar entries
#calendar = /root/calendar

# list of options that can be configured at the "o)ptions" screen
configoptions = ^_cdefsopyv_am_un

# Should elm always ask the user to confirm before it appends
# messages to any existing file?
# This is used for both folders in the user's mail directory
# and ordinary files.
confirmappend = OFF

# Should elm always ask the user to confirm before it creates
# any new files?
# This is used for both folders in the user's mail directory
# and ordinary files.
confirmcreate = OFF

# Should elm ask for confirmation before it appends a message
# to an existing file that is not a folder in the user's Mail
# directory?
# This is used for ordinary files only and does not affect
# folders in the user's mail directory.
confirmfiles = OFF

# Should elm ask for confirmation before it creates a new folder
# in the user's Mail directory?
# This is used only for folders in the user's mail directory and
# does not affect ordinary files.
confirmfolders = OFF

# save a copy of all outbound messages?
copy = ON

# name of editor for ~e command (when editor="builtin")
easyeditor = $EDIT

# what editor to use ("none" means simulate Berkeley Mail)
editor = $EDIT

# the character to use in the builtin editor for entering commands
### escape = ~

# save outbound messages by login name of sender/recipient even if the
# associated folder doesn't already exist?
### forcename = OFF

# do we want to be able to mail out AT&T Mail Forms?
### forms = OFF

# The full user name for outbound mail
### fullname = $PKTNAME User

# should we keep folders from which all messages are deleted?
### keepempty = OFF

# are we running on an HP terminal and want HOME, PREV, NEXT, etc...?
### keypad = OFF

# local ".signature" file to append to appropriate messages...
localsignature = ~/.signature 

# where to save my mail to, default directory is "Mail"
maildir = ~/Mail

# should we display the three-line 'mini' menu?
menu = ON

# would you like a copy of a message you send to an alias you are on?
### metoo = OFF

# when using the page commands (+ - <NEXT> <PREV>) change the current
# message pointer...?
### movepage = OFF

# just show the names when expanding aliases?
names = OFF

# when messages are copied into the outbound buffer, don't include headers?
noheader = ON

# program to use for displaying messages ('builtin' is recommended)
### pager = builtin+

# start up by pointing to the first new message received, if possible?
### pointnew = ON

# list of delivery precedences allowed, or empty to allow anything
# precedence may be followed by optional ":priority" specification
### precedences = 

# prefix sequence for indenting included message text in outgoing messages...
prefix = _:>_

# how to print a message ('%s' is the filename)
### print = /bin/cat %s | /usr/bin/lpr

# prompt for a command after the external pager exits?
### promptafter = ON

# Value by which message count is incremented while reading a new mailbox.
# Setting this value to a number larger than one will speed up the time it
# takes to read a large mailbox when using a slow terminal.
### readmsginc = 1

# where to save received messages to, default file is "=received"
receivedmail = =received

# remote ".signature" file to append to appropriate messages...
remotesignature = ~/.signature

# emulate the mailx message increment mode (only increment after
# something has been 'done' to a message, either saved or deleted,
# as opposed to simply each time something is touched)?
### resolve = ON

# save messages, incoming and outbound, by login name of sender/recipient?
savename = ON

# where to save copies of outgoing mail to, default file is "=sent"
sentmail = =sent

# The shell to use for shell escapes
shell = /bin/sh

# do we want dashes above signatures? (News 2.11 compatibility and convention)
### sigdashes = ON

# time in seconds which Elm will wait after displaying a transient message
# and before erasing it.  Can be 0 or positive integer.
### sleepmsg = 2

# are we running on an HP terminal and want softkeys available too?
# (this implies "keypad=ON" too)
### softkeys = OFF

# how to sort folders, "Reverse Sent" by default
### sortby = Reverse-Sent

# Set the main prompt timeout for resynching...
### timeout = 600

# display message title when displaying pages of message?
titles = ON

# where to place temporary files, default directory is "/tmp"
### tmpdir = /tmp/

# are we good at it?  0=beginner, 1=intermediate, 2+ = expert!
userlevel = 0

# would you like to use termcap/terminfo ti/te entries?
usetite = ON

# name of editor for ~v command (when editor="builtin")
visualeditor = $EDIT

# enable the weedout list to be read?
### weed = ON

# what headers I DON'T want to see, ever.
weedout = "*end-of-user-headers*"

EOF

  chmod 600 $ELMRC
  chown $USER.mail $ELMRC
}