1#!/bin/bash 2# $Id: copismall,v 1.8 2010/01/13 10:26:52 tom Exp $ 3# 4# ComeOn Point Installer! v0.9a.small (small version for cdialog v0.9a) 5# - installa il point in modo visuale e auto-detecting. Versione light. 6# 7# AUTHOR: Beppe (beppe.dem@nsm.it) 8# 9# This program is free software; you can redistribute it and/or 10# modify it under the terms of the GNU General Public License 11# as published by the Free Software Foundation; either version 2 12# of the License, or (at your option) any later version. 13# 14# This program is distributed in the hope that it will be useful, 15# but WITHOUT ANY WARRANTY; without even the implied warranty of 16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17# GNU General Public License for more details. 18# 19# You should have received a copy of the GNU General Public License 20# along with this program; if not, write to the Free Software 21# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22# 23 24# THIS IS NOT THE ORIGINAL VERSION!!!! This files was adequate to be 25# a demo for cdialog v0.9a+. However it doesn't include all its features. 26# Look for one of the free ComeOn Linux! tools to have a complete 27# demo of cdialog. ComeOn Linux! follows the GNU philosophy. 28# Send peacefully a mail to demarco_p@abramo.it for more info. 29 30. ./setup-vars 31 32#COMEONDIR=/usr/lib/ComeOn 33#POINTDIR=$COMEONDIR/point 34POINTDIR=`pwd` 35 36AKASETUP=$POINTDIR/.akasetup 37PNTSETUP=$POINTDIR/.pntsetup 38EMSIFILE=$POINTDIR/.emsi 39COPIUSER=$POINTDIR/.copi.user 40COPIVER=v0.9a.small 41TITLE="ComeOn Point Installer! $COPIVER -+- (c) 1996 ComeOn Linux!" 42 43#FUNCSVER=v0.9.2 44#FUNCSDIR=$POINTDIR/funcs-$FUNCSVER 45FUNCSDIR=$POINTDIR/copifuncs 46 47#COPIDIR=$POINTDIR/copi-$COPIVER 48#. $COPIDIR/copishellvars 49 50#POINTVER="v1.1" # ComeOn Point version 51 52if [ $LOGNAME != root ] 53then 54 $DIALOG --backtitle "$TITLE" --title "Error!" --beep --msgbox "Questo programma per funzionare correttamente deve essere avviato dall'amministratore di sistema (root)." 0 0 55 exit 56fi 57 58 59$DIALOG --backtitle "$TITLE" --title "Are you sure?" --cr-wrap --msgbox "Questo installer procedera' in modalita' 60auto-detect all'installazione del point. 61Premi <Enter> per iniziare o <Esc> per uscire. " 0 0 62 63if [ $? = $DIALOG_CANCEL -o $? = $DIALOG_ESC ]; then 64 exit 65fi 66 67 68pushd $FUNCSDIR >/dev/null 69. ./copi.funcs 70. ./common.funcs 71. ./admin.funcs 72 73############################################################################### 74find_incompatible_packages 75 76if [ "$PKG_TO_REMOVE" ] 77then 78 $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 79 exit 80fi 81 82############################################################################### 83mkstemp dialog 84 85find_necessary_packages 86 87if [ "$PKG_TO_INSTALL" ] 88then 89 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 90 91 if [ "`echo $PKG_TO_INSTALL | grep tcpip`" ] 92 then 93 echo -n " Ricordarsi poi di effettuare lo shutdown per rendere effettive le modifiche." >>$tmp_dialog 94 fi 95 96 $DIALOG --backtitle "$TITLE" --beep --title "Problem detected" --msgbox "`cat $tmp_dialog`" 0 0 97 98 rm $tmp_dialog 99 exit 100fi 101 102############################################################################### 103mkstemp smailp 104 105SMAILTGZ="" 106if [ ! -d /usr/lib/smail ] 107then 108 $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 109 SMAILTGZ="`cat $tmp_smailp`" 110 rm $tmp_smailp 111 while [ ! -f "$SMAILTGZ" ] 112 do 113 $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 114 SMAILTGZ="`cat $tmp_smailp`" 115 rm $tmp_smailp 116 done 117fi 118 119############################################################################### 120mkstemp target 121mkstemp asetup 122mkstemp psetup 123 124AKA="" 125while [ ! "$AKA" ] 126do 127 $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 128 AKAFTN="`cat $tmp_target`" 129 rm $tmp_target 130 fidonetpoint2int $AKAFTN 131 AKA="$_RETVAL" 132done 133echo -n "`echo $AKA | cut -f2- -d.`:" >$tmp_asetup 134echo -n "`echo $AKA | cut -f1 -d. | cut -c2-`:" >$tmp_psetup 135AKASFTN="$AKAFTN" 136AKAS="$AKA" 137while [ "$AKAFTN" ] 138do 139 $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 140 AKAFTN="`cat $tmp_target`" 141 rm $tmp_target 142 if [ "$AKAFTN" ] 143 then 144 fidonetpoint2int $AKAFTN 145 AKA="$_RETVAL" 146 if [ "`echo $AKAS | grep \".\`echo $AKA | cut -f5 -d.\`.\"`" ] 147 then 148 $DIALOG --backtitle "$TITLE" --beep --title "Invalid address" --msgbox "Non si possono avere piu' indirizzi sullo stesso dominio (net)." 0 0 149 else 150 AKASFTN="$AKASFTN $AKAFTN" 151 AKAS="$AKAS $AKA" 152 echo -n "`echo $AKA | cut -f2- -d.`:" >>$tmp_asetup 153 echo -n "`echo $AKA | cut -f1 -d. | cut -c2-`:" >>$tmp_psetup 154 fi 155 fi 156done 157echo ":" >>$tmp_asetup 158echo ":" >>$tmp_psetup 159save $AKASETUP 160save $PNTSETUP 161mv $tmp_asetup $AKASETUP 162mv $tmp_psetup $PNTSETUP 163 164############################################################################### 165mkstemp hostnm 166 167$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 168NEW_HOSTNAME="`cat $tmp_hostnm`" 169rm $tmp_hostnm 170 171############################################################################### 172mkstemp master 173 174$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 175POST_USER="`cut $tmp_master -f1`" 176POST_NAME="`cut $tmp_master -f2`" 177POST_EDIT="`cut $tmp_master -f3`" 178rm $tmp_master 179save $COPIUSER 180echo $POST_USER >$COPIUSER 181 182############################################################################### 183mkstemp expire 184mkstemp origin 185 186$DIALOG --backtitle "$TITLE" --title "Origin" --inputbox "Scegliere l'Origin del sistema" 9 60 "$POST_USER's linux box" 2>$tmp_origin 187NEW_ORIGIN="`cat $tmp_origin`" 188rm $tmp_origin 189 190$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 191KEEPDAYS="`cat $tmp_expire`" 192rm $tmp_expire 193 194############################################################################### 195mkstemp dialer 196mkstemp ifmail 197mkstemp mailvr 198mkstemp passwd 199 200IFMAILTGZ="" 201IFMAILVERS="" 202if [ ! -d /usr/lib/ifmail -o ! -d /etc/ifmail -o ! -d /var/log/ifmail -o ! -f /usr/lib/ifmail/ifcico ] 203then 204 $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 205 IFMAILTGZ="`cat $tmp_ifmail`" 206 rm $tmp_ifmail 207 while [ ! -f "$IFMAILTGZ" ] 208 do 209 $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 210 IFMAILTGZ="`cat $tmp_ifmail`" 211 rm $tmp_ifmail 212 done 213 214 $DIALOG --backtitle "$TITLE" --title "ifmail version" --inputbox "Specificare la versione di ifmail" 0 0 "2.8b" 2>$tmp_mailvr 215 IFMAILVERS="`cat $tmp_mailvr` + ComeOn Point $POINTVER" 216 rm $tmp_mailvr 217fi 218 219IAKA=1 220PASSW="" 221AKA="`cut $AKASETUP -f$IAKA -d:`" 222while [ "$AKA" ] 223do 224 int2fido $AKA 225 AKAFTN="$_RETVAL" 226 $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 227 PASSW="$PASSW`cat $tmp_passwd`:" 228 rm $tmp_passwd 229 IAKA=$[$IAKA+1] 230 AKA="`cut $AKASETUP -f$IAKA -d:`" 231done 232PASSW="$PASSW:" 233 234$DIALOG --backtitle "$TITLE" \ 235--title "Modem speed" --inputbox "Specificare la velocita' del proprio modem (che sta su /dev/modem)" 0 0 "16800" --and-widget \ 236--title "System name" --inputbox "Specificare il nome del sistema per il pacchetto EMSI" 0 0 "`cat $COPIUSER`'s linux point" --and-widget \ 237--title "Location" --inputbox "Inserire la localita' fisica in cui risiede il sistema" 0 0 "Catanzaro, Italy - Europe" --and-widget \ 238--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 \ 239--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 \ 240--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 \ 241--title "Pointlist flags" --inputbox "Inserire eventuali flags stile pointlist per il pacchetto EMSI" 0 0 "MO,V32B,V42B,ZYX" --and-widget \ 242--title "Modem dialing" --inputbox "Inserire la stringa da inviare al modem per comporre un numero telefonico" 0 0 "ATDT" 2>$tmp_dialer 243 244echo -en "\t$POST_NAME\t\t" >>$tmp_dialer 245save $EMSIFILE 246mv $tmp_dialer $EMSIFILE 247 248############################################################################### 249 250if [ -d /etc/smail ] 251then 252 SMAILCFGDIR=/etc/smail 253else 254 SMAILCFGDIR=/usr/lib/smail 255fi 256 257############################################################################### 258 259$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 260 261############################################################################### 262 263killall sendmail 2>/dev/null 264if [ $SMAILTGZ ]; then tar zxvf $SMAILTGZ -C / >/dev/null; fi 265/usr/sbin/sendmail -bd -q15m 266 267if [ ! "`ping -c1 $NEW_HOSTNAME | grep \"1 packets received\"`" ]; then 268 configure_loopback $NEW_HOSTNAME 269fi 270 271add_postmaster "$POST_USER" "$POST_NAME" 272add_alias "$POST_NAME" "$POST_USER" 273configure_trn "$POST_USER" "$POST_EDIT" 274configure_elm "$POST_USER" "$POST_EDIT" 275 276comment_nntp_in_inetdconf 277set_organization "$NEW_ORIGIN" 278create_innconf_newsfeeds_distrib 279create_expirectl $KEEPDAYS 280create_nnrpaccess 281create_hostsnntp 282create_dirs_and_files 283install_rcnews 284install_crontab_news 285if [ $IFMAILTGZ ]; then 286 install_ifmail "$IFMAILTGZ" /usr/lib/ifmail /etc/ifmail /var/log/ifmail "$IFMAILVERS" /usr/src 287fi 288configure_ifmail /usr/lib/ifmail /etc/ifmail /var/log/ifmail "$PASSW" 289configure_smail $SMAILCFGDIR 290 291############################################################################### 292$DIALOG --backtitle "$TITLE" \ 293--title "-=[ Enjoy! ]=-" --msgbox "Il point e' stato installato con successo!" 0 0 --and-widget \ 294--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 295 296popd >/dev/null 297