Bueno lo prometido es deuda
Código:
Instalador
[Setup]
;********************************
AppName=MiAplicación
AppVerName=MiAplicación x.xx
DefaultGroupName=MiAplicación Group
;********************************
OutputDir=.\
OutputBaseFilename=RotaInst
DefaultDirName={pf}\MiAplicación
[Languages]
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
[Types]
Name: "T_Client"; Description: "Instalación Cliente"
Name: "T_Server"; Description: "Instalación Servidor"
[Components]
Name: "C_Client"; Description: "Instalación Cliente"; Types: T_Client T_Server
Name: "C_Program"; Description: "Aplicacion y Programas"; Types: T_Client T_Server
Name: "C_Server"; Description: "Instalación Servidor"; Types: T_Server
[Icons]
Name: "{group}\Aplicaciones RM"; Filename: "{app}\MiAplicacion.exe"
[Registry]
Root: HKLM; Subkey:"SOFTWARE\MiEmpresA\MiAplicación"; Flags: uninsdeletekey
[Files]
;Aplicación
Source: "..\..\Proyecto\MiAplicación.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: C_Program
;Programa gestión usuarios
Source: "..\..\seguridad\security.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: C_Server
;Archivos necesarios para instalar el cliente Fb15
Source: ".\inst_Fb15\IDPLicense.txt"; DestDir: "{app}\Fb15"; Components: C_Client
Source: ".\inst_Fb15\IPLicense.txt"; DestDir: "{app}\Fb15"; Components: C_Client
Source: ".\inst_Fb15\bin\fbclient.dll"; DestDir: "{app}\Fb15\bin"; Components: C_Client
Source: ".\inst_Fb15\bin\instclient.exe"; DestDir: "{app}\Fb15\bin"; Components: C_Client
Source: ".\inst_Fb15\bin\instreg.exe"; DestDir: "{app}\Fb15\bin"; Components: C_Client
;Archivos necesarios para instalar el servidir Fb15
Source: ".\inst_Fb15\aliases.conf"; DestDir: "{app}\Fb15"; Components: C_Server
Source: ".\inst_Fb15\firebird.msg"; DestDir: "{app}\Fb15"; Components: C_Server
Source: ".\inst_Fb15\firebird.conf"; DestDir: "{app}\Fb15"; Components: C_Server
Source: ".\inst_Fb15\readme.txt"; DestDir: "{app}\Fb15"; Components: C_Server
Source: ".\inst_Fb15\security.fbk"; DestDir: "{app}\Fb15"; Components: C_Server
Source: ".\inst_Fb15\security.fdb"; DestDir: "{app}\Fb15"; Components: C_Server
Source: ".\inst_Fb15\bin\fb_inet_server.exe"; DestDir: "{app}\Fb15\bin"; Components: C_Server
Source: ".\inst_Fb15\bin\fb_lock_print.exe"; DestDir: "{app}\Fb15\bin"; Components: C_Server
Source: ".\inst_Fb15\bin\fbguard.exe"; DestDir: "{app}\Fb15\bin"; Components: C_Server
Source: ".\inst_Fb15\bin\fbserver.exe"; DestDir: "{app}\Fb15\bin"; Components: C_Server
Source: ".\inst_Fb15\bin\gbak.exe"; DestDir: "{app}\Fb15\bin"; Components: C_Server
Source: ".\inst_Fb15\bin\gdef.exe"; DestDir: "{app}\Fb15\bin"; Components: C_Server
Source: ".\inst_Fb15\bin\gfix.exe"; DestDir: "{app}\Fb15\bin"; Components: C_Server
Source: ".\inst_Fb15\bin\gpre.exe"; DestDir: "{app}\Fb15\bin"; Components: C_Server
Source: ".\inst_Fb15\bin\gsec.exe"; DestDir: "{app}\Fb15\bin"; Components: C_Server
Source: ".\inst_Fb15\bin\gsplit.exe"; DestDir: "{app}\Fb15\bin"; Components: C_Server
Source: ".\inst_Fb15\bin\gstat.exe"; DestDir: "{app}\Fb15\bin"; Components: C_Server
Source: ".\inst_Fb15\bin\ib_util.dll"; DestDir: "{app}\Fb15\bin"; Components: C_Server
Source: ".\inst_Fb15\bin\install_classic.bat"; DestDir: "{app}\Fb15\bin"; Components: C_Server
Source: ".\inst_Fb15\bin\install_super.bat"; DestDir: "{app}\Fb15\bin"; Components: C_Server
Source: ".\inst_Fb15\bin\instsvc.exe"; DestDir: "{app}\Fb15\bin"; Components: C_Server
Source: ".\inst_Fb15\bin\isql.exe"; DestDir: "{app}\Fb15\bin"; Components: C_Server
Source: ".\inst_Fb15\bin\qli.exe"; DestDir: "{app}\Fb15\bin"; Components: C_Server
Source: ".\inst_Fb15\bin\uninstall.bat"; DestDir: "{app}\Fb15\bin"; Components: C_Server
Source: ".\inst_Fb15\help\help.fdb"; DestDir: "{app}\Fb15\help"; Components: C_Server
Source: ".\inst_Fb15\include\ib_util.h"; DestDir: "{app}\Fb15\include"; Components: C_Server
Source: ".\inst_Fb15\include\ib_util.pas"; DestDir: "{app}\Fb15\include"; Components: C_Server
Source: ".\inst_Fb15\include\ibase.h"; DestDir: "{app}\Fb15\include"; Components: C_Server
Source: ".\inst_Fb15\include\iberror.h"; DestDir: "{app}\Fb15\include"; Components: C_Server
Source: ".\inst_Fb15\intl\fbintl.dll"; DestDir: "{app}\Fb15\intl"; Components: C_Server
Source: ".\inst_Fb15\lib\fbclient_bor.lib"; DestDir: "{app}\Fb15\lib"; Components: C_Server
Source: ".\inst_Fb15\lib\fbclient_ms.lib"; DestDir: "{app}\Fb15\lib"; Components: C_Server
Source: ".\inst_Fb15\lib\ib_util_ms.lib"; DestDir: "{app}\Fb15\lib"; Components: C_Server
Source: ".\inst_Fb15\udf\fbudf.sql"; DestDir: "{app}\Fb15\udf"; Components: C_Server
Source: ".\inst_Fb15\udf\fbudf.dll"; DestDir: "{app}\Fb15\udf"; Components: C_Server
Source: ".\inst_Fb15\udf\ib_udf.sql"; DestDir: "{app}\Fb15\udf"; Components: C_Server
Source: ".\inst_Fb15\udf\ib_udf.dll"; DestDir: "{app}\Fb15\udf"; Components: C_Server
[Run]
;*********
; CLIENTE
;*********
;Se actualiza registro (Firebird instalado)
Filename: "{app}\Fb15\bin\instreg.exe"; Parameters: "i"; StatusMsg: "Actualizando Registro"; Flags: skipifdoesntexist runhidden waituntilterminated
;Se crea copia de gds32.dll en el directorio de sistema
Filename: "{app}\Fb15\bin\instclient.exe"; Parameters: "i g"; StatusMsg: "Instalando Cliente....."; Flags: skipifdoesntexist runhidden waituntilterminated
;**********
; SERVIDOR
;**********
;Se instala servidor (i), arranque automático (a), tipo superserver(s), se instala guardian(g)
Filename: "{app}\Fb15\bin\instsvc.exe"; Parameters: "i -a -s -g"; StatusMsg: "Instalando servicio....."; Flags: skipifdoesntexist runhidden waituntilterminated
;Se arranca servicio(start)
Filename: "{app}\Fb15\bin\instsvc.exe"; Parameters: "start"; StatusMsg: "Iniciando servicio....."; Flags: skipifdoesntexist runhidden waituntilterminated
;Se presetean usuarios
Filename: "{app}\security.exe"; Parameters: "user i"; StatusMsg: "Actualizando usuarios"; Flags: skipifdoesntexist runhidden waituntilterminated
[UninstallRun]
;**********
; SERVIDOR
;**********
;Se para servicio(stop)
Filename: "{app}\Fb15\bin\instsvc.exe"; Parameters: "stop"; StatusMsg: "Deteniendo servicio....."; Flags: skipifdoesntexist runhidden waituntilterminated
;Se desinstala servidor
Filename: "{app}\Fb15\bin\instsvc.exe"; Parameters: "r"; StatusMsg: "Desistalando servicio....."; Flags: skipifdoesntexist runhidden waituntilterminated
;*********
; CLIENTE
;*********
;Se borra copia de gds32.dll en el directorio de sistema
Filename: "{app}\Fb15\bin\instclient.exe"; Parameters: "r g"; StatusMsg: "Desinstalando Cliente....."; Flags: skipifdoesntexist runhidden waituntilterminated
;Se borra entrada registro (Firebird instalado)
Filename: "{app}\Fb15\bin\instreg.exe"; Parameters: "r"; StatusMsg: "Actualizando Registro....."; Flags: skipifdoesntexist runhidden waituntilterminated
[.code]
function Ya_Existe_Fb:boolean;
var
aux :string;
begin
if RegQueryStringValue(HKEY_LOCAL_MACHINE,'SOFTWARE\Firebird Project\Firebird Server\Instances','DefaultInstance', aux) then
result:=(aux <> '')
else
result:=False;
end;
//Se crea aplicación
function InitializeSetup(): Boolean;
begin
result:=True;
if not UsingWinNT then
begin
result:=False;
MsgBox('La versión de windows debe ser: Windows NT 4.0, 2000, XP', mbError, MB_OK);
end
else
if Ya_Existe_Fb then
begin
result:=False;
MsgBox('Ya se encuentra instalada una versión de FireBird', mbError, MB_OK);
end;
end;
Actualizador
[Setup]
;************************
AppName=MiAplicación
AppVerName=MiAplicación x.xx
DefaultGroupName=MiAplicación Group
;************************
;No se crea directorio para la aplicación
CreateAppDir=no
OutputDir=.\
OutputBaseFilename=RMupdate
Compression=lzma
SolidCompression=yes
;No crea apunte en Panel de Control
CreateUninstallRegKey=no
[Languages]
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
[Files]
;El ejecutable se toma de la carpeta Proyecto
Source: "..\..\proyecto\MiAplicación.exe"; DestDir: "{code:GetDirect|p}"; Flags: ignoreversion; components: program
;Archivo de configuración
Source: "..\..\ControlVersiones.html"; DestDir: "{code:GetDirect|v}"; components: version
;El Fuente se toma de la carpeta Proyecto
Source: "..\..\proyecto\*.dfm"; DestDir: "{code:GetDirect|f}"; Flags: ignoreversion; Components: sources
Source: "..\..\proyecto\*.pas"; DestDir: "{code:GetDirect|f}"; Flags: ignoreversion; Components: sources
Source: "..\..\proyecto\*.cfg"; DestDir: "{code:GetDirect|f}"; Flags: ignoreversion; Components: sources
Source: "..\..\proyecto\*.dof"; DestDir: "{code:GetDirect|f}"; Flags: ignoreversion; Components: sources
Source: "..\..\proyecto\*.res"; DestDir: "{code:GetDirect|f}"; Flags: ignoreversion; Components: sources
Source: "..\..\proyecto\*.dpr"; DestDir: "{code:GetDirect|f}"; Flags: ignoreversion; Components: sources
[Types]
Name: "compact"; Description: "Instalación compacta"
Name: "custom"; Description: "Instalación personalizada"; Flags: iscustom
Name: "full"; Description: "Instalación completa"
[Components]
Name: "program"; Description: "Ejecutable"; Types: full compact custom; Flags: fixed
Name: "sources"; Description: "Código Fuente"; Types: full custom
Name: "version"; Description: "Archivo versiones"; Types: full custom
;CONFIGURACIÓN NECESARIA PARA ACTUALIZAR BD
;COMENTAR ESTAS LÍNEAS CUANDO NO SEA NECESARIO ACTUALIZAR BD.
;*********************************************************************************************************************************************************
[Files]
Source: "..\..\control_configuracion\MODIF BD\Exe\Act_BD.exe"; DestDir: "{code:GetDirect|p}"; Flags: ignoreversion deleteafterinstall ; components: datos
[Components]
Name: "datos"; Description: "Actualización Base de Datos"; Types: full custom
[Run]
Filename: "{code:GetDirect|p}\Act_BD.exe"; Parameters: "auto -v 4-03.08.07 -c 3-19.01.07"; StatusMsg: "Actualizando Estructura BD"; Flags: skipifdoesntexist waituntilterminated
;*********************************************************************************************************************************************************
[.code]
const
TIT_FUENTE ='Código Fuente';
TIT_VERSION ='Archivo Versiones';
REG_CLAVE_PROGRAM='SOFTWARE\RM\ROTA_SQL\APLICACION';
REG_VALOR_PROGRAM='Path';
REG_CLAVE_INSTALL='SOFTWARE\RM\SETUP\UPDATE';
REG_VALOR_INSTALL_FUENTE='Fuente';
REG_VALOR_INSTALL_VERSION='Version';
CLASE_APLICACION='TfrmPrincipal';
var
Dir_Exe,
Dir_Fuente,
Dir_Version :string;
DataDirPage: TInputDirWizardPage;
Num_Dirs :integer;
//Devuelve el directorio de destino segun parametro
function GetDirect( p :string):string;
begin
if p = 'p' then
begin
if Dir_Exe <>'' then
result:=Dir_Exe
end
else
if p = 'f' then
begin
if Dir_Fuente <>'' then
result:=Dir_Fuente
end
else
if p = 'v' then
begin
if Dir_Version <>'' then
result:=Dir_Version
end;
end;
//Evento al confirmarlas carpetas de destino
function NextButDir(Sender: TWizardPage): Boolean;
var
j:integer;
begin
//Comprobamos entradas no vacía
result:=(Num_Dirs > 0);
if result then
for j:=0 to Num_Dirs -1 do
result:=result and (DataDirPage.Values[j]<>'');
if result then
for j:=0 to Num_Dirs -1 do
if DataDirPage.Values[j] <> '' then
if DataDirPage.PromptLabels[j].caption = TIT_FUENTE then
Dir_Fuente:=DataDirPage.Values[j]
else
Dir_Version:=DataDirPage.Values[j];
end;
//Evento de click en botón siguiente
function NextButtonClick(CurPageID: Integer): Boolean;
begin
result:=True;
// Despues de la página selección componentes
if CurPageID = wpSelectComponents then
begin
// Si se ha seleccionado cualquiera de los dos componentes se abre ventana de directorios
if IsComponentSelected('sources') or IsComponentSelected('version') then
begin
DataDirPage := CreateInputDirPage(CurPageID,
'Otros elementos que se copiarán.', '',
'Seleccione la carpeta donde se copiarán los siguientes elementos, despues haga click en siguiente.',
True, '');
DataDirPage.OnNextButtonClick:=@NextButDir;
Num_Dirs:=0;
if IsComponentSelected('sources') then
begin
DataDirPage.Add(TIT_FUENTE);
DataDirPage.values[Num_Dirs]:=GetDirect('f');
Num_Dirs:=Num_Dirs +1;
end;
if IsComponentSelected('version') then
begin
DataDirPage.Add(TIT_VERSION);
DataDirPage.values[Num_Dirs]:=GetDirect('v');
Num_Dirs:=Num_Dirs +1;
end;
end;
end;
end;
procedure getDirectorios;
var
aux: string;
begin
Dir_Exe:='';
Dir_Fuente:='';
Dir_Version:='';
//Directorio actual aplicación
if RegQueryStringValue(HKEY_LOCAL_MACHINE, REG_CLAVE_PROGRAM,REG_VALOR_PROGRAM, aux) then
if aux <> '' then
Dir_Exe:=ExtractFilePath(aux);
//Directorio Fuente
RegQueryStringValue(HKEY_LOCAL_MACHINE, REG_CLAVE_INSTALL,REG_VALOR_INSTALL_FUENTE, Dir_Fuente)
//Directorio Version
RegQueryStringValue(HKEY_LOCAL_MACHINE, REG_CLAVE_INSTALL,REG_VALOR_INSTALL_VERSION, Dir_Version)
//Directorio Fuentes
if Dir_Fuente='' then
Dir_Fuente:=Dir_Exe+'\fuente';
//Directorio Versiones
if Dir_Version='' then
Dir_Version:=Dir_Exe+'\Version';
end;
//Se crea aplicación
function InitializeSetup(): Boolean;
begin
getDirectorios;
if Dir_Exe = '' then
begin
result:=False;
MsgBox('La aplicación no se encuentra instalada', mbError, MB_OK);
end
else
begin
// Comprobamos que la aplicación no se encuentre ejecutandose
if FindWindowByClassName(CLASE_APLICACION)<> 0 then
begin
result:=False;
MsgBox('La aplicación actualmente se está ejecutando.', mbError, MB_OK);
end
else
result:=True;
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
//Instalación terminada
if CurStep=ssPostInstall then
begin
RegWriteStringValue(HKEY_LOCAL_MACHINE, REG_CLAVE_INSTALL,REG_VALOR_INSTALL_FUENTE, Dir_Fuente);
RegWriteStringValue(HKEY_LOCAL_MACHINE, REG_CLAVE_INSTALL,REG_VALOR_INSTALL_VERSION, Dir_Version);
end;
end;
Espero que te sirva