#Verifico si hay algo instalado
#busco en el archivo afinstal.conf (desde donde???) por ahora desde el home
-afinstal=`find $HOME -name -type f 'afinstal.conf'`
+afinstal=`find $HOME -name 'afinstal.conf'`
if [ -n "$afinstal" ]; then
#busco paquetes instalados. Leo afinstal.conf para ver que hay
+ #como el archivo existe, tiene que tener alguna info almacenada..
+ instdir=`cat $afinstal | grep -n INSTDIR | grep 1 | sed s/\.\*\=\ //`
+ confdir=`cat $afinstal | grep -n CONFDIR | grep 2 | sed s/\.\*\=\ //`
#Busco los binarios
comp=0
+ anti=0
+ afic=0
+ afim=0
bindir=`cat $afinstal | grep -n BINDIR | grep 11 | sed s/\.\*\=\ //`
+ logdir=`cat $afinstal | grep -n LOGDIR | grep 12 | sed s/\.\*\=\ //`
+ logname=`cat $afinstal | grep -n LOGNAME | grep 13 | sed s/\.\*\=\ //`
+ logsize=`cat $afinstal | grep -n BINDIR | grep 14 | sed s/\.\*\=\ //`
+
+ # Si habia algo instalado, la informacion del los directorios quedo
+ # almacenada, pues es igual para todos los scripts. Excepto el directorio de
+ # datos para antifraude.
+
if [ ! -f "$bindir""antifraude.pl" ]; then
#instalo antifraude porque no existe
echo "Instalando Antifraude..."
- comp=$(($comp + 1))
+ anti=1
+ cp "$instdir/antifraude.pl" "$bindir/antifraude.pl"
fi
if [ ! -f "$bindir""aficonf" ]; then
#instalo aficonf porque no existe
echo "Instalando Aficonf..."
- comp=$(($comp + 1))
+ afic=1
+ cp "$instdir/aficonf" "$bindir/aficonf"
fi
if [ ! -f "$bindir""afimonio" ]; then
#instalo afimonio porque no existe
echo "Instalando Afimonio..."
- comp=$(($comp + 1))
+ afim=1
+ cp "$instdir/afimonio" "$bindir/afimonio"
+ fi
+ #hay que loguear lo que se instalo
+ comp=$(($anti + $afic + $afim))
+ if [ $anti != 0 ]; then
+ echo "Ingrese la ruta completa para el directorio de datos"
+ read datadir
+ while [ ! -d "$datadir" ]; do
+ echo "La ruta especificada no existe, ingrese un directorio existente"
+ read datadir
+ done
+ echo "Ingrese tamaño máximo de datos"
+ read datasize
+ fecha=$(date)
+ cat "$confdir/afinstal.conf" | sed "10s/.*/Comando antifraude.pl/" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "11s(.*(BINDIR = $bindir(" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "12s(.*(LOGDIR = $logdir(" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "13s(.*(LOGNAME = $logname(" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "14s(.*(LOGSIZE = $logsize(" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "15s(.*(DATADIR = $datadir(" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "16s(.*(DATASIZE = $datasize(" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "17s(.*(USERID = $USER(" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "18s(.*(FECINS = $fecha(" > "$confdir/afinstal.conf"
+ fi
+ if [ $afic != 0 ]; then
+ fecha=$(date)
+ cat "$confdir/afinstal.conf" | sed "20s/.*/Comando aficonf/" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "21s(.*(BINDIR = $bindir(" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "22s(.*(LOGDIR = $logdir(" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "23s(.*(LOGNAME = $logname(" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "24s(.*(LOGSIZE = $logsize(" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "25s(.*(USERID = $USER(" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "26s(.*(FECINS = $fecha(" > "$confdir/afinstal.conf"
+ fi
+ if [ $afim != 0 ]; then
+ fecha=$(date)
+ cat "$confdir/afinstal.conf" | sed "20s/.*/Comando afimonio/" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "21s(.*(BINDIR = $bindir(" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "22s(.*(LOGDIR = $logdir(" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "23s(.*(LOGNAME = $logname(" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "24s(.*(LOGSIZE = $logsize(" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "25s(.*(USERID = $USER(" > "$confdir/afinstal.conf"
+ cat "$confdir/afinstal.conf" | sed "26s(.*(FECINS = $fecha(" > "$confdir/afinstal.conf"
fi
+
if [ $comp == 0 ]; then
#busco los datos
fecha1=`cat $afinstal | grep -n FECINS | grep 18 | sed s/\.\*\=\ //`