I recently have found some old PC games to play on my Windows 10 64-bit computer. I have looked at various online sources to get the games working. Now I'm interested in creating a custom installer for all the various steps taken to get the games to work properly. I succeeded getting C&C Generals to work with a custom installer via Inno Setup. I however lack the expertise after a bit of research and trial to do the following:
I am able to install the software and use the official patch to update the installed software.
I am unsure how to add a script to copy modified files from the install subfolder to overwrite the installed files in the main folder after the update. The update does not work on the modified files.
Example:
Program installs to C:\Program Files (x86)\Programv1.exe.
Setup source files include a subfolder \modfiles.
Would like to overwrite Programv1.exe post patch update with \modfiles\Programv2.exe
Does this go under the [Code] section?
Can it go under the [Run] section with a postinstall flag? Like a simple copy and overwrite command as the last step?
Thanks!
There many ways to achieve this.
You can execute the patch using the AfterInstall parameter, even before the "mod" is installed. See Inno Setup: Install other installer and run it before continuing my install. Then you can install the mod straight to the installation folder (not to the subfolder):
[Files]
; Install original game
Source: C:\source\TheGame\*; Dest: {app}
; Run patch
Source: C:\patch\PatchTheGame.exe; Dest: {tmp}; AfterInstall: RunPatch
; Install mod
Source: C:\mod\Program.exe; Dest: {app}
Use Run entry to copy the mod after you install the patch:
[Files]
; Install original game
Source: C:\source\TheGame\*; Dest: {app}
; Extract the patch somewhere
Source: C:\patch\PatchTheGame.exe; Dest: {tmp}
; Extract the mod somewhere
Source: C:\mod\Program.exe; Dest: {tmp}
[Run]
Filename: {tmp}\PatchTheGame.exe
Filename: {cmd}; Parameters: /C copy ""{tmp}\Program.exe"" ""{app}\Program.exe""
You can code it in Pascal Script. See Install customized version of configuration file in Inno Setup after (Firebird) subinstaller finishes
Related
I have created an installer using Inno 5.5.9 and am installing a number of binary files that need to be marked as shared because a second installer could install a second program to the same directory and these files are common across the two programs.
I am marking the files with the flags 'sharedfile uninsnosharedfileprompt' but they are not removed on uninstall even if they are not in use.
In my testing I install the main program and then uninstall it immediately. The uninstall log says it is 'decrementing shared count' for these files but the shared count is not reaching zero. This is a 32bit program installed onto Windows 10.
#define SourceDirectory "..\bin2017\win32"
#define InstallPath "{app}\bin\Win32\"
[Files]
Source: "{#SourceDirectory}\*.dll"; DestDir: "{#InstallPath}"; Flags: ignoreversion sharedfile uninsnosharedfileprompt
What am I missing to make this work correctly? What could be preventing the uninstaller from decrementing the shared count to zero?
If you need any more info or code please let me know (this is my first question on the excellent site).
Thanks in advance.
The path in the original location has most likely some orphan reference.
I believe your code is correct and the installer behaves correctly. It's just a local problem with reference counting.
I have few SQL script files which have to run before installation begin. The reason is if SQL scripts run successfully only, I want to do the installation.
If the SQL scripts need to run after the installation, I can copy the files to {app} path and run the files from there. But the requirement is run the files before installation begins. I am confused. What is the best way of doing it?
Say for example if it is a single file I can put it under Files section and can use ExtractTemporaryFile('FileName');
But as I mentioned, I have many files (in SQLSCRIPTS folder). What is the better way? (One solution is I can make it as a single file by zipping it and then unzip it)
[Files]
Source: "C:\\SQLSCRIPTS\\*"; DestDir: "{app}"; Flags: dontcopy
To extract multiple files from installer, use the ExtractTemporaryFiles, like:
ExtractTemporaryFiles('*.sql');
I want to create an installer in Inno Setup which extracts the content of pre created Data.rar archive. I mean it should treat the contents of the rar archive as files and folders of application.
A generic way to use an external extraction utility with Inno Setup:
create the archive
embed the archive to the installer
embed a tool that can extract the archive to the installer
make the installer extract the archive and the tool to a temporary location on target machine - {tmp}
make the installer run the tool to extract the archive
[Files]
Source: "UnRAR.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall
Source: "Data.rar"; DestDir: "{tmp}"; Flags: deleteafterinstall nocompression
[Run]
Filename: "{tmp}\UnRAR.exe"; Parameters: "x ""{tmp}\Data.rar"" ""{app}"""
If you want to present a progress of the decompression, you will have to parse the UnRAR output. For an example (on Arc), see How to add .arc decompression to Inno Setup?
Or use UnRAR.dll, similarly as unarc.dll is used in Inno Setup - How to add cancel button to decompressing page?
Note that the UnRAR.exe tool is free and can be used for these purposes. An extract from its license.txt:
The UnRAR utility may be freely distributed. It is allowed
to distribute UnRAR inside of other software packages.
I want copy OutputBaseFileName to archive after Inno Setup Studio script compiling is finished.
I prepared this script but it doesn't work.
[PostCompile]
Name: CopyFile({#OutputBaseFilename}, '\\Bckserver\Source\'{#OutputBaseFilename});
I will guess that you want to have the compiler copy the generated installer to yet another directory (\\Bckserver\Source).
This works:
Name: "C:\Windows\System32\cmd.exe"; Parameters: "/c copy C:\path\setup.exe \\Bckserver\Source"
I do not think there's better solution, as Inno Setup Studio does not support preprocessor in the PostCompile section, so you cannot refer to OutputBaseFilename or system directory other than by hard-coding them.
I use Inno Setup for my product's installer/uninstaller. My software has auto-update capabilities during which time it may not only change existing binaries but may also add new ones. These are additional product files that are placed into the product's installation directory - not data files.
The Inno Setup uninstaller only knows to uninstall files by name that it originally put there at install time. Since an automatic update doesn't change either the unins000.exe or unins000.dat files that make up the uninstaller, what would be the appropriate way to delete these new product files at uninstall time?
The easiest way I see is to have a batch file in your program dir that deletes all files that were added after the installation and is executed on uninstall:
[UninstallRun]
Filename: cleanup.cmd; WorkingDir: {app}; Flags: shellexec runminimized
UninstallRun commands are executed as the first step of the uninstallation, so this should work fine. If you are bothered by the idea of running a batch script, you can easily create your own cleanup.exe that deletes the files.
When you perform the auto update, you must also update the cleanup file, so that it includes all files that were added with the current update.