1#!/bin/bash
2# $Id: copi.funcs,v 1.3 2001/01/15 22:24:26 tom Exp $
3#  ComeOn Point Functions! v0.9.2
4#  - usate da vari altri moduli ComeOn Point...
5#
6#  AUTHOR: Beppe (beppe.dem@nsm.it)
7#
8#  This program is free software; you can redistribute it and/or
9#  modify it under the terms of the GNU General Public License
10#  as published by the Free Software Foundation; either version 2
11#  of the License, or (at your option) any later version.
12#
13#  This program is distributed in the hope that it will be useful,
14#  but WITHOUT ANY WARRANTY; without even the implied warranty of
15#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16#  GNU General Public License for more details.
17#
18#  You should have received a copy of the GNU General Public License
19#  along with this program; if not, write to the Free Software
20#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21#
22
23HOST=`hostname`
24DOMAIN=`hostname -d`
25PKTNAME="ComeOn Point Installer!"
26COMEONDIR=/usr/lib/ComeOn
27
28AKASETUP=$COMEONDIR/point/.akasetup
29COPIUSER=$COMEONDIR/point/.copi.user
30EMSIFILE=$COMEONDIR/point/.emsi
31PNTSETUP=$COMEONDIR/point/.pntsetup
32
33mkstemp() {
34  eval 'tmp_'$1'=`tempfile 2>/dev/null` || tmp_'$1'=/tmp/'$1'$$'
35}
36
37# Args: [start_uid]
38# Returns: $FOUND_UID
39find_unused_uid() {
40
41  if [ $1 ]; then
42    FOUND_UID=$1
43  else
44    FOUND_UID=501
45  fi
46
47  while [ "`cut -f3 -d: /etc/passwd | grep -x $FOUND_UID`" ]
48  do
49    FOUND_UID=$[$FOUND_UID+1]
50  done
51}
52
53int2fido() {
54 _RETVAL="`echo $1 | cut -f3 -d. | cut -c2-`:\
55`echo $1 | cut -f2 -d. | cut -c2-`/\
56`echo $1 | cut -f1 -d. | cut -c2-`"
57}
58int2fidonet() {
59 _RETVAL="`echo $1 | cut -f3 -d. | cut -c2-`:\
60`echo $1 | cut -f2 -d. | cut -c2-`/\
61`echo $1 | cut -f1 -d. | cut -c2-`@\
62`echo $1 | cut -f4- -d.`"
63}
64fido2int() {
65 _RETVAL="f\
66`echo $1 | cut -f2 -d '/'`.n\
67`echo $1 | cut -f1 -d '/' | cut -f2 -d:`.z\
68`echo $1 | cut -f1 -d '/' | cut -f1 -d:`"
69}
70fidonet2int() {
71 _RETVAL="f\
72`echo $1 | cut -f2 -d/ | cut -f1 -d@`.n\
73`echo $1 | cut -f1 -d/ | cut -f2 -d:`.z\
74`echo $1 | cut -f1 -d/ | cut -f1 -d:`.\
75`echo $1 | cut -f2 -d@`"
76}
77fidonetpoint2int() {
78 _RETVAL="p\
79`echo $1 | cut -f2 -d. | cut -f1 -d@`.f\
80`echo $1 | cut -f2 -d/ | cut -f1 -d.`.n\
81`echo $1 | cut -f2 -d: | cut -f1 -d/`.z\
82`echo $1 | cut -f1 -d/ | cut -f1 -d:`.\
83`echo $1 | cut -f2 -d@`.org"
84}
85
86# Parameters: fqdn
87configure_loopback() {
88  dialog --backtitle "$TITLE" --infobox "Configuro la rete (in modo loopback)..." 0 0
89    
90  FQDN=$1
91  HOST=`echo $FQDN | cut -f1 -d.`
92  DOMAIN=`echo $FQDN | cut -f2- -d.`
93
94  save /etc/hostname
95  echo $FQDN >/etc/HOSTNAME
96  export HOSTNAME=$FQDN
97  hostname $HOST
98
99  save /etc/rc.d/rc.inet1
100  cat <<EOF >/etc/rc.d/rc.inet1 
101#! /bin/sh
102#
103# rc.inet1      This shell script boots up the base INET system.
104
105# Attach the loopback device.
106/sbin/ifconfig lo 127.0.0.1
107/sbin/route add -net 127.0.0.0
108
109# End of rc.inet1
110EOF
111  chmod 755 /etc/rc.d/rc.inet1
112
113
114  save /etc/networks
115  cat <<EOF >/etc/networks
116#
117# networks      This file describes a number of netname-to-address
118#               mappings for the TCP/IP subsystem.  It is mostly
119#               used at boot time, when no name servers are running.
120#
121
122loopback        127.0.0.0
123
124# End of networks.
125EOF
126  chmod 644 /etc/networks
127
128
129  save /etc/hosts
130  cat <<EOF >/etc/hosts
131#
132# hosts         This file describes a number of hostname-to-address
133#               mappings for the TCP/IP subsystem.  It is mostly
134#               used at boot time, when no name servers are running.
135#               On small systems, this file can be used instead of a
136#               "named" name server.  Just add the names, addresses
137#               and any aliases to this file...
138#
139# By the way, Arnt Gulbrandsen <agulbra@nvg.unit.no> says that 127.0.0.1
140# should NEVER be named with the name of the machine.  It causes problems
141# for some (stupid) programs, irc and reputedly talk. :^)
142#
143# But we (ComeOn Linux!) says that this is not valid for you, because
144# you resulted to have not a network at the installation time.
145
146# For loopbacking.
147127.0.0.1	localhost	$FQDN	$HOST
148
149# End of hosts.
150EOF
151  chmod 644 /etc/hosts
152
153  save /etc/resolv.conf
154  echo domain $DOMAIN >/etc/resolv.conf
155  chmod 644 /etc/resolv.conf
156
157  save /etc/host.conf
158  cat <<EOF >/etc/host.conf
159order hosts,bind
160multi on
161EOF
162  chmod 644 /etc/host.conf
163
164  /etc/rc.d/rc.inet1
165}
166
167# Private function, adds an user to a group. Args: user, group
168add_to_group() {
169
170  if [ ! "`groups \"$1\" | grep \" $2 \"`" ]
171  then
172    USERS="`grep \"$2:\" /etc/group | cut -s -f4 -d:`"
173
174    mkstemp group
175    if [ "$USERS" ]; then
176      sed "/$2:/s/:$USERS/:$USERS,$1/" /etc/group >$tmp_group
177    else
178      sed "/$2:/s/:/:$1/3" /etc/group >$tmp_group
179    fi
180
181    save /etc/group
182    mv $tmp_group /etc/group
183  fi
184}
185
186# Arguments: user, fullname
187add_postmaster() {
188  dialog --backtitle "$TITLE" --infobox "Creo l'user principale e/o ne adatto le informazioni..." 0 0
189
190  USER="$1"
191  NAME="$2"
192  HOMEDIR="/home/$USER"
193
194#  echo "$USER" >$COPIUSER	# you've to do this in any other location
195  ENTRY="`cut /etc/passwd -s -f1,2,5 -d: | grep $USER:`"
196  if [ "$ENTRY" ]
197  then
198    OLDNAME="`echo $ENTRY | cut -f3 -d:`"
199    PASW="`echo $ENTRY | cut -f2 -d:`"
200    if [ "$OLDNAME" != "$NAME" ]
201    then
202      mkstemp passwd
203      sed "/$USER:$PASW:/s/:$OLDNAME:/:$NAME:/" /etc/passwd >$tmp_passwd
204      save /etc/passwd
205      mv $tmp_passwd /etc/passwd
206    fi
207
208    add_to_group "$USER" mail
209  else
210    if [ -f /bin/bash ]; then USERSHELL=/bin/bash; else USERSHELL=""; fi
211    find_unused_uid
212    echo "$USER:*:$FOUND_UID:12:$NAME:$HOMEDIR:$USERSHELL" >>/etc/passwd
213    mkdir -p $HOMEDIR -m 755
214    chown $USER.mail $HOMEDIR
215  fi
216}
217
218comment_nntp_in_inetdconf() {
219  dialog --backtitle "$TITLE" --infobox "Commento la riga 'nntp' in /etc/inetd.conf..." 0 0
220
221  mkstemp inetd
222  sed "/in.nntpd/s/nntp/#&/" /etc/inetd.conf >$tmp_inetd
223  save /etc/inetd.conf
224  mv $tmp_inetd /etc/inetd.conf
225  killall -1 inetd
226}
227
228# Args: organization
229set_organization() {
230  dialog --backtitle "$TITLE" --infobox "Imposto l' origin..." 0 0
231
232  ORGANIZATION=/etc/organization
233  save $ORGANIZATION 
234
235  NEW_ORGANIZATION="$1"
236  echo "$NEW_ORGANIZATION" >$ORGANIZATION
237}
238
239create_innconf_newsfeeds_distrib() {
240  dialog --backtitle "$TITLE" --infobox "Creo i files di configurazione principali di InterNet News (inn)..." 0 0
241
242# File: inn.conf
243  INNCONF=~news/inn.conf
244  save $INNCONF
245
246  cat <<EOF >$INNCONF
247##  $Revision: 1.3 $
248##  inn.conf -- inn configuration data
249##  Format:
250##	<parameter>:<whitespace><value>
251##  Used by various programs and libinn.  The following parameters are defined:
252##	domain		Local domain, without leading period.
253##  	fromhost	What to put in the From line; default is FQDN
254##			of the local host.
255##	moderatormailer	Where to mail moderated postings, if not found
256##			in the moderators file; see moderators(5).
257##	pathhost	What to put in the Path and Xref headers; default
258##			is FQDN of the local host.
259##	organization	If $ORGANIZATION doesn't exist.  What to put in
260##			the Organization header if blank.
261##	server		If $NNTPSERVER doesn't exist.  Local NNTP server
262##			host to connect to.
263##
264
265server:         $HOST.$DOMAIN
266domain:         $DOMAIN
267pathhost:	$HOST
268EOF
269
270  chmod 444 $INNCONF
271  chown news.news $INNCONF
272
273
274# File: newsfeeds
275  NEWSFEEDS=~news/newsfeeds
276  save $NEWSFEEDS
277
278  echo -e "ME:*::\n" >$NEWSFEEDS
279
280  IAKA=1
281  OK=1
282  while [ "$OK" != 0 ]
283  do
284    AKA="`cut $AKASETUP -f$IAKA -d:`"
285    if [ ! "$AKA" ]
286    then
287      OK=0
288    else
289      if [ $IAKA != 1 ]
290      then
291        TMPAKA="`echo $AKA | cut -f-4 -d.`"
292        SENDCRON="$SENDCRON $TMPAKA"
293        echo -n "$TMPAKA/" >>$NEWSFEEDS
294      fi
295      TMPAKA="`echo $AKA | cut -f1-2 -d.`"
296      if [ $IAKA = 1 ]; then
297        SENDCRON="$SENDCRON $TMPAKA"
298      fi
299      echo -e "$TMPAKA\\" >>$NEWSFEEDS
300      echo -e "\t:!*,`echo $AKA | cut -f4 -d.`.*\\" >>$NEWSFEEDS
301      echo -e "\t:Tf,Wfb,B4096/1024:\n" >>$NEWSFEEDS
302    fi
303    IAKA=$[$IAKA+1]
304  done
305
306  chmod 444 $NEWSFEEDS
307  chown news.news $NEWSFEEDS
308
309
310# File: distrib.pats
311  DISTRIB=~news/distrib.pats
312  save $DISTRIB
313
314  IAKA=1
315  OK=1
316  while [ "$OK" != 0 ]; do
317    AKA="`cut $AKASETUP -f$IAKA -d:`"
318    IAKA=$[$IAKA+1]
319    if [ "$AKA" = "" ]; then
320      OK=0
321    else
322      DOM="`echo $AKA | cut -f4 -d.`"
323      echo "10:$DOM.*:$DOM" >>$DISTRIB
324    fi
325  done
326
327  chmod 444 $DISTRIB
328  chown news.news $DISTRIB
329}
330
331# Args: num_of_days
332create_expirectl() {
333  dialog --backtitle "$TITLE" --infobox "Imposto il periodo di transito dei messaggi..." 0 0
334
335  EXPIRECTL=~news/expire.ctl
336  save $EXPIRECTL
337
338  EXPIRE_DAYS=$1
339
340  echo -e "/remember/:14\n\n*:A:2:$EXPIRE_DAYS:$EXPIRE_DAYS" >$EXPIRECTL
341
342  chmod 440 $EXPIRECTL
343  chown news.news $EXPIRECTL
344}
345
346create_nnrpaccess() {
347  dialog --backtitle "$TITLE" --infobox "Rendo accessibili le news in lettura..." 0 0
348
349  NNRPACCESS=~news/nnrp.access
350  save $NNRPACCESS
351
352  cat <<EOF >$NNRPACCESS
353##  $Revision: 1.3 $
354##  nnrp.access - access file for on-campus NNTP sites
355##  Format:
356##	<host>:<perm>:<user>:<pass>:<groups>
357##  Connecting host must be found in this file; the last match found is
358##  used, so put defaults first.
359##	<host>		Wildcard name or IP address
360##	<perm>		R to read; P to post
361##	<user>		Username for authentication before posting
362##	<pass>		Password, for same reason
363##	<groups>	Newsgroup patterns that can be read or not read
364##  To disable posting put a space in the <user> and <pass> fields, since
365##  there is no way for client to enter one.
366##
367## Default is no access, no way to authentication, and no groups.
368# *:: -no- : -no- :!*
369##  Foo, Incorporated, hosts have no password, can read anything.
370# *.foo.com:Read Post:::*
371
372*:: -no- : -no- :!*
373localhost.$DOMAIN:Read Post:::*
374$HOST.$DOMAIN:Read Post:::*
375
376EOF
377
378  chmod 440 $NNRPACCESS 
379  chown news.news $NNRPACCESS 
380}
381
382create_hostsnntp() {
383  dialog --backtitle "$TITLE" --infobox "Rendo accessibili le news in scrittura..." 0 0
384
385  HOSTSNNTP=~news/hosts.nntp
386  save $HOSTSNNTP
387
388  cat <<EOF >$HOSTSNNTP
389##  $Revision: 1.3 $
390##  hosts.nntp - names and addresses that feed us news
391##  Format
392##      <host>:
393##      <host>:<password>
394##  <host> can be a name or IP address; no wildcards.  Any hosts not
395##  listed here are handed off to nnrpd.
396
397$HOST.$DOMAIN:
398
399EOF
400    
401  chmod 440 $HOSTSNNTP
402  chown news.news $HOSTSNNTP 
403}
404
405create_dirs_and_files() {
406
407  CURMASK=`umask`
408  . ./copi.wheel
409  pushd /var/log >/dev/null
410  mkdir -p news -m 755; chown news.news news
411  cd /var/log/news; mkdir -p OLD -m 755; chown news.news OLD
412  cd /var/spool; mkdir -p news -m 775; chown news.news news
413  cd /var/spool/news; umask 02
414  mkdir -p out.going control junk in.coming
415  chown news.news out.going control junk in.coming
416  cd in.coming; mkdir -p bad tmp; chown news.news bad tmp; umask $CURMASK
417  ln -sf ~news /usr/local/lib/
418  ln -sf ~news/inews /usr/bin/
419  chmod 1777 /var/tmp
420
421  cd /var/spool
422  mkdir -p uucppublic
423  chown uucp.uucp uucppublic
424  chmod 1777 uucppublic
425
426  cd ~news
427  touch history history.dir history.pag errlog log
428  chown news.news history* log errlog
429  chmod 664 history* log errlog
430
431  save active
432  echo "control 0000000000 0000000001 y" > active
433  echo "junk 0000000000 0000000001 y" >> active
434  chown news.news active
435
436  save active.times  
437  echo "control 814573260 usenet" > active.times
438  echo "junk 814573260 usenet" >> active.times
439  chown news.news active.times
440
441  save newsgroups
442  :>newsgroups
443  chown news.news newsgroups
444
445  popd >/dev/null
446}
447
448install_rcnews() {
449  dialog --backtitle "$TITLE" --infobox "Avvio l'InterNet News daemon (innd) e l'installo negli script di boot, attendere... attenzione che e' probabile che in questa fase non sia possibile entrare da un'altra VC come root." 0 0
450
451  RCLOCAL=/etc/rc.d/rc.local
452  RCNEWS=~news/etc/rc.news
453  RCLINE="`grep $RCNEWS $RCLOCAL`"
454
455  if [ ! "$RCLINE" -o `echo $RCLINE | cut -c1` = '#' ]
456  then
457    save $RCLOCAL
458    echo -e "\n$RCNEWS" >>$RCLOCAL
459  fi
460
461  cp copi.rcnews $RCNEWS
462  chmod 550 $RCNEWS
463  chown news.news $RCNEWS 
464
465  if [ -f ~news/innd/innd.pid ]; then
466    su -l news -c "bin/ctlinnd shutdown x" >/dev/null
467    sleep 2	# wait for server to shutdown
468  fi
469
470  killall innd 2>/dev/null	# make sure it's gone down
471  $RCNEWS
472}
473
474install_crontab_news() {
475  dialog --backtitle "$TITLE" --infobox "Imposto la crontab di news per l'automantenimento del sistema (cancellazione giornaliera dei messaggi vecchi et similia)..." 0 0
476
477
478  if [ -f $COPIUSER ]; then
479    POSTMST="`cat $COPIUSER`"
480  else
481    POSTMST="root"
482  fi
483
484  NEWSHOME=~news
485  save /var/spool/cron/crontabs/news
486  cat <<EOF | crontab - -u news
487#-------------------------------------------------------------------------------
488# /var/spool/cron/crontabs/news
489SHELL=/bin/sh
490#
491MAILTO=$POSTMST
492#
493#===============================================================================
494#
495# inn-1.4 (Inter Net News)
496#
497#===============================================================================
498#
499#-------------------------------------------------------------------------------
500# Daily housekeeping ... expires news and other things ...
501#-------------------------------------------------------------------------------
502#
50351 16 * * *	$NEWSHOME/bin/news.daily < /dev/null
504#
505#-------------------------------------------------------------------------------
506# offer spooled news - that was spooled into the incoming directory when the 
507# innd server wasn't available - again to the innd server.
508#-------------------------------------------------------------------------------
509#
51018 * * * *	$NEWSHOME/rnews -U
511# 
512#-------------------------------------------------------------------------------
513# send news batches to your fidonet(-like) news feeds 
514#-------------------------------------------------------------------------------
515#
51649 16 * * *	$NEWSHOME/send-ifmail$SENDCRON
517#
518#-------------------------------------------------------------------------------
519#
520EOF
521
522  echo $NEWSHOME/send-ifmail$SENDCRON >/etc/point.ifsend
523}
524
525# Private func
526# Args: dir_with_sources, bindir, cfgdir, logdir, version
527copi.ifmCfg() {
528
529  SRCDIR="$1"
530  BINDIR="$2"
531  CFGDIR="$3"
532  LOGDIR="$4"
533  VERSION="$5"
534  SOURCE="$SRCDIR/CONFIG"
535  CONFIGFILE="$CFGDIR/config"
536
537  cat <<EOF >$SOURCE
538# Compile-time configuration for ifmail FidoNet mailer and gateway
539COPYRIGHT   = "Eugene G. Crosser, 1993-1995"
540VERSION     = "$VERSION"
541
542# Main configuration file. This default may be overwritten by -I key.
543CONFIGFILE  = $CONFIGFILE
544
545# Debug messages turned on by -x key are written here.
546# Some error messages may occationally appear here too.
547# This may be changed in the 'config' file.
548DEBUGFILE   = "$LOGDIR/ifdebug"
549
550# Procession log. Usually gets several lines for each invocation.
551# Also look for error diagnostics here.  If HAS_SYSLOG defined,
552# only stdout and stderr from the packers and unpackers go to this
553# file, while actual logging is done via syslog() calls.
554# This may be changed in the 'config' file.
555LOGFILE     = "$LOGDIR/iflog"
556
557# Use syslog() facility codes for mail gate, news gate and ifcico.
558# Define -DHAS_SYSLOG (see below)
559#MAILLOG    = LOG_MAIL
560MAILLOG    = LOG_LOCAL0
561#NEWSLOG    = LOG_NEWS
562NEWSLOG    = LOG_LOCAL0
563#CICOLOG    = LOG_UUCP
564CICOLOG    = LOG_LOCAL0
565
566# Directory where UUCP lock files reside.
567#LOCKDIR     = "/var/lock"
568LOCKDIR     = "/var/spool/uucp"
569
570# Directory from which file requests are resolved.
571# This may be changed from the 'config' file.
572#PUBDIR      = "/home/ftp/pub"
573PUBDIR      = "/var/spool/uucppublic"
574
575# Compile-time system-dependant options. 
576
577# If you specify "-DHAS_NDBM_H", ndbm calls will be used instead
578# of dbm ones, and the feature will be activated of Cnews log processing
579# to add entries to SEEN-BY if echo message is exported to several FTN
580# nodes by Cnews mechanism. This works with INN too.
581
582# If you specify "-DHAS_STATFS" or "-DHAS_STATVFS", statfs() (or statvfs()
583# respectivly) call will be used to check available disk space. For statfs()
584# call, you must also specify which .h file to use: "-DSTATFS_IN_VFS_H" or 
585# "-DSTATFS_IN_STATFS_H" or "-DSTATFS_IN_STATVFS_H"  or "-DSTATFS_IN_MOUNT_H". 
586# For statvfs() call, statvfs.h is included.
587
588# define -DSCO_STYLE_STATFS if your statfs() call requires 4 arguments.
589
590# If you specify "-DHAS_SETSID", setsid() call is used to detach from the
591# control terminal. Otherwise setpgrp() call is used, and in this case you
592# may specify "-DBSD_SETPGRP" to use BSD-style call.  Used in ifcico only.
593
594# If you specify "-DDONT_HAVE_TM_GMTOFF", timezone offset will be calculated
595# from the difference between the results of localtime() and gmtime() calls
596# instead of using tm_gmtoff field of struct tm.
597
598# If you specify "-DDONT_HAVE_GETOPT", local definitions for getopt will
599# be used (but not the function itself)
600
601# For ifcico, you must specify -DHAS_TERMIOS_H (preffered), -DHAS_TERMIO_H
602# or -DHAS_SGTTY_H to use POSIX-y, SysV-ish of BSD-ish terminal control.
603
604# in SVR4 you should specify -DHAS_DIAL (and maybe -DHAS_DIAL_H) to use
605# dial() library function instead of regular open().  Lock files are
606# not used in this case.
607
608# for uucp lock files, you must specify either -DASCII_LOCKFILES or
609# -DBINARY_LOCKFILES
610
611# define -DHAS_FSYNC if there is a fsync() system call (to update .flo
612# files)
613
614# define -DPARANOID if you want iftoss to deny packets with wrong password.
615
616# define -DRELAXED if you want iftoss to accept packets that are not
617# addressed to your node.
618
619# define -DFORCEINTL if you want ifmail to create ^aINTL even if this is
620# not an inter-zone netmail.
621
622# define -DNEED_UUCPFROM if your MTA needs a uucp "From" line in mail.
623
624# define -DHAS_TCP if you want ifmail to be able to originate outgoing
625# connections over TCP/IP (socket library needed)
626
627# define -DHAS_TERM if you want ifmail to be able to originate outgoing
628# connections over TERM (TCP "extention", client.a needed)
629
630# define -DHAS_REGEX_H or -DHAS_LIBGEN_H if you have either of these
631# header files for regular expression handlers.
632
633# define -DHAS_SYSLOG to use syslog() instead of logging to files.
634# Files are necessary anyway, external programs' stdout and stderr
635# are redirected there.
636
637# define -DNEED_BSY if you want ifpack and ifcico to create .bsy
638# files preventing simultaneous processing of the same node.
639
640# define -DNEED_FORK if your system is uncapable of getting rid of the
641# control terminal unless you are running not as a group leader.
642
643# define -DREGEX_NEED_CARET if your re_comp/re_exec require that the
644# mask starts with a '^' to match the beginning of the string.
645
646# as of June 1994, FreeBSD has a nasty bug in the kernel lseek() code:
647# if you make lseek() to a point before the start of the file, it
648# succeeds and the writing point becomes negative.  Fortunately, 
649# subsequent write()s fail :-).  To overwork this, define 
650# -DNEGATIVE_SEEK_BUG, this will add an extra fseek() to restore
651# zero writing point where necessary.
652
653# define -DNEED_TRAP if you want debugging information when the programs
654# are aborted with segmentation fault etc.  Currently tested and works 
655# only with Linux, and only with newer kernels (1.1.20+)
656
657# define -DSLAVE_SENDS_NAK_TOO if you have problems answering incoming
658# EMSI sessions originated by FrontDoor.  FrontDoor does not follow
659# EMSI specifications when originating calls, this is a workaround.
660
661# define -DDONT_HAVE_DIRENT if there is no working opendir()/readdir()
662# etc. in your libc.  You will aso need to add "dirent.o" to the NEEDED
663# (see below).
664
665# Linux:
666OPTS        = -DHAS_STATFS -DSTATFS_IN_VFS_H -DHAS_SETSID -DHAS_NDBM_H \\
667		-DDONT_HAVE_TM_GMTOFF -DHAS_TERMIOS_H -DASCII_LOCKFILES \\
668		-DHAS_FSYNC -DHAS_IOCTL_H -DHAS_REGEX_H -DHAS_TCP \\
669		-DFORCEINTL -DHAS_SYSLOG -DNEED_UUCPFROM -DNEED_BSY \\
670		-DREGEX_NEED_CARET -DNEED_TRAP -DSLAVE_SENDS_NAK_TOO \\
671		-DNEED_FORK -DLESS_RFC_KLUDGES
672
673# 386BSD:
674#OPTS        = -DHAS_STATFS -DSTATFS_IN_MOUNT_H -DHAS_SETSID -DHAS_NDBM_H \\
675		-DHAS_TERMIOS_H -DASCII_LOCKFILES -DHAS_FSYNC -DHAS_IOCTL_H \\
676		-DHAS_REGEX_H -DHAS_TCP -DHAS_SYSLOG -DNEED_UUCPFROM \\
677		-DNEED_BSY -DNEED_FORK -DNEGATIVE_SEEK_BUG \\
678		-DREGEX_NEED_CARET
679
680# SVR4:
681#OPTS        = -DHAS_STATVFS -DDONT_HAVE_TM_GMTOFF -DHAS_SETSID -DHAS_NDBM_H \\
682		-DHAS_TERMIOS_H -DHAS_DIAL -DHAS_DIAL_H -DASCII_LOCKFILES \\
683		-DHAS_FSYNC -DHAS_IOCTL_H -DHAS_LIBGEN_H -DHAS_TCP \\
684		-DHAS_SYSLOG -DREGEX_NEED_CARET
685# SunOS:
686#OPTS        = -DHAS_STATFS -DSTATFS_IN_VFS_H -DHAS_SETSID -DHAS_NDBM_H \\
687		-DDONT_HAVE_GETOPT -DHAS_TERMIOS_H -DASCII_LOCKFILES \\
688		-DHAS_FSYNC -DHAS_TCP -DHAS_SYSLOG \\
689		-DREGEX_NEED_CARET
690
691# SCO Unix 3.2v4.2
692#OPTS        = -DHAS_STATFS -DSTATFS_IN_STATFS_H -DSCO_STYLE_STATFS \\
693		-DHAS_TERMIOS_H -DDONT_HAVE_TM_GMTOFF -DDO_NEED_TIME \\
694		-DDONT_HAVE_GETOPT -DASCII_LOCKFILES -DHAS_IOCTL_H \\
695		-DHAS_TCP -DHAS_SYSLOG \\
696		-DREGEX_NEED_CARET
697
698# ISC Unix 3.2 v3.0
699#OPTS        = -DHAS_STATFS -DSTATFS_IN_STATFS_H -DHAS_TERMIO_H \\
700		-DDONT_HAVE_TM_GMTOFF -DDONT_HAVE_GETOPT \\
701		-DASCII_LOCKFILES -DHAS_IOCTL_H -DSCO_STYLE_STATFS \\
702		-DUSE_POLL -DHAS_NET_ERRNO_H -DSHORT_PID_T \\
703		-DHAS_TCP -DHAS_SYSLOG \\
704		-DREGEX_NEED_CARET
705# On ISC, if you are suing gcc, you can run into a trouble with sscanf()
706# function.  It appears that sscanf(string,"%d.%d",&int1,&int2) where
707# string is a constant segfaults unless you specify "-fwritable-strings"
708# to gcc.  I would say that this is a bug in ISC libc.  If nessecary,
709# add this to the defines above.  If you have ISC version 4.0 or later,
710# you can add "-posix", remove "-DSHORT_PID_T" and specify "-DHAS_TERMIOS"
711# to get benefit of posix terminal control.
712
713# for make install, where to put binaries and what owner to set
714BINDIR = $BINDIR
715OWNER = fnet
716GROUP = uucp
717MODE = 0711
718SMODE = 4711
719
720INSTALL = install
721RANLIB = ranlib
722#RANLIB = touch
723SHELL = /bin/sh
724ECHO = echo -e
725CC = gcc
726YACC = bison -y
727#YACC = yacc
728LEX = flex
729#LEX = lex
730AWK = awk
731TAR = tar
732
733#CFLAGS = -g -Wall
734# Linux, 386BSD, SunOS:
735CFLAGS = -O2 -Wall -m486 -s
736# SVR4:
737#CFLAGS = -O -Xa
738
739LDFLAGS = -s
740
741# For LIBS, you may need to add "-lfl" if you are using flex 2.4.x
742# If you need TERM also add e.g. "/usr/src/term112/client.a"
743
744# Linux
745LIBS = -ldbm
746# SunOS:
747#LIBS =
748# 386BSD:
749#LIBS = -lgdbm -lgnuregex
750# SVR4
751#LIBS = -ldbm -lform -lnsl -lsocket -lc -L/usr/ucblib -lucb
752# SCO
753#LIBS = -ldbm -lsocket -lintl
754# ISC
755#LIBS = -lcposix -lmalloc -ldbm -linet -lPW
756
757INCLUDES = -I\${INCDIR}
758# ISC
759#INCLUDES = -I/usr/include/rpcsvc -I\${INCDIR}
760
761# What programs are absent at your system?
762#NEEDED = strcasestr.o strncasecmp.o strcasecmp.o rename.o mkdir.o usleep.o \\
763		regexpr.o
764# Linux
765NEEDED =
766# SVR4
767#NEEDED = regexpr.o
768# SCO
769#NEEDED = strcasestr.o strncasecmp.o strcasecmp.o usleep.o regexpr.o
770# SunOS and 386BSD
771#NEEDED = signal.o
772# ISC
773#NEEDED = usleep.o regexpr.o vsyslog.o
774EOF
775
776}
777
778# Args: package.tgz, bin_dir, cfg_dir, log_dir, version, where_to_put_src
779install_ifmail() {
780  dialog --backtitle "$TITLE" --infobox "Installo e compilo Ifmail..." 0 0
781
782  AKAPRI="`cut $AKASETUP -f1 -d:`"
783  int2fido $AKAPRI
784  AKAPRIFTN=$_RETVAL
785
786  if [ -f $COPIUSER ]
787  then
788    POST="`cat $COPIUSER`"
789  else
790    POST=root
791  fi
792
793  TGZ="$1"
794  BINDIR="$2"
795  CFGDIR="$3"
796  LOGDIR="$4"
797  VERSION="$5"
798  SRC="$6"
799
800###################################################
801## passwd e group
802####################################
803
804  if [ "`cut /etc/passwd -f1 -d: | grep -x fnet`" ]
805  then
806    mkstemp passwd
807    grep -v "fnet:" /etc/passwd >$tmp_passwd
808    save /etc/passwd
809    mv $tmp_passwd /etc/passwd
810  fi
811
812  find_unused_uid 92
813  echo "fnet:*:$FOUND_UID:14:Fidonet Gate:$BINDIR:" >>/etc/passwd
814
815
816####################################################
817#### dirs and files
818###################################
819  mkdir -p        $CFGDIR $LOGDIR /var/spool/ifmail/{BAK,nl.d} $BINDIR/magic
820  chown fnet.uucp $BINDIR{,/magic} $CFGDIR $LOGDIR /var/spool/ifmail/{,BAK,nl.d}
821  touch           $LOGDIR/{ifdebug,iflog,sysiflog,TheLog}
822  chown fnet.uucp $LOGDIR/{ifdebug,iflog,sysiflog,TheLog}
823
824##########################################################################
825#### COMPILAZIONE
826####################################
827
828  SRC="$SRC/`tar zxvf $TGZ -C $SRC | head -1`"
829# ora in $SRC c'e' il path completo dei source Ifmail
830
831  copi.ifmCfg $SRC $BINDIR $CFGDIR $LOGDIR $VERSION
832  patch -N -d $SRC <ifpatch 2>/dev/null
833  make clean -C $SRC
834  make -C $SRC
835##########################################################################
836#### INSTALLAZIONE
837####################################
838  make install -C $SRC
839}
840
841
842# Args: bin_dir, cfg_dir, log_dir, passwords
843#   note: passwords are colon-separated (":")
844configure_ifmail() {
845  dialog --backtitle "$TITLE" --infobox "Configuro Ifmail..." 0 0
846
847  BINDIR=$1
848  CFGDIR=$2
849  LOGDIR=$3
850  PASSWDS=$4
851
852  SPD="`             cut $EMSIFILE -f1`"
853  SYSNAME="`         cut $EMSIFILE -f2`"
854  LOCATION="`        cut $EMSIFILE -f3`"
855  COMPLETE_PHONE="`  cut $EMSIFILE -f4`"
856  INTERCOUNTRYPREF="`cut $EMSIFILE -f5`"
857  LONG_DIST_PREFIX="`cut $EMSIFILE -f6`"
858  NODEFLAGS="`       cut $EMSIFILE -f7`"
859  DIALSTRING="`      cut $EMSIFILE -f8`"
860  SYSOP="`           cut $EMSIFILE -f9`"
861
862  COUNTRYPREF="`echo $COMPLETE_PHONE | cut -f1 -d'-'`"
863  PREF="`       echo $COMPLETE_PHONE | cut -f2 -d'-'`"
864  PHONE="`      echo $COMPLETE_PHONE | cut -f3 -d'-'`"
865
866  FNETCFG=$CFGDIR/config
867  AREAS=$CFGDIR/Areas
868
869  POINTS="`cat $PNTSETUP`"
870  POST="`cat $COPIUSER`"
871  AKAPRI="`cut $AKASETUP -f1 -d:`"
872  int2fido "$AKAPRI"
873  AKAPRIFTN="$_RETVAL"
874  
875#invece di "cp $SRC/misc/inn/send-ifmail ~news"
876#-----------------------------------------------------------------------------
877  cp copi.sendifm1 ~news/send-ifmail
878  cat <<EOF >>~news/send-ifmail
879-p"$BINDIR/ifnews %s" \\
880EOF
881  cat copi.sendifm2 >>~news/send-ifmail
882
883  chmod 550 ~news/send-ifmail
884  chown news.news ~news/send-ifmail
885
886#invece di "cp $SRC/misc/contrib/ifreq $BINDIR"
887#-----------------------------------------------------------------------------
888  cp copi.ifreq1 $BINDIR/ifreq
889  cat <<EOF >>$BINDIR/ifreq
890# ifcico-config-file:
891\$config = "$CFGDIR/config";
892
893# change this to the default node, where requests should go to.
894\$node = "$AKAPRIFTN";
895EOF
896  cat copi.ifreq2 >>$BINDIR/ifreq
897
898  chmod 755 $BINDIR/ifreq
899  chown fnet.uucp $BINDIR/ifreq
900
901#invece di "cp $SRC/misc/contrib/ifman $BINDIR"
902#-----------------------------------------------------------------------------
903  cp copi.ifman1 $BINDIR/ifman
904  cat <<EOF >>$BINDIR/ifman
905\$cfgfile="$CFGDIR/config";     # where the config is
906\$ifowner="fnet";               # who is the owner of the ifmail
907
908EOF
909  cat copi.ifman2 >>$BINDIR/ifman
910
911  chmod 755 $BINDIR/ifman
912  chown fnet.uucp $BINDIR/ifman
913
914#invece di "cp $SRC/misc/contrib/ifpoll $BINDIR"
915#-----------------------------------------------------------------------------
916  cp copi.ifpoll1 $BINDIR/ifpoll
917  cat <<EOF >>$BINDIR/ifpoll
918FIDOPATH=$BINDIR
919LOGPATH=$LOGDIR
920
921# sysop of fido stuff
922IFCICO_SYSOP=$POST
923
924# my boss node (default address to poll)
925NODE=$AKAPRI
926EOF
927  cat copi.ifpoll2 >> $BINDIR/ifpoll
928
929  chmod 755 $BINDIR/ifpoll
930  chown fnet.uucp $BINDIR/ifpoll
931
932
933#########################################################
934##### se in syslog.conf non c'e' "local0.*", lo aggiunge
935################################
936
937  SYSLOG="`grep \"local0.*	\" /etc/syslog.conf`"
938  SYSCHECK_A="`echo \"$SYSLOG\" | cut -f1  | grep -x \"local0.*\"`"
939  SYSCHECK_B="`echo \"$SYSLOG\" | cut -f2- | grep $LOGDIR/sysiflog`"
940  MYSYSLOG="local0.*\t\t\t\t\t$LOGDIR/sysiflog"
941
942  if [ ! "$SYSCHECK_A" -o ! "$SYSCHECK_B" ]
943  then
944    echo -e "\n# For ifmail" >> /etc/syslog.conf
945    echo -e "$MYSYSLOG" >>/etc/syslog.conf
946    killall -1 syslogd
947  fi
948
949
950########################
951  save $AREAS
952  :> $AREAS
953  chown fnet.uucp $AREAS
954
955  save $FNETCFG
956  cat <<EOF >$FNETCFG
957# Configuration file for ifmail (ifgate+ifcico) package by Eugene Crosser
958# Compile-time default name of this file may be overridden by -I key.
959#
960# Lines with the first nonblank character '#' are comments.
961#
962# Log file name. Overrides compile-time default.
963logfile  $LOGDIR/iflog
964
965# Debug file name. Overrides compile-time default.
966debugfile $LOGDIR/ifdebug
967
968# Debugging verbosity level (is overidden by -x key). Default is 0.
969# WARNING: if >0 your messages will go in /tmp/ifmail !!!!!!!!!!!!!!!!!!
970verbose  0
971
972# The first is the main address:
973EOF
974#----------------------------
975
976  AKA="any"
977  IAKA=0
978  while [ "$AKA" ]
979  do
980    IAKA=$[$IAKA+1]
981    AKA="`cut $AKASETUP -f$IAKA -d:`"
982    if [ "$AKA" ]
983    then
984      int2fidonet $AKA
985      AKAFTN="`echo $_RETVAL | cut -f1 -d.`"
986      echo "# aka for `echo $AKAFTN | cut -f2 -d '@'`" >> $FNETCFG
987
988      POINT="`echo $POINTS | cut -f$IAKA -d:`"
989
990      AKAFTN="`echo $AKAFTN | cut -f1 -d '@'`.$POINT@`echo $AKAFTN | cut -f2 -d '@'`"
991    
992      echo "address  $AKAFTN" >> $FNETCFG
993    fi
994  done
995
996#----------------------------
997  cat <<EOF >>$FNETCFG
998
999# Passwords for nodes. Not checked by iftoss (unless -DPARANOID specified
1000# at compile-time), checked by ifcico.
1001# Inserted into outgoing mail packets, EMSI and yoohoo packets.
1002EOF
1003#----------------------------
1004
1005  AKA="any"
1006  IAKA=0
1007  while [ "$AKA" ]
1008  do
1009    IAKA=$[$IAKA+1]
1010    AKA="`cut $AKASETUP -f$IAKA -d:`"
1011    if [ "$AKA" ]
1012    then
1013      int2fido $AKA
1014      AKAFTN=$_RETVAL
1015
1016      PASSWD="`echo $PASSWDS | cut -f$IAKA -d:`"
1017      if [ "$PASSWD" ]
1018      then
1019        echo "password $AKAFTN $PASSWD" >> $FNETCFG
1020      fi
1021    fi
1022  done
1023
1024#----------------------------
1025  cat <<EOF >>$FNETCFG
1026
1027# Include config extention file (here: file with real passwords).
1028# Includes may be nested. If the nesting is cyclic, the program cycles too.
1029# You are warned.
1030# include  $CFGDIR/passwds
1031
1032# System alias file - try to fetch ftn-style aliases from there.
1033# If "from" address of a message from FidoNet matches _right_ side
1034# of some entry in sysalias file, then the Reply-To: header is created
1035# in the RFC message with the name part taken from the left side of the
1036# sysalis entry and domain part taken from myfqdn (below). E.g., if a 
1037# fidonet message comes from "John Smith of 1:234/567.89@fidonet" and 
1038# there is an entry in the sysalias file:
1039# "jsmith: John.Smith@p89.f567.n234.z1.fidonet.org"
1040# and fqdn value is "pccross.msk.su", then the resulting message will
1041# contain a line: "Reply-To: jsmith@pccross.msk.su".
1042sysalias /etc/aliases
1043
1044# This host fully qualified domain name to add to the alias above
1045myfqdn  `hostname -f`
1046
1047# Directory for incoming packets/files:
1048inbound  /var/spool/ifmail/inb
1049# Directories for "listed" and "protected" sessions
1050listinbound /var/spool/ifmail/inb
1051protinbound /var/spool/ifmail/inb
1052
1053# Directory for outgoing packets (default domain and zone):
1054# other zones will be like "/var/spool/ifmail/outb.003",
1055# other domains will be like "/var/spool/ifmail/<domain>.<zone>"
1056outbound /var/spool/ifmail/outb
1057
1058# Directory from which the file requests are satisfied
1059public  /var/spool/uucppublic
1060
1061# Directory with executables to satisfy "magic" file requests
1062# if requested a file present in this directory, it will be
1063# executed and stdout sent to the remote system. It is dangerous!
1064# You are warned.
1065magic  $BINDIR/magic
1066
1067# Primary nodelist (serves "outbound" directory and domain from the
1068# first "address" statement). Name expanded with ".NNN" if neccessary.
1069nodelist /var/spool/ifmail/nl.d/`cut $AKASETUP -f1 -d: | cut -f4 -d.`.ndl
1070
1071# Secondary nodelists and nodelists for other domains.
1072# use directory name from the first "nodelist" statement.
1073#           filename          originating address
1074EOF
1075#----------------------------
1076
1077  AKA="any"
1078  IAKA=0
1079  while [ "$AKA" ]
1080  do
1081    IAKA=$[$IAKA+1]
1082    AKA="`cut $AKASETUP -f$IAKA -d:`"
1083    if [ "$AKA" ]
1084    then
1085      int2fidonet $AKA
1086      AKAFTN="`echo $_RETVAL | cut -f1 -d.`"
1087      echo -e "nodelist  `echo $AKAFTN | cut -f2 -d '@'`.ndl\t$AKAFTN" >> $FNETCFG
1088    fi
1089  done
1090
1091#----------------------------
1092  cat <<EOF >>$FNETCFG
1093
1094# domain translations, just context substitution.  Leading dot recommended.
1095# May contain '@'-sign too.  First matching used.
1096# NOTE: If you specify at least one domtrans line, there will be _NO_
1097# default for fidonet <--> fidonet.org.  Don't forget to specify it
1098# explicitly as a last line.
1099#  		FTN side  			Internet side
1100#domtrans	f720.n335.z2.fidonet.org	giuda.deis.unical.it
1101#domtrans	.fidonet			.fidonet.org
1102
1103# Automatically updated alias database.  If omitted or inaccessible,
1104# ^aREPLYADDR and ^aREPLYTO kludges are generated in fido messages.
1105database	/var/spool/ifmail/ifdbm
1106
1107# Sequencer file (used to generate unique IDs)
1108sequencer	/var/spool/ifmail/seq
1109
1110# Areas file (format: "AREA newsgroup distribution")
1111areas		$CFGDIR/Areas
1112
1113# Bad groups prefixes - do not pass to fido if appear in Newsgroups header
1114# This is NOT the same as "!news.group" in the cnews "sys" file.
1115# badgroup relcom.ads.
1116# badgroup relcom.commerce.
1117
1118# Maximum allowed number of groups in the Newsgroups header, article will
1119# not be gated if exeeds.  If zero or umitted - no limit.
1120# maxgroup    5
1121
1122# Internet -> FidoNet (outgoing) character mapping table (a la mapchan)
1123# outtab  $BINDIR/outkoi8alt
1124
1125# FidoNet -> Internet (incoming) character mapping table
1126# intab  $BINDIR/outaltkoi8
1127
1128# Toss program, used by ifunpack
1129iftoss  $BINDIR/iftoss
1130
1131EOF
1132
1133  cat copi.ifmcfg2 >>$FNETCFG
1134
1135  if [ $[$[SPD] > $[19200]] = 1 ]; then
1136    SPDLOCK="L38400"
1137  elif [ $[$[SPD] > $[9600]] = 1 ]; then
1138    SPDLOCK="L19200"
1139  elif [ $[$[SPD] > $[2400]] = 1 ]; then
1140    SPDLOCK="9600"
1141  elif [ $[$[SPD] > $[1200]] = 1 ]; then
1142    SPDLOCK="2400"
1143  elif [ $[$[SPD] > $[300]] = 1 ]; then
1144    SPDLOCK="1200"
1145  else
1146    SPDLOCK="300"
1147  fi
1148
1149  echo "ModemPort modem:$SPDLOCK" >>$FNETCFG
1150  cat copi.ifmcfg5 >>$FNETCFG
1151
1152  echo "PhoneTrans $COUNTRYPREF-$PREF-	/" >>$FNETCFG
1153  echo "PhoneTrans $COUNTRYPREF-		/ $LONG_DIST_PREFIX" >>$FNETCFG
1154  echo "PhoneTrans		/ $INTERCOUNTRYPREF" >>$FNETCFG
1155  echo "ModemReset ATZ\r" >>$FNETCFG
1156  echo "ModemDial \d$DIALSTRING\T\r" >>$FNETCFG
1157
1158  cat copi.ifmcfg4 >>$FNETCFG
1159
1160  echo "Name		$SYSNAME" >>$FNETCFG
1161  echo "Location	$LOCATION" >>$FNETCFG
1162  echo "SysOp		$SYSOP" >>$FNETCFG
1163  echo "Phone		$COUNTRYPREF-$PREF-$PHONE" >>$FNETCFG
1164  echo "Speed		$SPD" >>$FNETCFG
1165  echo "Flags		$NODEFLAGS" >>$FNETCFG
1166
1167  chown fnet.uucp $FNETCFG
1168}
1169
1170# Args: cfg_dir
1171configure_smail() {
1172  dialog --backtitle "$TITLE" --infobox "Configuro Smail..." 0 0
1173
1174  USER="`cat $COPIUSER`"
1175  FNETHOME=~fnet
1176
1177  SMAIL=$1
1178  SMAILCONF=$SMAIL/config
1179  ALIASES=$SMAIL/aliases
1180  DIRECTORS=$SMAIL/directors
1181  ROUTERS=$SMAIL/routers
1182  TRANSPORTS=$SMAIL/transports
1183  FTNPATHS=$SMAIL/ftnpaths
1184
1185# File: config
1186  save $SMAILCONF
1187
1188  cat <<EOF >$SMAILCONF
1189#
1190#       smail configuration for $HOST.$DOMAIN
1191# (see smail(5) man page for details and other options)
1192#
1193hostnames=$HOST:$HOST.$DOMAIN
1194domains=$DOMAIN
1195postmaster=$USER
1196smtp_banner="\$primary_name Linux Smail\$version #\$compile_num ready at \$date"
1197spool_mode=0600
1198received_field="Received: \\
1199	\${if def:sender_host \\
1200		{from \$sender_host by \$primary_name \\
1201		\${if def:sender_proto: with \$sender_proto}\\
1202		\n\t(Linux Smail\$version #\$compile_num) }\\
1203	else{by \$primary_name \${if def:sender_proto:with \$sender_proto }\\
1204		(Linux Smail\$version #\$compile_num)\n\t}}\\
1205	id \$message_id; \$spool_date"
1206trusted_users=root:uucp:daemon:fnet
1207EOF
1208
1209
1210# File: routers
1211  save $ROUTERS
1212
1213  cat <<EOF >$ROUTERS
1214ifmail: driver=pathalias,
1215	transport=ifmail;
1216
1217	file=ftnpaths,
1218	proto=lsearch,
1219	domain=ftn:org
1220EOF
1221
1222
1223# File: transports
1224  save $TRANSPORTS
1225
1226  cat <<EOF >$TRANSPORTS
1227local:	driver = appendfile,
1228	return_path,
1229	local,
1230	from,
1231	unix_from_hack;
1232
1233	file = /var/spool/mail/\${lc:user},
1234	group = mail,
1235	mode = 0660,
1236	suffix = "\n",
1237	append_as_user
1238
1239ifmail: driver=pipe,
1240	from,
1241	-received,
1242	max_addrs=5,
1243	max_chars=200;
1244
1245	pipe_as_sender,
1246	cmd="$FNETHOME/ifmail -r\$host \$((\${strip:user})\$)"
1247
1248EOF
1249
1250
1251# File: directors
1252  save $DIRECTORS
1253
1254
1255# File: aliases
1256  for i in $ALIASES /etc/aliases /usr/lib/aliases
1257  do
1258    if [ ! -L $i -a -f $i ]
1259    then
1260      mv $i $i~
1261    fi
1262  done
1263
1264  USERNAME="`cut /etc/passwd -f1,5 -d: | grep $USER: | cut -f2 -d: | sed y/\" \"/./`"
1265  echo "news: $USER" >> $ALIASES
1266  echo "usenet: $USER" >> $ALIASES
1267  echo "$USERNAME: $USER" >> $ALIASES
1268
1269  ln -sf $ALIASES /etc/
1270  ln -sf $ALIASES /usr/lib/
1271
1272  cd $SMAIL	# is this necessary?? E-mail me if you know,please
1273  mkaliases >/dev/null
1274
1275# File: ftnpaths
1276  save $FTNPATHS
1277
1278  OK=1
1279  IAKA=1
1280  while [ $OK != 0 ]; do
1281    AKA="`cut $AKASETUP -f$IAKA -d:`"
1282    IAKA=$[$IAKA+1]
1283    if [ ! "$AKA" ]; then
1284      OK=0
1285    else
1286      echo -e ".`echo $AKA | cut -f4 -d.`\t\t$AKA!%s" >>$FTNPATHS
1287    fi
1288  done
1289
1290
1291# misc section
1292
1293  chmod 1775 /var/spool/mail
1294  chgrp mail /var/spool/mail
1295
1296  cd $SMAIL
1297  touch forward
1298  /usr/lib/smail/mkdbm forward
1299
1300# reload sendmail
1301  killall sendmail 2>/dev/null
1302  /usr/sbin/sendmail -bd -q15m 	# if inetd handles smtp port, this will not load
1303}
1304