1217309Snwhitehorn#
2217309Snwhitehorn#  ComeOn Point Functions! v0.9.2
3217309Snwhitehorn#  - usate da vari altri moduli ComeOn Point...
4217309Snwhitehorn#
5217309Snwhitehorn#  AUTHOR: Beppe (beppe.dem@nsm.it)
6217309Snwhitehorn#
7217309Snwhitehorn#  This program is free software; you can redistribute it and/or
8217309Snwhitehorn#  modify it under the terms of the GNU General Public License
9217309Snwhitehorn#  as published by the Free Software Foundation; either version 2
10217309Snwhitehorn#  of the License, or (at your option) any later version.
11217309Snwhitehorn#
12217309Snwhitehorn#  This program is distributed in the hope that it will be useful,
13217309Snwhitehorn#  but WITHOUT ANY WARRANTY; without even the implied warranty of
14217309Snwhitehorn#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15217309Snwhitehorn#  GNU General Public License for more details.
16217309Snwhitehorn#
17217309Snwhitehorn#  You should have received a copy of the GNU General Public License
18217309Snwhitehorn#  along with this program; if not, write to the Free Software
19217309Snwhitehorn#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20217309Snwhitehorn#
21217309Snwhitehorn
22217309Snwhitehornsave() {
23217309Snwhitehorn  if [ -f $1 ]
24217309Snwhitehorn  then
25217309Snwhitehorn    mv $1 $1~
26217309Snwhitehorn  fi
27217309Snwhitehorn}
28217309Snwhitehorn
29217309Snwhitehorn# Returns $PKG_TO_REMOVE
30217309Snwhitehornfind_incompatible_packages() {
31217309Snwhitehorn  dialog --backtitle "$TITLE" --infobox "Vediamo innanzitutto se c'e' qualche pacchetto di troppo ... ;-)" 0 0
32217309Snwhitehorn
33217309Snwhitehorn  PKG_TO_REMOVE=""
34217309Snwhitehorn  for i in sendmail smailcfg cnews
35217309Snwhitehorn  do
36217309Snwhitehorn    if [ -f /var/adm/packages/$i ]
37217309Snwhitehorn    then
38217309Snwhitehorn      PKG_TO_REMOVE="$PKG_TO_REMOVE $i"
39217309Snwhitehorn    fi
40217309Snwhitehorn  done
41217309Snwhitehorn}
42217309Snwhitehorn
43217309Snwhitehorn# Returns $PKG_TO_INSTALL
44217309Snwhitehornfind_necessary_packages() {
45217309Snwhitehorn  dialog --backtitle "$TITLE" --infobox "Controlliamo se manca qualche pacchetto..." 0 0
46217309Snwhitehorn
47217309Snwhitehorn  PKG_TO_INSTALL=""
48217309Snwhitehorn  for i in tcpip mailx inn
49217309Snwhitehorn  do
50217309Snwhitehorn    if [ ! -f /var/adm/packages/$i ]
51217309Snwhitehorn    then
52217309Snwhitehorn      PKG_TO_INSTALL="$PKG_TO_INSTALL $i"
53217309Snwhitehorn    fi
54217309Snwhitehorn  done
55217309Snwhitehorn}
56217309Snwhitehorn
57217309Snwhitehorn# Args: user, editor
58217309Snwhitehornconfigure_trn() {
59217309Snwhitehorn  dialog --backtitle "$TITLE" --infobox "Configuro trn all'user $1..." 0 0
60217309Snwhitehorn
61217309Snwhitehorn  SHELL_USED="`basename \`cut /etc/passwd -f1,7 -d: | grep $1: | cut -f2 -d:\``"
62217309Snwhitehorn  USER_HOME="`cut /etc/passwd -f1,6 -d: | grep $1: | cut -f2 -d:`"
63217309Snwhitehorn  TRNRC="$USER_HOME/.trnrc"
64217309Snwhitehorn
65217309Snwhitehorn  case $SHELL_USED in
66217309Snwhitehorn  bash)
67217309Snwhitehorn    if [ -f $USER_HOME/.bash_profile ]
68217309Snwhitehorn    then
69217309Snwhitehorn      PROF=$USER_HOME/.bash_profile
70217309Snwhitehorn    else
71217309Snwhitehorn      PROF=$USER_HOME/.profile
72217309Snwhitehorn    fi;;
73217309Snwhitehorn  zsh)
74217309Snwhitehorn    PROF=$USER_HOME/.zprofile;;
75217309Snwhitehorn  *)
76217309Snwhitehorn    PROF=$USER_HOME/.profile;;
77217309Snwhitehorn  esac
78217309Snwhitehorn
79217309Snwhitehorn  if [ ! -f $PROF ]
80217309Snwhitehorn  then
81217309Snwhitehorn    :>$PROF
82217309Snwhitehorn    chown $1.mail $PROF
83217309Snwhitehorn  elif [ ! "`grep -x \". ~/.trnrc\" $PROF`" ]
84217309Snwhitehorn  then
85217309Snwhitehorn    echo -e "\n. ~/.trnrc" >>$PROF
86217309Snwhitehorn  fi
87217309Snwhitehorn
88217309Snwhitehorn  save $TRNRC
89217309Snwhitehorn
90217309Snwhitehorn  echo "EDITOR=\"$2\"" > $TRNRC
91217309Snwhitehorn  cat copi.trnrc  >> $TRNRC
92217309Snwhitehorn  chown $1.mail $TRNRC
93217309Snwhitehorn}
94217309Snwhitehorn
95217309Snwhitehorn# Args: user, editor
96217309Snwhitehornconfigure_elm() {
97217309Snwhitehorn  USER=$1
98217309Snwhitehorn  EDIT=$2
99217309Snwhitehorn
100217309Snwhitehorn  dialog --backtitle "$TITLE" --infobox "Configuro elm all'user $USER..." 0 0
101217309Snwhitehorn
102217309Snwhitehorn  USER_HOME="`cut /etc/passwd -f1,6 -d: | grep $USER: | cut -f2 -d:`"
103217309Snwhitehorn  DIRRC="$USER_HOME/.elm"
104217309Snwhitehorn  ELMRC="$DIRRC/elmrc"
105217309Snwhitehorn
106217309Snwhitehorn  mkdir -p $DIRRC -m 700
107217309Snwhitehorn  chown $USER.mail $USERHOME $DIRRC
108217309Snwhitehorn
109217309Snwhitehorn  save $ELMRC
110217309Snwhitehorn
111217309Snwhitehorn  cat <<EOF >$ELMRC
112217309Snwhitehorn#
113217309Snwhitehorn# .elm/elmrc - options file for the ELM mail system
114217309Snwhitehorn#
115217309Snwhitehorn# Generated by $PKTNAME for $USER
116217309Snwhitehorn#
117217309Snwhitehorn
118217309Snwhitehorn# For yes/no settings with ?, ON means yes, OFF means no
119217309Snwhitehorn
120217309Snwhitehorn# how to sort the alias list, "Name" by default
121217309Snwhitehorn### aliassortby = Name
122217309Snwhitehorn
123217309Snwhitehorn# name of editor to use for replies that have text
124217309Snwhitehornalteditor = $EDIT
125217309Snwhitehorn
126217309Snwhitehorn# alternative addresses that I could receive mail from (usually a
127217309Snwhitehorn# forwarding mailbox) and don't want to have listed...
128217309Snwhitehorn### alternatives =
129217309Snwhitehorn
130217309Snwhitehorn# should the default be to delete messages we've marked for deletion?
131217309Snwhitehornalwaysdelete = ON
132217309Snwhitehorn
133217309Snwhitehorn# should the default be to keep unread messages in the incoming mailbox?
134217309Snwhitehornalwayskeep = ON
135217309Snwhitehorn
136217309Snwhitehorn# should the default be to store read messages to the "received" folder?
137217309Snwhitehornalwaysstore = OFF
138217309Snwhitehorn
139217309Snwhitehorn# should we use the "->" rather than the inverse video bar?
140217309Snwhitehornarrow = OFF
141217309Snwhitehorn
142217309Snwhitehorn# should the message disposition questions be displayed(ON) or
143217309Snwhitehorn# auto-answered(OFF) with the default answers when we resync or
144217309Snwhitehorn# change folders?
145217309Snwhitehornask = OFF
146217309Snwhitehorn
147217309Snwhitehorn# would you like to be asked for Carbon-Copies information each msg?
148217309Snwhitehornaskcc = OFF
149217309Snwhitehorn
150217309Snwhitehorn# attribution string for replies ('%s' is the author of original message)
151217309Snwhitehornattribution = %s wrote:
152217309Snwhitehorn
153217309Snwhitehorn# automatically copy message being replied to into buffer?
154217309Snwhitehornautocopy = ON
155217309Snwhitehorn
156217309Snwhitehorn# threshold for bouncing copies of remote uucp messages...
157217309Snwhitehorn# zero = disable function.
158217309Snwhitehorn### bounceback = 0
159217309Snwhitehorn
160217309Snwhitehorn# This is used to determine if the builtin pager should be used on some
161217309Snwhitehorn# messages even if you would usually use an external pager program.
162217309Snwhitehorn# There are two ways of determining whether the builtin pager should be
163217309Snwhitehorn# used. If you want any message that is shorter than "n" lines to use the
164217309Snwhitehorn# internal pager, set the parameter to "n".  If you want the builtin
165217309Snwhitehorn# pager to be used if the message is "m" lines shorter than the number of
166217309Snwhitehorn# lines on your screen set the parameter to be "-m".  Setting the
167217309Snwhitehorn# parameter to zero will result in the message always being sent through
168217309Snwhitehorn# your external pager.
169217309Snwhitehorn### builtinlines = -3
170217309Snwhitehorn
171217309Snwhitehorn# where to save calendar entries
172217309Snwhitehorn#calendar = /root/calendar
173217309Snwhitehorn
174217309Snwhitehorn# list of options that can be configured at the "o)ptions" screen
175217309Snwhitehornconfigoptions = ^_cdefsopyv_am_un
176217309Snwhitehorn
177217309Snwhitehorn# Should elm always ask the user to confirm before it appends
178217309Snwhitehorn# messages to any existing file?
179217309Snwhitehorn# This is used for both folders in the user's mail directory
180217309Snwhitehorn# and ordinary files.
181217309Snwhitehornconfirmappend = OFF
182217309Snwhitehorn
183217309Snwhitehorn# Should elm always ask the user to confirm before it creates
184217309Snwhitehorn# any new files?
185217309Snwhitehorn# This is used for both folders in the user's mail directory
186217309Snwhitehorn# and ordinary files.
187217309Snwhitehornconfirmcreate = OFF
188217309Snwhitehorn
189217309Snwhitehorn# Should elm ask for confirmation before it appends a message
190217309Snwhitehorn# to an existing file that is not a folder in the user's Mail
191217309Snwhitehorn# directory?
192217309Snwhitehorn# This is used for ordinary files only and does not affect
193217309Snwhitehorn# folders in the user's mail directory.
194217309Snwhitehornconfirmfiles = OFF
195217309Snwhitehorn
196217309Snwhitehorn# Should elm ask for confirmation before it creates a new folder
197217309Snwhitehorn# in the user's Mail directory?
198217309Snwhitehorn# This is used only for folders in the user's mail directory and
199217309Snwhitehorn# does not affect ordinary files.
200217309Snwhitehornconfirmfolders = OFF
201217309Snwhitehorn
202217309Snwhitehorn# save a copy of all outbound messages?
203217309Snwhitehorncopy = ON
204217309Snwhitehorn
205217309Snwhitehorn# name of editor for ~e command (when editor="builtin")
206217309Snwhitehorneasyeditor = $EDIT
207217309Snwhitehorn
208217309Snwhitehorn# what editor to use ("none" means simulate Berkeley Mail)
209217309Snwhitehorneditor = $EDIT
210217309Snwhitehorn
211217309Snwhitehorn# the character to use in the builtin editor for entering commands
212217309Snwhitehorn### escape = ~
213217309Snwhitehorn
214217309Snwhitehorn# save outbound messages by login name of sender/recipient even if the
215217309Snwhitehorn# associated folder doesn't already exist?
216217309Snwhitehorn### forcename = OFF
217217309Snwhitehorn
218217309Snwhitehorn# do we want to be able to mail out AT&T Mail Forms?
219217309Snwhitehorn### forms = OFF
220217309Snwhitehorn
221217309Snwhitehorn# The full user name for outbound mail
222217309Snwhitehorn### fullname = $PKTNAME User
223217309Snwhitehorn
224217309Snwhitehorn# should we keep folders from which all messages are deleted?
225217309Snwhitehorn### keepempty = OFF
226217309Snwhitehorn
227217309Snwhitehorn# are we running on an HP terminal and want HOME, PREV, NEXT, etc...?
228217309Snwhitehorn### keypad = OFF
229217309Snwhitehorn
230217309Snwhitehorn# local ".signature" file to append to appropriate messages...
231217309Snwhitehornlocalsignature = ~/.signature 
232217309Snwhitehorn
233217309Snwhitehorn# where to save my mail to, default directory is "Mail"
234217309Snwhitehornmaildir = ~/Mail
235217309Snwhitehorn
236217309Snwhitehorn# should we display the three-line 'mini' menu?
237217309Snwhitehornmenu = ON
238217309Snwhitehorn
239217309Snwhitehorn# would you like a copy of a message you send to an alias you are on?
240217309Snwhitehorn### metoo = OFF
241217309Snwhitehorn
242217309Snwhitehorn# when using the page commands (+ - <NEXT> <PREV>) change the current
243217309Snwhitehorn# message pointer...?
244217309Snwhitehorn### movepage = OFF
245217309Snwhitehorn
246217309Snwhitehorn# just show the names when expanding aliases?
247217309Snwhitehornnames = OFF
248217309Snwhitehorn
249217309Snwhitehorn# when messages are copied into the outbound buffer, don't include headers?
250217309Snwhitehornnoheader = ON
251217309Snwhitehorn
252217309Snwhitehorn# program to use for displaying messages ('builtin' is recommended)
253217309Snwhitehorn### pager = builtin+
254217309Snwhitehorn
255217309Snwhitehorn# start up by pointing to the first new message received, if possible?
256217309Snwhitehorn### pointnew = ON
257217309Snwhitehorn
258217309Snwhitehorn# list of delivery precedences allowed, or empty to allow anything
259217309Snwhitehorn# precedence may be followed by optional ":priority" specification
260217309Snwhitehorn### precedences = 
261217309Snwhitehorn
262217309Snwhitehorn# prefix sequence for indenting included message text in outgoing messages...
263217309Snwhitehornprefix = _:>_
264217309Snwhitehorn
265217309Snwhitehorn# how to print a message ('%s' is the filename)
266217309Snwhitehorn### print = /bin/cat %s | /usr/bin/lpr
267217309Snwhitehorn
268217309Snwhitehorn# prompt for a command after the external pager exits?
269217309Snwhitehorn### promptafter = ON
270217309Snwhitehorn
271217309Snwhitehorn# Value by which message count is incremented while reading a new mailbox.
272217309Snwhitehorn# Setting this value to a number larger than one will speed up the time it
273217309Snwhitehorn# takes to read a large mailbox when using a slow terminal.
274217309Snwhitehorn### readmsginc = 1
275217309Snwhitehorn
276217309Snwhitehorn# where to save received messages to, default file is "=received"
277217309Snwhitehornreceivedmail = =received
278217309Snwhitehorn
279217309Snwhitehorn# remote ".signature" file to append to appropriate messages...
280217309Snwhitehornremotesignature = ~/.signature
281217309Snwhitehorn
282217309Snwhitehorn# emulate the mailx message increment mode (only increment after
283217309Snwhitehorn# something has been 'done' to a message, either saved or deleted,
284217309Snwhitehorn# as opposed to simply each time something is touched)?
285217309Snwhitehorn### resolve = ON
286217309Snwhitehorn
287217309Snwhitehorn# save messages, incoming and outbound, by login name of sender/recipient?
288217309Snwhitehornsavename = ON
289217309Snwhitehorn
290217309Snwhitehorn# where to save copies of outgoing mail to, default file is "=sent"
291217309Snwhitehornsentmail = =sent
292217309Snwhitehorn
293217309Snwhitehorn# The shell to use for shell escapes
294217309Snwhitehornshell = /bin/sh
295217309Snwhitehorn
296217309Snwhitehorn# do we want dashes above signatures? (News 2.11 compatibility and convention)
297217309Snwhitehorn### sigdashes = ON
298217309Snwhitehorn
299217309Snwhitehorn# time in seconds which Elm will wait after displaying a transient message
300217309Snwhitehorn# and before erasing it.  Can be 0 or positive integer.
301217309Snwhitehorn### sleepmsg = 2
302217309Snwhitehorn
303217309Snwhitehorn# are we running on an HP terminal and want softkeys available too?
304217309Snwhitehorn# (this implies "keypad=ON" too)
305217309Snwhitehorn### softkeys = OFF
306217309Snwhitehorn
307217309Snwhitehorn# how to sort folders, "Reverse Sent" by default
308217309Snwhitehorn### sortby = Reverse-Sent
309217309Snwhitehorn
310217309Snwhitehorn# Set the main prompt timeout for resynching...
311217309Snwhitehorn### timeout = 600
312217309Snwhitehorn
313217309Snwhitehorn# display message title when displaying pages of message?
314217309Snwhitehorntitles = ON
315217309Snwhitehorn
316217309Snwhitehorn# where to place temporary files, default directory is "/tmp"
317217309Snwhitehorn### tmpdir = /tmp/
318217309Snwhitehorn
319217309Snwhitehorn# are we good at it?  0=beginner, 1=intermediate, 2+ = expert!
320217309Snwhitehornuserlevel = 0
321217309Snwhitehorn
322217309Snwhitehorn# would you like to use termcap/terminfo ti/te entries?
323217309Snwhitehornusetite = ON
324217309Snwhitehorn
325217309Snwhitehorn# name of editor for ~v command (when editor="builtin")
326217309Snwhitehornvisualeditor = $EDIT
327217309Snwhitehorn
328217309Snwhitehorn# enable the weedout list to be read?
329217309Snwhitehorn### weed = ON
330217309Snwhitehorn
331217309Snwhitehorn# what headers I DON'T want to see, ever.
332217309Snwhitehornweedout = "*end-of-user-headers*"
333217309Snwhitehorn
334217309SnwhitehornEOF
335217309Snwhitehorn
336217309Snwhitehorn  chmod 600 $ELMRC
337217309Snwhitehorn  chown $USER.mail $ELMRC
338217309Snwhitehorn}
339