/contrib/dialog/samples/copifuncs/copi.funcs

https://bitbucket.org/freebsd/freebsd-head/ · Bash · 1303 lines · 1059 code · 244 blank · 0 comment · 0 complexity · 4aa5a83645dd6827cd51f3374d85fd83 MD5 · raw file

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