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...
6 # AUTHOR: Beppe (beppe.dem@nsm.it)
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.
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.
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.
25 PKTNAME="ComeOn Point Installer!"
26 COMEONDIR=/usr/lib/ComeOn
28 AKASETUP=$COMEONDIR/point/.akasetup
29 COPIUSER=$COMEONDIR/point/.copi.user
30 EMSIFILE=$COMEONDIR/point/.emsi
31 PNTSETUP=$COMEONDIR/point/.pntsetup
34 eval 'tmp_'$1'=`tempfile 2>/dev/null` || tmp_'$1'=/tmp/'$1'$$'
47 while [ "`cut -f3 -d: /etc/passwd | grep -x $FOUND_UID`" ]
49 FOUND_UID=$[$FOUND_UID+1]
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-`"
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.`"
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:`"
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@`"
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"
87 configure_loopback() {
88 dialog --backtitle "$TITLE" --infobox "Configuro la rete (in modo loopback)..." 0 0
91 HOST=`echo $FQDN | cut -f1 -d.`
92 DOMAIN=`echo $FQDN | cut -f2- -d.`
95 echo $FQDN >/etc/HOSTNAME
99 save /etc/rc.d/rc.inet1
100 cat <<EOF >/etc/rc.d/rc.inet1
103 # rc.inet1 This shell script boots up the base INET system.
105 # Attach the loopback device.
106 /sbin/ifconfig lo 127.0.0.1
107 /sbin/route add -net 127.0.0.0
111 chmod 755 /etc/rc.d/rc.inet1
115 cat <<EOF >/etc/networks
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.
126 chmod 644 /etc/networks
130 cat <<EOF >/etc/hosts
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...
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. :^)
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.
147 127.0.0.1 localhost $FQDN $HOST
153 save /etc/resolv.conf
154 echo domain $DOMAIN >/etc/resolv.conf
155 chmod 644 /etc/resolv.conf
158 cat <<EOF >/etc/host.conf
162 chmod 644 /etc/host.conf
167 # Private function, adds an user to a group. Args: user, group
170 if [ ! "`groups \"$1\" | grep \" $2 \"`" ]
172 USERS="`grep \"$2:\" /etc/group | cut -s -f4 -d:`"
175 if [ "$USERS" ]; then
176 sed "/$2:/s/:$USERS/:$USERS,$1/" /etc/group >$tmp_group
178 sed "/$2:/s/:/:$1/3" /etc/group >$tmp_group
182 mv $tmp_group /etc/group
186 # Arguments: user, fullname
188 dialog --backtitle "$TITLE" --infobox "Creo l'user principale e/o ne adatto le informazioni..." 0 0
192 HOMEDIR="/home/$USER"
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:`"
198 OLDNAME="`echo $ENTRY | cut -f3 -d:`"
199 PASW="`echo $ENTRY | cut -f2 -d:`"
200 if [ "$OLDNAME" != "$NAME" ]
203 sed "/$USER:$PASW:/s/:$OLDNAME:/:$NAME:/" /etc/passwd >$tmp_passwd
205 mv $tmp_passwd /etc/passwd
208 add_to_group "$USER" mail
210 if [ -f /bin/bash ]; then USERSHELL=/bin/bash; else USERSHELL=""; fi
212 echo "$USER:*:$FOUND_UID:12:$NAME:$HOMEDIR:$USERSHELL" >>/etc/passwd
213 mkdir -p $HOMEDIR -m 755
214 chown $USER.mail $HOMEDIR
218 comment_nntp_in_inetdconf() {
219 dialog --backtitle "$TITLE" --infobox "Commento la riga 'nntp' in /etc/inetd.conf..." 0 0
222 sed "/in.nntpd/s/nntp/#&/" /etc/inetd.conf >$tmp_inetd
224 mv $tmp_inetd /etc/inetd.conf
230 dialog --backtitle "$TITLE" --infobox "Imposto l' origin..." 0 0
232 ORGANIZATION=/etc/organization
235 NEW_ORGANIZATION="$1"
236 echo "$NEW_ORGANIZATION" >$ORGANIZATION
239 create_innconf_newsfeeds_distrib() {
240 dialog --backtitle "$TITLE" --infobox "Creo i files di configurazione principali di InterNet News (inn)..." 0 0
243 INNCONF=~news/inn.conf
248 ## inn.conf -- inn configuration data
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.
265 server: $HOST.$DOMAIN
271 chown news.news $INNCONF
275 NEWSFEEDS=~news/newsfeeds
278 echo -e "ME:*::\n" >$NEWSFEEDS
284 AKA="`cut $AKASETUP -f$IAKA -d:`"
291 TMPAKA="`echo $AKA | cut -f-4 -d.`"
292 SENDCRON="$SENDCRON $TMPAKA"
293 echo -n "$TMPAKA/" >>$NEWSFEEDS
295 TMPAKA="`echo $AKA | cut -f1-2 -d.`"
296 if [ $IAKA = 1 ]; then
297 SENDCRON="$SENDCRON $TMPAKA"
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
307 chown news.news $NEWSFEEDS
311 DISTRIB=~news/distrib.pats
316 while [ "$OK" != 0 ]; do
317 AKA="`cut $AKASETUP -f$IAKA -d:`"
319 if [ "$AKA" = "" ]; then
322 DOM="`echo $AKA | cut -f4 -d.`"
323 echo "10:$DOM.*:$DOM" >>$DISTRIB
328 chown news.news $DISTRIB
333 dialog --backtitle "$TITLE" --infobox "Imposto il periodo di transito dei messaggi..." 0 0
335 EXPIRECTL=~news/expire.ctl
340 echo -e "/remember/:14\n\n*:A:2:$EXPIRE_DAYS:$EXPIRE_DAYS" >$EXPIRECTL
343 chown news.news $EXPIRECTL
346 create_nnrpaccess() {
347 dialog --backtitle "$TITLE" --infobox "Rendo accessibili le news in lettura..." 0 0
349 NNRPACCESS=~news/nnrp.access
352 cat <<EOF >$NNRPACCESS
354 ## nnrp.access - access file for on-campus NNTP sites
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.
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:::*
373 localhost.$DOMAIN:Read Post:::*
374 $HOST.$DOMAIN:Read Post:::*
378 chmod 440 $NNRPACCESS
379 chown news.news $NNRPACCESS
383 dialog --backtitle "$TITLE" --infobox "Rendo accessibili le news in scrittura..." 0 0
385 HOSTSNNTP=~news/hosts.nntp
388 cat <<EOF >$HOSTSNNTP
390 ## hosts.nntp - names and addresses that feed us news
394 ## <host> can be a name or IP address; no wildcards. Any hosts not
395 ## listed here are handed off to nnrpd.
402 chown news.news $HOSTSNNTP
405 create_dirs_and_files() {
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/
423 chown uucp.uucp uucppublic
424 chmod 1777 uucppublic
427 touch history history.dir history.pag errlog log
428 chown news.news history* log errlog
429 chmod 664 history* log errlog
432 echo "control 0000000000 0000000001 y" > active
433 echo "junk 0000000000 0000000001 y" >> active
434 chown news.news active
437 echo "control 814573260 usenet" > active.times
438 echo "junk 814573260 usenet" >> active.times
439 chown news.news active.times
443 chown news.news newsgroups
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
451 RCLOCAL=/etc/rc.d/rc.local
452 RCNEWS=~news/etc/rc.news
453 RCLINE="`grep $RCNEWS $RCLOCAL`"
455 if [ ! "$RCLINE" -o `echo $RCLINE | cut -c1` = '#' ]
458 echo -e "\n$RCNEWS" >>$RCLOCAL
461 cp copi.rcnews $RCNEWS
463 chown news.news $RCNEWS
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
470 killall innd 2>/dev/null # make sure it's gone down
474 install_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
478 if [ -f $COPIUSER ]; then
479 POSTMST="`cat $COPIUSER`"
485 save /var/spool/cron/crontabs/news
486 cat <<EOF | crontab - -u news
487 #-------------------------------------------------------------------------------
488 # /var/spool/cron/crontabs/news
493 #===============================================================================
495 # inn-1.4 (Inter Net News)
497 #===============================================================================
499 #-------------------------------------------------------------------------------
500 # Daily housekeeping ... expires news and other things ...
501 #-------------------------------------------------------------------------------
503 51 16 * * * $NEWSHOME/bin/news.daily < /dev/null
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 #-------------------------------------------------------------------------------
510 18 * * * * $NEWSHOME/rnews -U
512 #-------------------------------------------------------------------------------
513 # send news batches to your fidonet(-like) news feeds
514 #-------------------------------------------------------------------------------
516 49 16 * * * $NEWSHOME/send-ifmail$SENDCRON
518 #-------------------------------------------------------------------------------
522 echo $NEWSHOME/send-ifmail$SENDCRON >/etc/point.ifsend
526 # Args: dir_with_sources, bindir, cfgdir, logdir, version
534 SOURCE="$SRCDIR/CONFIG"
535 CONFIGFILE="$CFGDIR/config"
538 # Compile-time configuration for ifmail FidoNet mailer and gateway
539 COPYRIGHT = "Eugene G. Crosser, 1993-1995"
542 # Main configuration file. This default may be overwritten by -I key.
543 CONFIGFILE = $CONFIGFILE
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.
548 DEBUGFILE = "$LOGDIR/ifdebug"
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.
555 LOGFILE = "$LOGDIR/iflog"
557 # Use syslog() facility codes for mail gate, news gate and ifcico.
558 # Define -DHAS_SYSLOG (see below)
566 # Directory where UUCP lock files reside.
567 #LOCKDIR = "/var/lock"
568 LOCKDIR = "/var/spool/uucp"
570 # Directory from which file requests are resolved.
571 # This may be changed from the 'config' file.
572 #PUBDIR = "/home/ftp/pub"
573 PUBDIR = "/var/spool/uucppublic"
575 # Compile-time system-dependant options.
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.
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.
588 # define -DSCO_STYLE_STATFS if your statfs() call requires 4 arguments.
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.
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.
598 # If you specify "-DDONT_HAVE_GETOPT", local definitions for getopt will
599 # be used (but not the function itself)
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.
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.
608 # for uucp lock files, you must specify either -DASCII_LOCKFILES or
611 # define -DHAS_FSYNC if there is a fsync() system call (to update .flo
614 # define -DPARANOID if you want iftoss to deny packets with wrong password.
616 # define -DRELAXED if you want iftoss to accept packets that are not
617 # addressed to your node.
619 # define -DFORCEINTL if you want ifmail to create ^aINTL even if this is
620 # not an inter-zone netmail.
622 # define -DNEED_UUCPFROM if your MTA needs a uucp "From" line in mail.
624 # define -DHAS_TCP if you want ifmail to be able to originate outgoing
625 # connections over TCP/IP (socket library needed)
627 # define -DHAS_TERM if you want ifmail to be able to originate outgoing
628 # connections over TERM (TCP "extention", client.a needed)
630 # define -DHAS_REGEX_H or -DHAS_LIBGEN_H if you have either of these
631 # header files for regular expression handlers.
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.
637 # define -DNEED_BSY if you want ifpack and ifcico to create .bsy
638 # files preventing simultaneous processing of the same node.
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.
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.
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.
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+)
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.
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
666 OPTS = -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
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 \\
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
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 \\
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 \\
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 \\
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.
713 # for make install, where to put binaries and what owner to set
734 # Linux, 386BSD, SunOS:
735 CFLAGS = -O2 -Wall -m486 -s
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"
749 #LIBS = -lgdbm -lgnuregex
751 #LIBS = -ldbm -lform -lnsl -lsocket -lc -L/usr/ucblib -lucb
753 #LIBS = -ldbm -lsocket -lintl
755 #LIBS = -lcposix -lmalloc -ldbm -linet -lPW
757 INCLUDES = -I\${INCDIR}
759 #INCLUDES = -I/usr/include/rpcsvc -I\${INCDIR}
761 # What programs are absent at your system?
762 #NEEDED = strcasestr.o strncasecmp.o strcasecmp.o rename.o mkdir.o usleep.o \\
769 #NEEDED = strcasestr.o strncasecmp.o strcasecmp.o usleep.o regexpr.o
773 #NEEDED = usleep.o regexpr.o vsyslog.o
778 # Args: package.tgz, bin_dir, cfg_dir, log_dir, version, where_to_put_src
780 dialog --backtitle "$TITLE" --infobox "Installo e compilo Ifmail..." 0 0
782 AKAPRI="`cut $AKASETUP -f1 -d:`"
788 POST="`cat $COPIUSER`"
800 ###################################################
802 ####################################
804 if [ "`cut /etc/passwd -f1 -d: | grep -x fnet`" ]
807 grep -v "fnet:" /etc/passwd >$tmp_passwd
809 mv $tmp_passwd /etc/passwd
813 echo "fnet:*:$FOUND_UID:14:Fidonet Gate:$BINDIR:" >>/etc/passwd
816 ####################################################
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}
824 ##########################################################################
826 ####################################
828 SRC="$SRC/`tar zxvf $TGZ -C $SRC | head -1`"
829 # ora in $SRC c'e' il path completo dei source Ifmail
831 copi.ifmCfg $SRC $BINDIR $CFGDIR $LOGDIR $VERSION
832 patch -N -d $SRC <ifpatch 2>/dev/null
835 ##########################################################################
837 ####################################
842 # Args: bin_dir, cfg_dir, log_dir, passwords
843 # note: passwords are colon-separated (":")
845 dialog --backtitle "$TITLE" --infobox "Configuro Ifmail..." 0 0
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`"
862 COUNTRYPREF="`echo $COMPLETE_PHONE | cut -f1 -d'-'`"
863 PREF="` echo $COMPLETE_PHONE | cut -f2 -d'-'`"
864 PHONE="` echo $COMPLETE_PHONE | cut -f3 -d'-'`"
866 FNETCFG=$CFGDIR/config
869 POINTS="`cat $PNTSETUP`"
870 POST="`cat $COPIUSER`"
871 AKAPRI="`cut $AKASETUP -f1 -d:`"
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" \\
881 cat copi.sendifm2 >>~news/send-ifmail
883 chmod 550 ~news/send-ifmail
884 chown news.news ~news/send-ifmail
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";
893 # change this to the default node, where requests should go to.
894 \$node = "$AKAPRIFTN";
896 cat copi.ifreq2 >>$BINDIR/ifreq
898 chmod 755 $BINDIR/ifreq
899 chown fnet.uucp $BINDIR/ifreq
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
909 cat copi.ifman2 >>$BINDIR/ifman
911 chmod 755 $BINDIR/ifman
912 chown fnet.uucp $BINDIR/ifman
914 #invece di "cp $SRC/misc/contrib/ifpoll $BINDIR"
915 #-----------------------------------------------------------------------------
916 cp copi.ifpoll1 $BINDIR/ifpoll
917 cat <<EOF >>$BINDIR/ifpoll
921 # sysop of fido stuff
924 # my boss node (default address to poll)
927 cat copi.ifpoll2 >> $BINDIR/ifpoll
929 chmod 755 $BINDIR/ifpoll
930 chown fnet.uucp $BINDIR/ifpoll
933 #########################################################
934 ##### se in syslog.conf non c'e' "local0.*", lo aggiunge
935 ################################
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"
942 if [ ! "$SYSCHECK_A" -o ! "$SYSCHECK_B" ]
944 echo -e "\n# For ifmail" >> /etc/syslog.conf
945 echo -e "$MYSYSLOG" >>/etc/syslog.conf
950 ########################
953 chown fnet.uucp $AREAS
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.
960 # Lines with the first nonblank character '#' are comments.
962 # Log file name. Overrides compile-time default.
963 logfile $LOGDIR/iflog
965 # Debug file name. Overrides compile-time default.
966 debugfile $LOGDIR/ifdebug
968 # Debugging verbosity level (is overidden by -x key). Default is 0.
969 # WARNING: if >0 your messages will go in /tmp/ifmail !!!!!!!!!!!!!!!!!!
972 # The first is the main address:
974 #----------------------------
981 AKA="`cut $AKASETUP -f$IAKA -d:`"
985 AKAFTN="`echo $_RETVAL | cut -f1 -d.`"
986 echo "# aka for `echo $AKAFTN | cut -f2 -d '@'`" >> $FNETCFG
988 POINT="`echo $POINTS | cut -f$IAKA -d:`"
990 AKAFTN="`echo $AKAFTN | cut -f1 -d '@'`.$POINT@`echo $AKAFTN | cut -f2 -d '@'`"
992 echo "address $AKAFTN" >> $FNETCFG
996 #----------------------------
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.
1003 #----------------------------
1010 AKA="`cut $AKASETUP -f$IAKA -d:`"
1016 PASSWD="`echo $PASSWDS | cut -f$IAKA -d:`"
1019 echo "password $AKAFTN $PASSWD" >> $FNETCFG
1024 #----------------------------
1025 cat <<EOF >>$FNETCFG
1027 # Include config extention file (here: file with real passwords).
1028 # Includes may be nested. If the nesting is cyclic, the program cycles too.
1030 # include $CFGDIR/passwds
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".
1042 sysalias /etc/aliases
1044 # This host fully qualified domain name to add to the alias above
1045 myfqdn `hostname -f`
1047 # Directory for incoming packets/files:
1048 inbound /var/spool/ifmail/inb
1049 # Directories for "listed" and "protected" sessions
1050 listinbound /var/spool/ifmail/inb
1051 protinbound /var/spool/ifmail/inb
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>"
1056 outbound /var/spool/ifmail/outb
1058 # Directory from which the file requests are satisfied
1059 public /var/spool/uucppublic
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!
1067 # Primary nodelist (serves "outbound" directory and domain from the
1068 # first "address" statement). Name expanded with ".NNN" if neccessary.
1069 nodelist /var/spool/ifmail/nl.d/`cut $AKASETUP -f1 -d: | cut -f4 -d.`.ndl
1071 # Secondary nodelists and nodelists for other domains.
1072 # use directory name from the first "nodelist" statement.
1073 # filename originating address
1075 #----------------------------
1082 AKA="`cut $AKASETUP -f$IAKA -d:`"
1086 AKAFTN="`echo $_RETVAL | cut -f1 -d.`"
1087 echo -e "nodelist `echo $AKAFTN | cut -f2 -d '@'`.ndl\t$AKAFTN" >> $FNETCFG
1091 #----------------------------
1092 cat <<EOF >>$FNETCFG
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
1103 # Automatically updated alias database. If omitted or inaccessible,
1104 # ^aREPLYADDR and ^aREPLYTO kludges are generated in fido messages.
1105 database /var/spool/ifmail/ifdbm
1107 # Sequencer file (used to generate unique IDs)
1108 sequencer /var/spool/ifmail/seq
1110 # Areas file (format: "AREA newsgroup distribution")
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.
1118 # Maximum allowed number of groups in the Newsgroups header, article will
1119 # not be gated if exeeds. If zero or umitted - no limit.
1122 # Internet -> FidoNet (outgoing) character mapping table (a la mapchan)
1123 # outtab $BINDIR/outkoi8alt
1125 # FidoNet -> Internet (incoming) character mapping table
1126 # intab $BINDIR/outaltkoi8
1128 # Toss program, used by ifunpack
1129 iftoss $BINDIR/iftoss
1133 cat copi.ifmcfg2 >>$FNETCFG
1135 if [ $[$[SPD] > $[19200]] = 1 ]; then
1137 elif [ $[$[SPD] > $[9600]] = 1 ]; then
1139 elif [ $[$[SPD] > $[2400]] = 1 ]; then
1141 elif [ $[$[SPD] > $[1200]] = 1 ]; then
1143 elif [ $[$[SPD] > $[300]] = 1 ]; then
1149 echo "ModemPort modem:$SPDLOCK" >>$FNETCFG
1150 cat copi.ifmcfg5 >>$FNETCFG
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
1158 cat copi.ifmcfg4 >>$FNETCFG
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
1167 chown fnet.uucp $FNETCFG
1172 dialog --backtitle "$TITLE" --infobox "Configuro Smail..." 0 0
1174 USER="`cat $COPIUSER`"
1178 SMAILCONF=$SMAIL/config
1179 ALIASES=$SMAIL/aliases
1180 DIRECTORS=$SMAIL/directors
1181 ROUTERS=$SMAIL/routers
1182 TRANSPORTS=$SMAIL/transports
1183 FTNPATHS=$SMAIL/ftnpaths
1188 cat <<EOF >$SMAILCONF
1190 # smail configuration for $HOST.$DOMAIN
1191 # (see smail(5) man page for details and other options)
1193 hostnames=$HOST:$HOST.$DOMAIN
1196 smtp_banner="\$primary_name Linux Smail\$version #\$compile_num ready at \$date"
1198 received_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"
1206 trusted_users=root:uucp:daemon:fnet
1214 ifmail: driver=pathalias,
1226 cat <<EOF >$TRANSPORTS
1227 local: driver = appendfile,
1233 file = /var/spool/mail/\${lc:user},
1239 ifmail: driver=pipe,
1246 cmd="$FNETHOME/ifmail -r\$host \$((\${strip:user})\$)"
1256 for i in $ALIASES /etc/aliases /usr/lib/aliases
1258 if [ ! -L $i -a -f $i ]
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
1269 ln -sf $ALIASES /etc/
1270 ln -sf $ALIASES /usr/lib/
1272 cd $SMAIL # is this necessary?? E-mail me if you know,please
1273 mkaliases >/dev/null
1280 while [ $OK != 0 ]; do
1281 AKA="`cut $AKASETUP -f$IAKA -d:`"
1283 if [ ! "$AKA" ]; then
1286 echo -e ".`echo $AKA | cut -f4 -d.`\t\t$AKA!%s" >>$FTNPATHS
1293 chmod 1775 /var/spool/mail
1294 chgrp mail /var/spool/mail
1298 /usr/lib/smail/mkdbm forward
1301 killall sendmail 2>/dev/null
1302 /usr/sbin/sendmail -bd -q15m # if inetd handles smtp port, this will not load