Reputation: 181
I need some help to make a Inno Installer, I want install drivers in the same time of my own project. When the driver is just an "exe" file, it works fine :
[Files]
Source: ".\Component\Drivers\Driver1\driver1.exe"; DestDir: "{tmp}"; Check: Is64BitInstallMode;
[Codes]
ExtractTemporaryFile('driver1.exe');
Exec(ExpandConstant('{tmp}\driver1.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
But when the driver is more complex with dependecies, it's not the same deal. I have tried to put all files in the temp directory (yes this is ugly =)) and execute the driver but this solution doesn't work.
[Files]
Source: ".\Component\Drivers\Keithley Driver\*"; DestDir: "{tmp}"; Check: Is64BitInstallMode;
[Code]
ExtractTemporaryFile('setup.exe');
Exec(ExpandConstant('{tmp}\setup.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
Have you a good advice for me? Can I compress the driver and all it dependencies in one "exe" file? Thanx for your Help, Best Regards, Clément.
UPDATE 2 : This is my entir code :
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "App"
#define MyAppVersion "1.0"
#define MyAppPublisher "Other"
#define MyAppURL "http://www.other.fr"
#define MyAppExeName "App.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
VersionInfoVersion={#MyAppVersion}
AllowNoIcons=yes
OutputDir=.\Deployment
OutputBaseFilename=App-Setup
SetupIconFile=.\Component\App.ico
Compression=lzma
SolidCompression=yes
WizardImageFile=.\Component\App.bmp
WizardSmallImageFile=.\Component\App.bmp
[Languages]
Name: "en"; MessagesFile: "compiler:Default.isl";
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
[Files]
Source: ".\Component\Cal\*"; DestDir: "{app}\Cal"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\Component\Documentation\*"; DestDir: "{app}\Documentation"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\Component\Softwares\Utility\*"; DestDir: "{app}\Utility"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\Component\Softwares\System32\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\Component\Softwares\App\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: ".\Component\Drivers\Keithley Driver\*"; Flags: deleteafterinstall createallsubdirs recursesubdirs; DestDir: "{tmp}";
Source: ".\Component\Drivers\Spec Driver\driver.exe"; DestDir: "{tmp}"; Check: Is64BitInstallMode;
Source: ".\Component\Drivers\Adaptater\adaptater.exe"; DestDir: "{tmp}"; Check: Is64BitInstallMode;
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
var
ResultCode: Integer;
I: Integer;
begin
// CurStep values
// ssInstall, ssPostInstall, ssDone
MsgBox('Hello.', mbInformation, MB_OK);
if CurStep = ssPostInstall then begin
Exec(ExpandConstant('{tmp}\Keithley Driver\setup.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
Exec(ExpandConstant('{tmp}\driver.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
// Ask the user a Yes/No question
if MsgBox('Do you need to use the Adaptater?', mbConfirmation, MB_YESNO) = IDYES then
begin
Exec(ExpandConstant('{tmp}\adaptater.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
MsgBox('Please, plug it now!', mbInformation, MB_OK);
for I := 0 to 10 do
begin
Sleep(400);
end;
end;
end;
end;
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
UPDATE 3 : This is my final [Code] part to install a driver with dependencies:
[Files]
Source: ".\Component\Drivers\*"; Flags: deleteafterinstall createallsubdirs recursesubdirs; DestDir: "{tmp}";
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
var
ResultCode: Integer;
I: Integer;
begin
// CurStep values
// ssInstall, ssPostInstall, ssDone
if CurStep = ssPostInstall then begin
Exec(ExpandConstant('{tmp}\Keithley Driver\setup.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
Exec(ExpandConstant('{tmp}\Driver\driver.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
// Ask the user a Yes/No question
if MsgBox('Do you need to use the Adaptater?', mbConfirmation, MB_YESNO) = IDYES then
begin
Exec(ExpandConstant('{tmp}\Adaptater\adaptater.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
MsgBox('Please, plug it now!', mbInformation, MB_OK);
for I := 0 to 10 do
begin
Sleep(400);
end;
end;
end;
end;
Thanx a lot Rik!
Upvotes: 3
Views: 2788
Reputation: 2032
I don't know why you are calling ExtractTemporaryFile('setup.exe');
if its destination already was {tmp}.
I think this would be sufficient (note the wildcard in source and deleteafterinstall
):
[Files]
Source: ".\Component\Drivers\Keithley Driver\*"; Flags: deleteafterinstall createallsubdirs recursesubdirs; DestDir: {tmp}
[Code]
Exec(ExpandConstant('{tmp}\setup.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
I thought you would only use ExtractTemporaryFile()
if you have a dontcopy
-flag in the Source-line. Then that file will not be extracted and you can do it manually in code. Without a dontcopy
-flag you don't need it.
Also your [code]
segment is not complete.
Here is a small example of a working .iss:
[Setup]
AppName=test
AppVerName=test
DefaultDirName=C:\TEMP
OutputBaseFilename=test
OutputDir=C:\TEMP
Uninstallable=no
;PrivilegesRequired=none
PrivilegesRequired=admin
Compression=lzma/ultra
SolidCompression=yes
[Files]
Source: ".\Component\Drivers\Keithley Driver\*"; Flags: deleteafterinstall createallsubdirs recursesubdirs; DestDir: {tmp}
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
begin
// CurStep values
// ssInstall, ssPostInstall, ssDone
if CurStep = ssPostInstall then begin
MsgBox('Hello.', mbInformation, MB_OK);
Exec(ExpandConstant('{tmp}\setup.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
end;
end;
Your files will only be in the {tmp} directory in ssPostInstall phase (and not in ssInstall phase).
Upvotes: 2