luca 94c444b03a Installazione 2.1
Eliminato setup.pkg che e' un file compilato.
Aggiunto setup.lst che e' il sorgente del precedente (contiene la lista con l'elenco dei files
di tipo .z che compaiono nell'installazione).
Modificate le icone della installazione (files .dll).
Eliminato ba.z; il suo contenuto e' stato trasferito in sys.z (fase di preparazione al nuovo
modulo SY).


git-svn-id: svn://10.65.10.50/trunk@11938 c028cbd2-c16b-5b4b-a496-9718f37d4682
2004-04-06 13:00:45 +00:00

644 lines
20 KiB
Plaintext
Executable File
Raw Blame History

//________________________________________________________________________________________________________________________
// *** Compila il file Campo.ini
function _SetCampoIni( )
STRING szTmpPath[_MAX_LENGTH], szPrgPath[_MAX_LENGTH], szTestData, szTestProg;
NUMBER nPos;
begin
StrToLower (szTmpPath, szCampoIni);
nPos = StrFind(szTmpPath,"campo.ini");
StrSub (szPrgPath, szTmpPath, 0, nPos);
if ( CreateDir( szPrgPath ) < 0 ) then
_Errore( STR_DIR_NOTCREATED );
endif;
ChangeDirectory( szPrgPath);
// scrive le stesse cose nel file unico campo.ini , se esiste
szTmpPath=szPrgPath ^ "CAMPO.INI";
//non scrive nulla in caso di aggiornamento di una vecchia installazione
if (nReinstall <= 0) then
WriteProfString(szTmpPath, "Main", "MailTo","");
WriteProfString(szTmpPath, "Main", "MaxHandles","32");
WriteProfString(szTmpPath, "Main", "Program",szAppRefPath);
WriteProfString(szTmpPath, "Main", "Study",szDataPath);
WriteProfString(szTmpPath, "Main", "Firm","COM");
szTestData = "";
szTestProg = "";
//SOLO se e' una installazione locale puo' fare il test del database (con conversione!)
if (( ! bInstallNetWrkChk) && ( ! bInstallNetWrk )) then
szTestData = "X";
szTestProg = "N";
endif;
//se ho i programmi in locale ed idati in remoto posso fare l'aggiornamento dei programmi (NON dei dati)
if (bInstallNetWrkChk) then
szTestData = "N";
szTestProg = "X";
endif;
//in caso di campo wst (tutto in remoto) NON testi un tubo!
WriteProfString(szTmpPath, "Main", "TestDatabase",szTestData );
WriteProfString(szTmpPath, "Main", "TestPrograms",szTestProg );
endif;
if (bInstallPrg) then
if ((bUseDongleServer) && (!_TCPIPPresent())) then
szDongleServerName="";
_Attenzione("Impossibile utilizzare il server di rete delle autorizzazioni: \nprotocollo TCP-IP non rilevato");
endif;
WriteProfString(szTmpPath, "Server", "Dongle" , szDongleServerName);
endif;
szTmpPath=szPrgPath ^ "INSTALL.INI";
if (bInstallNetWrkChk) then
WriteProfString(szTmpPath, "Main", "DiskPath",szAppRefPath);
endif;
end;
//________________________________________________________________________________________________________________________
// **** Funzione per aggiornare i files di sistema in windows 95/98 (non + utilizzata dalla 2.0!)
function _UpdateSysFiles( )
NUMBER nNotModify, nGoOut, nRet, nInfo, nCurFiles, nLen, nNr;
STRING szTemp[_MAX_LENGTH], szWin_Ini[_MAX_LENGTH];
begin
if (!bNuovaInst) && (!bInstallNetWrk) then
return;
endif;
//serve solo per windows 95/98 e roba simile...
if (szOSName = "Windows NT") then
return;
endif;
nSystemFileModified = TRUE;
nNotModify = FALSE;
nInfo = FALSE;
nGoOut = FALSE;
SetDialogTitle(DLG_ASK_OPTIONS, "Modifica i files di sistema" );
Disable( BACKBUTTON );
SetDialogTitle(DLG_CANCEL, "Uscita" );
SetDialogTitle(DLG_OK, "Conferma" );
while (! nGoOut)
if (!bNuovaInst) then
nSystemFileModified=FALSE;
nNotModify=TRUE;
endif;
nRet = AskOptions(EXCLUSIVE, STR_MODSYSFILES, STR_MODIFY, nSystemFileModified, STR_NOTMODIFY, nNotModify, STR_INFOMODIFY, nInfo );
if nInfo then
// Mostra le informazioni
if _PreviewBatch( ) then
nSystemFileModified = TRUE;
else
nSystemFileModified = FALSE;
endif;
endif;
nGoOut = TRUE;
endwhile;
//se il numero di files e' insufficiente in config.sys -> propone di incrementarlo
VarSave(SRCTARGETDIR);
SRCDIR = "C:\\";
CopyFile( "CONFIG.SYS", "CONFIG.PRA" );
VarRestore(SRCTARGETDIR);
if (nSystemFileModified) then
ConfigSetFileName( "C:\\CONFIG.SYS" );
else
szTemp = TARGETDIR ^ "CONFIG.PRA";
ConfigSetFileName( szTemp );
endif;
EzConfigGetValue( "FILES", nCurFiles );
if nCurFiles < NUM_FILES_IN_CONFIG then
EzConfigSetValue( "FILES", NUM_FILES_IN_CONFIG );
endif;
if nSystemFileModified then
SprintfBox( WARNING, "Attenzione", STR_FILE_MODIFIED, TARGETDIR );
else
SprintfBox( WARNING, "Attenzione", STR_FILE_NOTMODIFIED, TARGETDIR );
endif;
end;
//________________________________________________________________________________________________________________________
// *** Funzione per cancellare i files minimi per il fascicolatore
function _DeleteFilesMinima( )
NUMBER pDataList, pProgramList, nFile, nFlag, nLen;
STRING szPath [ _MAX_LENGTH ], szFileName [ _MAX_LENGTH ], szFC [ 2 ], szLine [ _MAX_LENGTH ];
begin
if (!bNuovaInst) then
szPath=szAppPath ^ "install.ini";
GetProfString(szPath,"Main","Demo",szFC);
if szFC = "X" then
// cancella tutti gli eseguibili per evitare sovrapposizioni tra versione demo e normale
szPath=szAppPath;
nLen=FindAllFiles(szAppPath, "*.EXE", szFileName, RESET);
while (nLen=0 )
DeleteFile(szFileName);
nLen=FindAllFiles(szAppPath, "*.EXE", szFileName, CONTINUE);
endwhile;
endif;
endif;
end;
//________________________________________________________________________________________________________________________
// *** esegue effettivamente l'installazione dei files minimi di sistema (*.dll,*.vxd, parte della base necessaria a
// *** lanciare poi l'installatore c++)
function _InstallFilesMinima( )
NUMBER nRet, ntDisk, nHandle;
BOOL bRightDisk;
STRING szTemp [_MAX_LENGTH];
STRING szStatusText [_MAX_LENGTH];
begin
// Backup TARGETDIR to local variable
// Define fileset items
// --------------------- //
SetColor(STATUSBAR,BLUE);
Enable(FEEDBACK_OPERATION);
Enable(STATUS);
FileSetBeginDefine ( "WIN");
if (szOSName != "Windows NT") then
TARGETDIR = WINDIR ^ "SYSTEM";
if ( CompressGet( "WINSYS.Z", "*.*", INCLUDE_SUBDIR ) < 0) then
szText = STR_ERR_DECOMPRESS + " la libreria WINSYS.";
_Errore( szText );
endif;
endif;
FileSetEndDefine ( "WIN");
FileSetBeginDefine ( "SYS");
TARGETDIR = szAppPath;
if ( CreateDir( TARGETDIR ) < 0 ) then
_Errore( STR_DIR_NOTCREATED );
else
if ( CompressGet( "SYS.Z", "*.*", INCLUDE_SUBDIR ) < 0) then
szText = STR_ERR_DECOMPRESS + " l'archivio compresso contenente i files di sistema.";
_Errore( szText );
endif;
if ( CompressGet( "RES.Z", "*.*", INCLUDE_SUBDIR ) < 0) then
szText = STR_ERR_DECOMPRESS + " l'archivio compresso contenente i files delle icone.";
_Errore( szText );
endif;
endif;
FileSetEndDefine ( "SYS");
StrToUpper( szAppPath, szAppPath );
szStatusText = "Installazione su " + szAppPath;
StatusUpdate( ON, 50 );
SetStatusWindow( 0, "Installazione librerie ..." );
_PerformSet ( "WIN");
StatusUpdate( ON, 100 );
SetStatusWindow( 50, "Installazione programmi di ambiente .." );
_PerformSet ( "SYS");
szTemp = szAppPath ^ "RecDesc";
CreateDir(szTemp);
szTemp = szAppPath ^ "Servers";
CreateDir(szTemp);
//controlla se esiste la directory "CUSTOM" delle personalizzazioni;se non esiste la crea
szTemp = szAppPath ^ "Custom";
if ( ExistsDir(szTemp) = NOTEXISTS ) then
CreateDir(szTemp);
endif;
Disable(STATUS);
end;
//------------------------------------------------------------------------------------------------
function _PerformSet ( sFileset)
NUMBER nDisk;
BOOL bDone;
NUMBER nRet, ntDisk, nHandle;
BOOL bRightDisk;
STRING szTemp [_MAX_LENGTH];
STRING szTmp [_MAX_LENGTH];
STRING szFileName [_MAX_LENGTH];
STRING szExt [_MAX_LENGTH];
STRING szText [_MAX_LENGTH];
STRING szEntDisk [_MAX_LENGTH];
STRING szMsg [_MAX_LENGTH];
begin
bDone = FALSE;
nDisk = 1;
while ( !bDone )
nRet = FileSetPerformEz ( sFileset, 1);
switch ( nRet )
case FS_TONEXTDISK:
// non usato da FileSetPerformEz
if nDisk > 0 then
NumToStr( szExt, nDisk );
szEntDisk = STR_INSERTDISK + STR_TAGDISK1 + szExt;
szTemp = "diskid" ^ szExt;
SetDialogTitle ( DLG_ENTER_DISK, "Cambio disco" );
SetDialogTitle ( DLG_CANCEL, "Uscita" );
Suppress( ENTERDISK_ERRMSG, DISABLE );
bRightDisk = FALSE;
while( !bRightDisk )
nRet = EnterDisk( szEntDisk, szTemp );
switch( nRet )
case DISKID:
_Attenzione( "L'unita' indicata non e' valida." );
case BADPATH:
_Attenzione( "Il percorso indicato non e' valido." );
case DRIVEOPEN:
_Attenzione( "Inserire il disco nell'unita' indicata!" );
case BADTAGFILE:
_Attenzione( "Il disco inserito non e' corretto. Inserire il disco richiesto." );
case CANCEL:
_ExitOnConfirm( );
case OK:
bRightDisk = TRUE;
endswitch;
endwhile;
endif;
case FS_OPERROR:
Sprintf( szMsg, "E' stato rilevato un errore copiando il file %s. Il file non e' stato copiato.\n\nErrore FS_OPERROR.", ERRORFILENAME );
_Errore( szMsg );
case FS_GENERROR:
Sprintf( szMsg, "E' stato rilevato un errore copiando il file %s. Il file non e' stato copiato.\n\nErrore FS_GENERROR.", ERRORFILENAME );
_Errore( szMsg );
case FS_TARGETREADONLY:
szMsg="Impossibile scrivere nella directory di destinazione.";
_Errore( szMsg );
case FS_INCORRECTDISK:
_Attenzione( "Disco non valido.\n\nInserire il disco corretto." );
case FS_DISKONEREQUIRED:
szEntDisk = STR_INSERTDISK + STR_TAGDISK1;
_Attenzione( szEntDisk );
case FS_RESETREQUIRED:
_Errore( "Impossibile copiare il file a causa di un errore interno." );
case FS_OUTOFSPACE:
szMsg= "Lo spazio su disco non e' stato sufficiente per completare la copia dei files.\n\nErrore FS_OUTOFSPACE.";
_Errore( szMsg );
case FS_DONE:
bDone = TRUE;
default :
if ( nRet < 0 ) then
szMsg = "Si e' verificato un errore copiando e decomprimendo il file " ^ ERRORFILENAME;
_Errore( szMsg );
endif;
endswitch;
endwhile;
FileSetEndPerform ( sFileset);
end;
//_______________________________________________________________________________________________________________________
// *** aggiorna il menu dei programmi di windows, aggiungendovi la directory del programma ed il link a ba0.exe
function _UpdateStartMenu( )
STRING szItemName [_MAX_LENGTH],
szFolder [_MAX_LENGTH],
szCmdLine [_MAX_LENGTH],
szIconPath [_MAX_LENGTH],
szWorkingDir[_MAX_LENGTH];
begin
Enable( HOURGLASS );
// Mostra Program Manager
AppCommand( PROGMAN, CMD_RESTORE );
// Aggiunge il gruppo di programmi ed i programmi
szFolder="OneRed";
ShowGroup (szFolder , SW_NORMAL );
if ( TRUE) then
// Aggiunge i link Program Manager
if bInstallDemo then
szItemName = "OneRed Demo";
elseif bInstallNetWrk then
szItemName = "OneRed WST";
else
szItemName = "OneRed";
endif;
szCmdLine = szAppPath ^ "\\BA0.EXE";
szIconPath = szCmdLine;
AddFolderIcon( szFolder, szItemName, szCmdLine, "", szIconPath, 0, "", REPLACE );
//AddProgItemEx ( szFolder, szItemName, szCmdLine, "", szIconPath, 0, "", REPLACE );
endif;
AppCommand( PROGMAN, CMD_MINIMIZE );
Disable( HOURGLASS );
end;
//-----------------------------------------------------------------------------
function _CambiaDirectory( )
STRING szText[ _MAX_LENGTH ];
STRING szModifiedPath[ _MAX_LENGTH ];
STRING szUserSelectedDrive[ _MAX_LENGTH ];
STRING szIncorrectPath[ _MAX_LENGTH ];
begin
szText = STR_TEXT1;
SetDialogTitle( DLG_ASK_PATH, "Directory per installare i programmi" );
if ( AskPath( szText , szAppPath, szModifiedPath ) = OK ) then
StrToUpper( szModifiedPath, szModifiedPath );
GetDisk( szModifiedPath, szUserSelectedDrive );
if ( Is ( VALID_PATH, szModifiedPath ) = 1 ) then
if szAppPath != szModifiedPath then
szAppPath = szModifiedPath;
szDataPath = szAppPath ^ "DATI\\";
endif;
szText = STR_DATATEXT1;
SetDialogTitle( DLG_ASK_PATH, "Directory per installare i dati" );
if ( AskPath( szText , szDataPath, szModifiedPath ) = OK ) then
StrToUpper( szModifiedPath, szModifiedPath );
GetDisk( szModifiedPath, szUserSelectedDrive );
if ( Is ( VALID_PATH, szModifiedPath ) = 1 ) then
szDataPath = szModifiedPath;
else
szIncorrectPath = STR_INVALID_PATH + "\n" + szModifiedPath;
_Attenzione( szIncorrectPath );
endif;
endif;
endif;
endif;
end;
//________________________________________________________________________________________________________________________
// *** copia il file ADMIN.INI nella directory config che sta sotto la directory dati
function _CopiaADMININI( )
STRING szPath[_MAX_LENGTH], szFileName[_MAX_LENGTH], szLine[ _MAX_LENGTH], szFC[ 2 ], szTmp[ _MAX_LENGTH];
NUMBER nFlag, nFileIn, nFileOut, nLoop;
begin
szPath = szDataPath ^ "CONFIG";
szTmp = szPath ^ "ADMIN.INI";
if ( ! Is( FILE_EXISTS, szTmp ) ) then
if ExistsDir( szPath ) = NOTEXISTS then
if ( CreateDir( szPath ) < 0 ) then
_Errore( "Impossibile creare la directory CONFIG sotto i dati!" );
endif;
endif;
szFileName = "ADMIN.INI";
OpenFileMode( FILE_MODE_APPEND );
CreateFile( nFileOut, szPath, szFileName );
OpenFileMode( FILE_MODE_NORMAL );
szPath = szAppPath;
OpenFile( nFileIn, szPath, szFileName );
nFlag = GetLine( nFileIn, szLine );
while( nFlag = 0 )
if szLine = "[Colors]" then
nLoop = 0;
while( nLoop = 0 )
WriteLine( nFileOut, szLine );
nFlag = GetLine( nFileIn, szLine );
nLoop = nFlag;
if ( nLoop = 0 ) then
StrSub( szFC, szLine, 0, 1 );
if ( szFC != "[" ) then
nFlag = GetLine( nFileIn, szLine );
else
nLoop = 1;
endif;
endif;
endwhile;
else
if szLine = "[Font]" then
nLoop = 0;
while( nLoop = 0 )
WriteLine( nFileOut, szLine );
nFlag = GetLine( nFileIn, szLine );
nLoop = nFlag;
if ( nLoop = 0 ) then
StrSub( szFC, szLine, 0, 1 );
if ( szFC != "[" ) then
nFlag = GetLine( nFileIn, szLine );
else
nLoop = 1;
endif;
endif;
endwhile;
else
nFlag = GetLine( nFileIn, szLine );
endif;
endif;
endwhile;
CloseFile( nFileIn );
CloseFile( nFileOut );
endif;
end;
//________________________________________________________________________________________________________________________
// *** copia il file "install.ini"
function _CopiaINSTALLINI( )
STRING szPath[_MAX_LENGTH], szFileName[_MAX_LENGTH], szLine[ _MAX_LENGTH], szFC[ 2 ], szTmp[ _MAX_LENGTH];
STRING szSrcPath[_MAX_LENGTH];
NUMBER nFlag, nFileOut, nLoop;
begin
// corregge il path dei dati in base all'installazione da dischetto o CD (o installazione di rete)
szSrcPath = SRCDIR ;
ParsePath(szPath,szSrcPath,DIRECTORY);
//controlla la lunghezza della stringa del path (szPath): se >= 7 ->installazione da CD o rete
//con immagini dei dischetti su DISK1, DISK2 ,...; se su CD/rete ->trimma la stringa del path in
//modo che resti solo \DISK1
if (StrLength(szPath) >= 7) then
StrSub(szTmp , szPath, (StrLength(szPath) - 7) ,6 );
nFileOut=StrFind(szTmp, "DISK");
if nFileOut>=0 then
StrSub(szPath, szSrcPath ,0, StrLength(szSrcPath)- 7 + nFileOut);
szSrcPath = szPath;
endif;
endif;
//dopo aver completato la scrittura del path dei sorgenti di installazione (szSrcPath) gli aggiunge
//la directory dei files compressi (zip se installazione normale, zipdemo se demo)
if bInstallDemo then
szSrcPath= szSrcPath ^ ZIPDEMO_DIRECTORY;
else
szSrcPath= szSrcPath ^ ZIP_DIRECTORY;
endif;
//quindi crea il nome completo di path dell'install.ini che si trova nella directory dei files compressi
//che si vogliono scompattare..
szFileName = szSrcPath ^ "INSTALL.INI";
//..e trasforma szPath in .\install.ini (attualmente szAppPath <20> ignota)
szPath= szAppPath ^ "INSTALL.INI";
//scrive delle "profile strings" nell'install.ini
//scrive nel paragrafo [Main] il "DiskPath"=szSrcPath, il Producer, il DiskSize, la Versione
//ACHTUNG! questo <20> l'install.ini che finisce nel root, con Versione=0; infatti szPath vale .\install.ini
WriteProfString(szPath,"Main","DiskPath",szSrcPath);
GetProfString(szFileName,"Main","Producer",szTmp);
WriteProfString(szPath,"Main","Producer",szTmp);
if bInstallDemo then
szTmp = "X";
else
szTmp = " ";
endif;
szPath=szAppPath ^ "install.ini";
if WriteProfString(szPath,"Main","Demo",szTmp) < 0 then
_Attenzione("Impossibile scrivere il tipo della versione su install.ini");
endif;
end;
//________________________________________________________________________________________________________________________
// *** Crea un lista delle precedenti installazioni memorizzate nel file Campo.stp e genera
//una option box con la lista,per lasciare scegliere all'utente quale installazione aggiornare
function _ChooseReinstall(nRetv)
LIST list;
NUMBER nPar,i;
STRING szInst,szIni,szPar,szComponents;
begin
list = ListCreate(STRINGLIST);
szPar = "1";
nPar = 1;
while (GetProfString("C:\\Campo.stp", szPar, "Program", szInst) = 0)
//controlla se la precedente installazione e' di tipo campo wst
if (GetProfString("C:\\Campo.stp", szPar, "CampoIni", szIni) = 0) then
i = StrFind(szIni,"\\campo.ini");
StrSub(szInst, szIni, 0, i);
if (!Is( FILE_EXISTS, szIni)) then
szInst = szInst ^ " (RIMOSSA)";
endif;
else
if (!Is( FILE_EXISTS, szInst ^ "\\campo.aut")) then
szInst = szInst ^ " (RIMOSSA)";
endif;
endif;
ListAddString(list, szInst, AFTER);
nPar = nPar + 1;
NumToStr(szPar, nPar);
endwhile;
szComponents = "Installazioni precedenti";
//crea la lista delle installazioni precedenti
i = ListGetFirstString(list,szInst);
while (i = 0)
ComponentAddItem(szComponents, szInst, 0, szPar="1");
i = ListGetNextString(list,szInst);
endwhile;
nRetv = SdAskOptions("Installazioni precedenti", "Selezionare l'installazione da aggiornare", "",
"", szComponents, EXCLUSIVE);
nReinstall = 0;
if (nRetv = NEXT) then
nPar = 1;
i = ListGetFirstString(list,szInst);
while (i = 0)
if (ComponentIsItemSelected(szComponents, szInst)) then
if (StrFind(szInst, "(RIMOSSA)") < 0) then
szReinstallPath = szInst;
nReinstall = nPar;
endif;
endif;
nPar = nPar+1;
i = ListGetNextString(list,szInst);
endwhile;
endif;
end;
//________________________________________________________________________________________________________________________
// *** crea una lista con le unita' disco del computer, scegliendo poi quelle di rete (remote_drive)
function _IsNetworkDrive(szPath, bRetval)
STRING szDisk;
NUMBER list, nCheck;
begin
bRetval = FALSE;
if (GetDisk(szPath, szTmp) < 0) then
return;
endif;
StrSub(szDisk,szTmp,0,1);
list = ListCreate(STRINGLIST);
if (GetValidDrivesList(list, REMOTE_DRIVE, -1) < 0) then
ListDestroy(list);
return;
endif;
nCheck = ListGetFirstString(list, szTmp);
while (nCheck = 0 && ! bRetval)
if (szTmp = szDisk) then
bRetval = TRUE;
endif;
nCheck = ListGetNextString(list, szTmp);
endwhile;
ListDestroy(list);
end;
//________________________________________________________________________________________________________________________
// *** inizializza l'installazione
function _ProgramPrologue()
begin
_GetOSName( ); // Reperisce il nome del sistema operativo in szOSName
SetDialogTitle (DLG_ASK_OPTIONS, "Seleziona i componenti");
SetDialogTitle (DLG_ASK_TEXT, "");
SetDialogTitle (DLG_ASK_YESNO, "Domanda");
SetDialogTitle (DLG_ENTER_DISK, "Setup ha bisogno del prossimo disco");
SetDialogTitle (DLG_MSG_INFORMATION, "Messaggio");
SetDialogTitle (DLG_MSG_SEVERE, "Errore fatale");
SetDialogTitle (DLG_MSG_WARNING, "Attenzione");
SetDialogTitle( DLG_ASK_PATH, "Scelta direttorio" );
_DisattivaScreenSaver( ); // Disabilita lo screen-saver
end;
//________________________________________________________________________________________________________________________
// *** termina l'installazione
function _ProgramEpilogue()
begin
_FineInstallazione( );
_RiattivaScreenSaver( );
end;