1217309Snwhitehorn#!/bin/bash 2217309Snwhitehorn# $Id: copismall,v 1.8 2010/01/13 10:26:52 tom Exp $ 3217309Snwhitehorn# 4217309Snwhitehorn# ComeOn Point Installer! v0.9a.small (small version for cdialog v0.9a) 5217309Snwhitehorn# - installa il point in modo visuale e auto-detecting. Versione light. 6217309Snwhitehorn# 7217309Snwhitehorn# AUTHOR: Beppe (beppe.dem@nsm.it) 8217309Snwhitehorn# 9217309Snwhitehorn# This program is free software; you can redistribute it and/or 10217309Snwhitehorn# modify it under the terms of the GNU General Public License 11217309Snwhitehorn# as published by the Free Software Foundation; either version 2 12217309Snwhitehorn# of the License, or (at your option) any later version. 13217309Snwhitehorn# 14217309Snwhitehorn# This program is distributed in the hope that it will be useful, 15217309Snwhitehorn# but WITHOUT ANY WARRANTY; without even the implied warranty of 16217309Snwhitehorn# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17217309Snwhitehorn# GNU General Public License for more details. 18217309Snwhitehorn# 19217309Snwhitehorn# You should have received a copy of the GNU General Public License 20217309Snwhitehorn# along with this program; if not, write to the Free Software 21217309Snwhitehorn# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22217309Snwhitehorn# 23217309Snwhitehorn 24217309Snwhitehorn# THIS IS NOT THE ORIGINAL VERSION!!!! This files was adequate to be 25217309Snwhitehorn# a demo for cdialog v0.9a+. However it doesn't include all its features. 26217309Snwhitehorn# Look for one of the free ComeOn Linux! tools to have a complete 27217309Snwhitehorn# demo of cdialog. ComeOn Linux! follows the GNU philosophy. 28217309Snwhitehorn# Send peacefully a mail to demarco_p@abramo.it for more info. 29217309Snwhitehorn 30217309Snwhitehorn. ./setup-vars 31217309Snwhitehorn 32217309Snwhitehorn#COMEONDIR=/usr/lib/ComeOn 33217309Snwhitehorn#POINTDIR=$COMEONDIR/point 34217309SnwhitehornPOINTDIR=`pwd` 35217309Snwhitehorn 36217309SnwhitehornAKASETUP=$POINTDIR/.akasetup 37217309SnwhitehornPNTSETUP=$POINTDIR/.pntsetup 38217309SnwhitehornEMSIFILE=$POINTDIR/.emsi 39217309SnwhitehornCOPIUSER=$POINTDIR/.copi.user 40217309SnwhitehornCOPIVER=v0.9a.small 41217309SnwhitehornTITLE="ComeOn Point Installer! $COPIVER -+- (c) 1996 ComeOn Linux!" 42217309Snwhitehorn 43217309Snwhitehorn#FUNCSVER=v0.9.2 44217309Snwhitehorn#FUNCSDIR=$POINTDIR/funcs-$FUNCSVER 45217309SnwhitehornFUNCSDIR=$POINTDIR/copifuncs 46217309Snwhitehorn 47217309Snwhitehorn#COPIDIR=$POINTDIR/copi-$COPIVER 48217309Snwhitehorn#. $COPIDIR/copishellvars 49217309Snwhitehorn 50217309Snwhitehorn#POINTVER="v1.1" # ComeOn Point version 51217309Snwhitehorn 52217309Snwhitehornif [ $LOGNAME != root ] 53217309Snwhitehornthen 54217309Snwhitehorn $DIALOG --backtitle "$TITLE" --title "Error!" --beep --msgbox "Questo programma per funzionare correttamente deve essere avviato dall'amministratore di sistema (root)." 0 0 55217309Snwhitehorn exit 56217309Snwhitehornfi 57217309Snwhitehorn 58217309Snwhitehorn 59217309Snwhitehorn$DIALOG --backtitle "$TITLE" --title "Are you sure?" --cr-wrap --msgbox "Questo installer procedera' in modalita' 60217309Snwhitehornauto-detect all'installazione del point. 61217309SnwhitehornPremi <Enter> per iniziare o <Esc> per uscire. " 0 0 62217309Snwhitehorn 63217309Snwhitehornif [ $? = $DIALOG_CANCEL -o $? = $DIALOG_ESC ]; then 64217309Snwhitehorn exit 65217309Snwhitehornfi 66217309Snwhitehorn 67217309Snwhitehorn 68217309Snwhitehornpushd $FUNCSDIR >/dev/null 69217309Snwhitehorn. ./copi.funcs 70217309Snwhitehorn. ./common.funcs 71217309Snwhitehorn. ./admin.funcs 72217309Snwhitehorn 73217309Snwhitehorn############################################################################### 74217309Snwhitehornfind_incompatible_packages 75217309Snwhitehorn 76217309Snwhitehornif [ "$PKG_TO_REMOVE" ] 77217309Snwhitehornthen 78217309Snwhitehorn $DIALOG --backtitle "$TITLE" --beep --title "Problem detected" --msgbox "Attenzione, prima di poter continuare bisogna avviare pkgtool e rimuovere i seguenti packages: $PKG_TO_REMOVE." 0 0 79217309Snwhitehorn exit 80217309Snwhitehornfi 81217309Snwhitehorn 82217309Snwhitehorn############################################################################### 83217309Snwhitehornmkstemp dialog 84217309Snwhitehorn 85217309Snwhitehornfind_necessary_packages 86217309Snwhitehorn 87217309Snwhitehornif [ "$PKG_TO_INSTALL" ] 88217309Snwhitehornthen 89217309Snwhitehorn echo -n "Attenzione, prima di poter continuare bisogna avviare setup ed installare i seguenti packages dai disk sets N (quelli del Networking): $PKG_TO_INSTALL." >$tmp_dialog 90217309Snwhitehorn 91217309Snwhitehorn if [ "`echo $PKG_TO_INSTALL | grep tcpip`" ] 92217309Snwhitehorn then 93217309Snwhitehorn echo -n " Ricordarsi poi di effettuare lo shutdown per rendere effettive le modifiche." >>$tmp_dialog 94217309Snwhitehorn fi 95217309Snwhitehorn 96217309Snwhitehorn $DIALOG --backtitle "$TITLE" --beep --title "Problem detected" --msgbox "`cat $tmp_dialog`" 0 0 97217309Snwhitehorn 98217309Snwhitehorn rm $tmp_dialog 99217309Snwhitehorn exit 100217309Snwhitehornfi 101217309Snwhitehorn 102217309Snwhitehorn############################################################################### 103217309Snwhitehornmkstemp smailp 104217309Snwhitehorn 105217309SnwhitehornSMAILTGZ="" 106217309Snwhitehornif [ ! -d /usr/lib/smail ] 107217309Snwhitehornthen 108217309Snwhitehorn $DIALOG --backtitle "$TITLE" --title "Smail not found" --inputbox "Bisogna installare Smail, per cui inserire il percorso completo di dove trovarne i binari compressi" 0 0 "/cdrom/sunsite/system/Mail/delivery/smail-linuxbin-3.1.29.1.tar.gz" 2>$tmp_smailp 109217309Snwhitehorn SMAILTGZ="`cat $tmp_smailp`" 110217309Snwhitehorn rm $tmp_smailp 111217309Snwhitehorn while [ ! -f "$SMAILTGZ" ] 112217309Snwhitehorn do 113217309Snwhitehorn $DIALOG --backtitle "$TITLE" --beep --title "Archive not found" --inputbox "Percorso di file \"$SMAILTGZ\" non valido, controllarne la correttezza." 0 0 "/cdrom/sunsite/system/Mail/delivery/smail-linuxbin-3.1.29.1.tar.gz" 2>$tmp_smailp 114217309Snwhitehorn SMAILTGZ="`cat $tmp_smailp`" 115217309Snwhitehorn rm $tmp_smailp 116217309Snwhitehorn done 117217309Snwhitehornfi 118217309Snwhitehorn 119217309Snwhitehorn############################################################################### 120217309Snwhitehornmkstemp target 121217309Snwhitehornmkstemp asetup 122217309Snwhitehornmkstemp psetup 123217309Snwhitehorn 124217309SnwhitehornAKA="" 125217309Snwhitehornwhile [ ! "$AKA" ] 126217309Snwhitehorndo 127217309Snwhitehorn $DIALOG --backtitle "$TITLE" --title "Primary address" --inputbox "Inserire il proprio address principale, completo di point e di domain. Il poll sara' effettuato per default dal boss corrispondente." 0 0 "2:335/722.7@fidonet" 2>$tmp_target 128217309Snwhitehorn AKAFTN="`cat $tmp_target`" 129217309Snwhitehorn rm $tmp_target 130217309Snwhitehorn fidonetpoint2int $AKAFTN 131217309Snwhitehorn AKA="$_RETVAL" 132217309Snwhitehorndone 133217309Snwhitehornecho -n "`echo $AKA | cut -f2- -d.`:" >$tmp_asetup 134217309Snwhitehornecho -n "`echo $AKA | cut -f1 -d. | cut -c2-`:" >$tmp_psetup 135217309SnwhitehornAKASFTN="$AKAFTN" 136217309SnwhitehornAKAS="$AKA" 137217309Snwhitehornwhile [ "$AKAFTN" ] 138217309Snwhitehorndo 139217309Snwhitehorn $DIALOG --backtitle "$TITLE" --title "AKAs" --inputbox "Inserire un eventuale address secondario, oppure lasciare la riga vuota per proseguire. Attenzione: nel caso si abbiano piu' indirizzi sulla stessa rete, bisognera' configurare solo uno di questi. Gli indirizzi correntemente definiti sono: $AKASFTN" 0 0 2>$tmp_target 140217309Snwhitehorn AKAFTN="`cat $tmp_target`" 141217309Snwhitehorn rm $tmp_target 142217309Snwhitehorn if [ "$AKAFTN" ] 143217309Snwhitehorn then 144217309Snwhitehorn fidonetpoint2int $AKAFTN 145217309Snwhitehorn AKA="$_RETVAL" 146217309Snwhitehorn if [ "`echo $AKAS | grep \".\`echo $AKA | cut -f5 -d.\`.\"`" ] 147217309Snwhitehorn then 148217309Snwhitehorn $DIALOG --backtitle "$TITLE" --beep --title "Invalid address" --msgbox "Non si possono avere piu' indirizzi sullo stesso dominio (net)." 0 0 149217309Snwhitehorn else 150217309Snwhitehorn AKASFTN="$AKASFTN $AKAFTN" 151217309Snwhitehorn AKAS="$AKAS $AKA" 152217309Snwhitehorn echo -n "`echo $AKA | cut -f2- -d.`:" >>$tmp_asetup 153217309Snwhitehorn echo -n "`echo $AKA | cut -f1 -d. | cut -c2-`:" >>$tmp_psetup 154217309Snwhitehorn fi 155217309Snwhitehorn fi 156217309Snwhitehorndone 157217309Snwhitehornecho ":" >>$tmp_asetup 158217309Snwhitehornecho ":" >>$tmp_psetup 159217309Snwhitehornsave $AKASETUP 160217309Snwhitehornsave $PNTSETUP 161217309Snwhitehornmv $tmp_asetup $AKASETUP 162217309Snwhitehornmv $tmp_psetup $PNTSETUP 163217309Snwhitehorn 164217309Snwhitehorn############################################################################### 165217309Snwhitehornmkstemp hostnm 166217309Snwhitehorn 167217309Snwhitehorn$DIALOG --backtitle "$TITLE" --title "Hostname" --inputbox "Inserire l'hostname di questo computer qualora si abbia una rete gia' configurata, altrimenti inventarne uno fittizio da assegnare e questa macchina verra' configurata per il loopback." 0 0 "quark.comeon.org" 2>$tmp_hostnm 168217309SnwhitehornNEW_HOSTNAME="`cat $tmp_hostnm`" 169217309Snwhitehornrm $tmp_hostnm 170217309Snwhitehorn 171217309Snwhitehorn############################################################################### 172217309Snwhitehornmkstemp master 173217309Snwhitehorn 174217309Snwhitehorn$DIALOG --backtitle "$TITLE" --title "Point admin" --inputbox "Scegliere l'user principale per la gestione e l'uso del point. Se l'user non esiste, verra' creato. Se esiste, ne verranno adattate le informazioni quali nome, gruppi, etc." 0 0 "beppe" --and-widget --title "Insert SysOp's name" --inputbox "Inserire nome e cognome del gestore ed utilizzatore principale del point (il proprio nome)." 0 0 "Giuseppe De Marco" --and-widget --title "Choose editor" --inputbox "Scegliere l'editor da usare per scrivere i messaggi" 0 0 "vim" 2>$tmp_master 175217309SnwhitehornPOST_USER="`cut $tmp_master -f1`" 176217309SnwhitehornPOST_NAME="`cut $tmp_master -f2`" 177217309SnwhitehornPOST_EDIT="`cut $tmp_master -f3`" 178217309Snwhitehornrm $tmp_master 179217309Snwhitehornsave $COPIUSER 180217309Snwhitehornecho $POST_USER >$COPIUSER 181217309Snwhitehorn 182217309Snwhitehorn############################################################################### 183217309Snwhitehornmkstemp expire 184217309Snwhitehornmkstemp origin 185217309Snwhitehorn 186217309Snwhitehorn$DIALOG --backtitle "$TITLE" --title "Origin" --inputbox "Scegliere l'Origin del sistema" 9 60 "$POST_USER's linux box" 2>$tmp_origin 187217309SnwhitehornNEW_ORIGIN="`cat $tmp_origin`" 188217309Snwhitehornrm $tmp_origin 189217309Snwhitehorn 190217309Snwhitehorn$DIALOG --backtitle "$TITLE" --title "News expiring" --inputbox "Decidere per quanti giorni i messaggi echomail (le news) dovranno transitare sul sistema prima di venire cancellati automaticamente da news.daily. Inserire never se si vuole che non vengano mai cancellati. Sono ammesse cifre decimali (i.e. 25.5). Notare comunque che il valore qui inserito e' quello di default, ma per ogni singola area (newsgroup) sara' possibile specificare poi un valore appropriato." 0 0 "30" 2>$tmp_expire 191217309SnwhitehornKEEPDAYS="`cat $tmp_expire`" 192217309Snwhitehornrm $tmp_expire 193217309Snwhitehorn 194217309Snwhitehorn############################################################################### 195217309Snwhitehornmkstemp dialer 196217309Snwhitehornmkstemp ifmail 197217309Snwhitehornmkstemp mailvr 198217309Snwhitehornmkstemp passwd 199217309Snwhitehorn 200217309SnwhitehornIFMAILTGZ="" 201217309SnwhitehornIFMAILVERS="" 202217309Snwhitehornif [ ! -d /usr/lib/ifmail -o ! -d /etc/ifmail -o ! -d /var/log/ifmail -o ! -f /usr/lib/ifmail/ifcico ] 203217309Snwhitehornthen 204217309Snwhitehorn $DIALOG --backtitle "$TITLE" --title "ifmail not found" --inputbox "Inserire il percorso COMPLETO dei sorgenti compressi di ifmail che verranno decompressi in /usr/src e compilati." 0 0 "/cdrom/sunsite/system/Mail/transport/ifmail-2.8b.tar.gz" 2>$tmp_ifmail 205217309Snwhitehorn IFMAILTGZ="`cat $tmp_ifmail`" 206217309Snwhitehorn rm $tmp_ifmail 207217309Snwhitehorn while [ ! -f "$IFMAILTGZ" ] 208217309Snwhitehorn do 209217309Snwhitehorn $DIALOG --backtitle "$TITLE" --beep --title "invalid filename" --inputbox "Percorso di file \"$IFMAILTGZ\" non valido, controllarne la correttezza." 0 0 "/cdrom/sunsite/system/Mail/transport/ifmail-2.8b.tar.gz" 2>$tmp_ifmail 210217309Snwhitehorn IFMAILTGZ="`cat $tmp_ifmail`" 211217309Snwhitehorn rm $tmp_ifmail 212217309Snwhitehorn done 213217309Snwhitehorn 214217309Snwhitehorn $DIALOG --backtitle "$TITLE" --title "ifmail version" --inputbox "Specificare la versione di ifmail" 0 0 "2.8b" 2>$tmp_mailvr 215217309Snwhitehorn IFMAILVERS="`cat $tmp_mailvr` + ComeOn Point $POINTVER" 216217309Snwhitehorn rm $tmp_mailvr 217217309Snwhitehornfi 218217309Snwhitehorn 219217309SnwhitehornIAKA=1 220217309SnwhitehornPASSW="" 221217309SnwhitehornAKA="`cut $AKASETUP -f$IAKA -d:`" 222217309Snwhitehornwhile [ "$AKA" ] 223217309Snwhitehorndo 224217309Snwhitehorn int2fido $AKA 225217309Snwhitehorn AKAFTN="$_RETVAL" 226217309Snwhitehorn $DIALOG --backtitle "$TITLE" --title "Password" --inputbox "Specificare la password di sessione e per i pacchetti per il nodo $AKAFTN -- attenzione che alcuni mailers accettano solo passwords da 8 caratteri in maiuscolo!!" 0 0 "MYPASSWD" 2>$tmp_passwd 227217309Snwhitehorn PASSW="$PASSW`cat $tmp_passwd`:" 228217309Snwhitehorn rm $tmp_passwd 229217309Snwhitehorn IAKA=$[$IAKA+1] 230217309Snwhitehorn AKA="`cut $AKASETUP -f$IAKA -d:`" 231217309Snwhitehorndone 232217309SnwhitehornPASSW="$PASSW:" 233217309Snwhitehorn 234217309Snwhitehorn$DIALOG --backtitle "$TITLE" \ 235217309Snwhitehorn--title "Modem speed" --inputbox "Specificare la velocita' del proprio modem (che sta su /dev/modem)" 0 0 "16800" --and-widget \ 236217309Snwhitehorn--title "System name" --inputbox "Specificare il nome del sistema per il pacchetto EMSI" 0 0 "`cat $COPIUSER`'s linux point" --and-widget \ 237217309Snwhitehorn--title "Location" --inputbox "Inserire la localita' fisica in cui risiede il sistema" 0 0 "Catanzaro, Italy - Europe" --and-widget \ 238217309Snwhitehorn--title "Phone number" --inputbox "Inserire il proprio numero di telefono in formato internazionale, cioe' completo di doppio prefisso (xx-yyy-zzzzzz)" 0 0 "39-961-31997" --and-widget \ 239217309Snwhitehorn--title "International call prefix" --inputbox "Specificare il prefisso da comporre per poter effettuare una chiamata internazionale (se ci si trova in Italia ad es. bisogna inserire 00)" 0 0 "00" --and-widget \ 240217309Snwhitehorn--title "Long-distance call prefix" --inputbox "Specificare il prefisso da comporre per poter effettuare una chiamata interurbana in ambito nazionale, che verra' sostituito al prefisso della propria nazione quando incontrato in nodelist (per l'Italia ad es. bisogna inserire 0, che sostituira' il 39)" 0 0 "0" --and-widget \ 241217309Snwhitehorn--title "Pointlist flags" --inputbox "Inserire eventuali flags stile pointlist per il pacchetto EMSI" 0 0 "MO,V32B,V42B,ZYX" --and-widget \ 242217309Snwhitehorn--title "Modem dialing" --inputbox "Inserire la stringa da inviare al modem per comporre un numero telefonico" 0 0 "ATDT" 2>$tmp_dialer 243217309Snwhitehorn 244217309Snwhitehornecho -en "\t$POST_NAME\t\t" >>$tmp_dialer 245217309Snwhitehornsave $EMSIFILE 246217309Snwhitehornmv $tmp_dialer $EMSIFILE 247217309Snwhitehorn 248217309Snwhitehorn############################################################################### 249217309Snwhitehorn 250217309Snwhitehornif [ -d /etc/smail ] 251217309Snwhitehornthen 252217309Snwhitehorn SMAILCFGDIR=/etc/smail 253217309Snwhitehornelse 254217309Snwhitehorn SMAILCFGDIR=/usr/lib/smail 255217309Snwhitehornfi 256217309Snwhitehorn 257217309Snwhitehorn############################################################################### 258217309Snwhitehorn 259217309Snwhitehorn$DIALOG --backtitle "$TITLE" --title "First step completed!" --msgbox "OK, ora ho tutte le informazioni necessarie per poter installare il point. Da qui in poi faro' tutto da solo, quindi ci si puo' tranquillamente andare a prendere un caffe'. :-)" 0 0 260217309Snwhitehorn 261217309Snwhitehorn############################################################################### 262217309Snwhitehorn 263217309Snwhitehornkillall sendmail 2>/dev/null 264217309Snwhitehornif [ $SMAILTGZ ]; then tar zxvf $SMAILTGZ -C / >/dev/null; fi 265217309Snwhitehorn/usr/sbin/sendmail -bd -q15m 266217309Snwhitehorn 267217309Snwhitehornif [ ! "`ping -c1 $NEW_HOSTNAME | grep \"1 packets received\"`" ]; then 268217309Snwhitehorn configure_loopback $NEW_HOSTNAME 269217309Snwhitehornfi 270217309Snwhitehorn 271217309Snwhitehornadd_postmaster "$POST_USER" "$POST_NAME" 272217309Snwhitehornadd_alias "$POST_NAME" "$POST_USER" 273217309Snwhitehornconfigure_trn "$POST_USER" "$POST_EDIT" 274217309Snwhitehornconfigure_elm "$POST_USER" "$POST_EDIT" 275217309Snwhitehorn 276217309Snwhitehorncomment_nntp_in_inetdconf 277217309Snwhitehornset_organization "$NEW_ORIGIN" 278217309Snwhitehorncreate_innconf_newsfeeds_distrib 279217309Snwhitehorncreate_expirectl $KEEPDAYS 280217309Snwhitehorncreate_nnrpaccess 281217309Snwhitehorncreate_hostsnntp 282217309Snwhitehorncreate_dirs_and_files 283217309Snwhitehorninstall_rcnews 284217309Snwhitehorninstall_crontab_news 285217309Snwhitehornif [ $IFMAILTGZ ]; then 286217309Snwhitehorn install_ifmail "$IFMAILTGZ" /usr/lib/ifmail /etc/ifmail /var/log/ifmail "$IFMAILVERS" /usr/src 287217309Snwhitehornfi 288217309Snwhitehornconfigure_ifmail /usr/lib/ifmail /etc/ifmail /var/log/ifmail "$PASSW" 289217309Snwhitehornconfigure_smail $SMAILCFGDIR 290217309Snwhitehorn 291217309Snwhitehorn############################################################################### 292217309Snwhitehorn$DIALOG --backtitle "$TITLE" \ 293217309Snwhitehorn--title "-=[ Enjoy! ]=-" --msgbox "Il point e' stato installato con successo!" 0 0 --and-widget \ 294217309Snwhitehorn--msgbox "trn (il newsreader, per leggere/scrivere gli echomail) ed elm (il mailreader, per leggere/scrivere i netmail) sono gia' stati configurati per l'user $POST_USER." 0 0 295217309Snwhitehorn 296217309Snwhitehornpopd >/dev/null 297