MARCA
# Le pido un rootpath donde se instalara este comando en particular
- leer ">> Ingrese la ruta de instalaciĆ³n" "$CURRDIR/grupoNN" userpath
- if [ -n "$userpath" ]; then ROOTPATH=$userpath
- else ROOTPATH="$CURRDIR/grupoNN"
- fi
+ is_writeable=0
+ while [ $is_writeable -eq 0 ]; do
+ leer ">> Ingrese la ruta de instalaciĆ³n" "$CURRDIR/grupoNN" userpath
+ if [ -n "$userpath" ]; then
+ ROOTPATH=$userpath
+ if [ -w "${userpath%/*}" ]; then is_writeable=1
+ else echo ">> ERROR: No es posible crear dicho directorio"
+ fi
+ else
+ ROOTPATH="$CURRDIR/grupoNN"
+ is_writible=1
+ fi
+ done
# preparlos los dirs que voy a sugerir
BINDIR="${ROOTPATH}/bin"
"afimonio" ) numline=30;
havemonio=1;
usermonio=$userid;
- fechamonio=$fecha;;
+ fechamonio=$fecha;
+ prefix="AFIM";;
"aficonf" ) numline=20;
haveconf=1;
userconf=$userid;
- fechaconf=$fecha;;
+ fechaconf=$fecha;
+ prefix="AFIC";;
"antifraude.pl" ) numline=10;
havefraude=1;
userfraude=$userid;
- fechafraude=$fecha;;
+ fechafraude=$fecha;
+ prefix="ANTI";;
esac
changeLine "$CONFFILE" "$numline" "Comando $comando"
numline=$(($numline+1))
changeLine "$CONFFILE" "$numline" "BINDIR = $BINDIR"
- echo "BINDIR=\"$BINDIR\"" >> $ownconffile
+ echo "${prefix}_BINDIR=\"$BINDIR\"" >> $ownconffile
numline=$(($numline+1))
changeLine "$CONFFILE" "$numline" "LOGDIR = $LOGDIR"
- echo "LOGDIR=\"$LOGDIR\"" >> $ownconffile
+ echo "${prefix}_LOGDIR=\"$LOGDIR\"" >> $ownconffile
numline=$(($numline+1))
changeLine "$CONFFILE" "$numline" "LOGFILE = $LOGFILE"
- echo "LOGFILE=\"$LOGFILE\"" >> $ownconffile
+ echo "${prefix}_LOGFILE=\"$LOGFILE\"" >> $ownconffile
numline=$(($numline+1))
changeLine "$CONFFILE" "$numline" "LOGSIZE = $LOGSIZE"
- echo "LOGSIZE=$LOGSIZE" >> $ownconffile
+ echo "${prefix}_LOGSIZE=$LOGSIZE" >> $ownconffile
numline=$(($numline+1))
if [ "$comando" = "antifraude.pl" ]; then
changeLine "$CONFFILE" "$numline" "DATADIR = $DATADIR"
- echo "DATADIR=\"$DATADIR\"" >> $ownconffile
+ echo "${prefix}_DATADIR=\"$DATADIR\"" >> $ownconffile
numline=$(($numline+1))
changeLine "$CONFFILE" "$numline" "DATASIZE = "
numline=$(($numline+1))