In practical applications, in addition to product installation, it is also necessary to continuously upgrade to new versions. At this point, the upgrade solution becomes crucial. There are also some scenarios where our installation package should install silently in the background without displaying the installation interface!
These business functionalities are practical and necessary, and we certainly won't overlook them! The nsNiuniuSkin installation package packaging solution, as it has evolved to today, is no longer just a plugin for beautifying installation package UI. It has become a complete package creation and upgrade solution, where the UI interface is just one aspect of it. We continue to focus on every detail, creating products that are refined and beautiful!
In our solution, the product installation package and product upgrade package are the same installation package. Regular installation packages and silent installation packages are also the same package. That is, the same installation package has the ability for the initial installation, upgrade installation, silent installation, etc. You only need to pass different command-line parameters when running the installation package.
There are typically two ways the installation package is launched:
When creating the installation package, we have embedded several command-line parameters into the package so that they can be quickly applied in subsequent upgrade and silent installation scenarios.
Parameter Name | Parameter Description | Example |
---|---|---|
-AutoInstall | Whether to start the installation automatically | -AutoInstall=1 |
-AutoOpen | Whether to automatically open the main program after installation | -AutoOpen=1 |
-fakecmd | Placeholder command with no practical meaning | -fakecmd=1 |
/S | Used to specify whether it is a silent installation | /S |
/D | Used to specify the installation path | /D=E:\Software\Test\ |
Among these, /S and /D are NSIS built-in commands, and the code for interpreting the other parameters is as follows. After parsing them, we will control the subsequent installation behavior based on the relevant flags in the installation script:
Function InstallParamCheck
; Get the command-line parameters of the installation package to determine whether it is an upgrade or silent installation
; -fakecmd=1 serves as a placeholder. When calling, please keep it and ensure the order of each parameter, or parsing issues may occur
; Setup.exe -AutoInstall=1 -AutoOpen=1 -fakecmd=1 /S /D=E:\Software\Test\
; test
StrCpy $sCmdAutoInstall "0"
${Getparameters} $R0
; Parse parameter data
${GetOptions} $R0 "-AutoInstall=" $sCmdAutoInstall
${GetOptions} $R0 "-AutoOpen=" $sCmdOpenWhenFinished
FunctionEnd
Next, let's see how to apply this:
The general logic for upgrading software products is as follows:
During the startup or runtime of the software main program, check for a new version. This is usually done by obtaining the local version of the software, calling the server-side version checking interface to determine if there is a new version for upgrade, and obtaining the download address of the new version installation package (upgrade package).
In the software main program, download the installation package of the new version locally.
In the software main program, call the newly downloaded installation package, passing specific command-line parameters (passing the current main program directory for overwriting the original program files) to perform the upgrade.
After the installation of the new version installation package is completed, automatically launch the new software main program, completing the upgrade.
For example, in the directory where the nsNiuniuSkin Interface Online Design Engine installation package is located, by entering the following command in the command line, you can specify the installation directory and start the installation automatically:
NSNiuniuSKin_DuiDesigner_Setup.exe -AutoInstall=1 -AutoOpen=1 -fakecmd=1 /D=E:\Software\Test\
Note:
In this process, points 1 and 2, and point 3 are things that the software product needs to handle on its own. For various software vendors, this is also a straightforward task. nsNiuniuSkin's role in this process is:
This way, the process of software upgrade becomes clearer, right? It's important to note that we don't do incremental upgrades; what we do is automatically overwrite the installation package to achieve version upgrades.
Silent installation is not very common in regular installation processes, but it does have its applications. For example, when installing your own product, you may need to rely on the functionality of a third-party product, or you may need to install your own product simultaneously when installing other products. This is where the role of silent installation comes into play.
The nsNiuniuSkin installation package packaging solution sets the silent installation flag by parsing command-line parameters. It then routes the entire installation process to the normal installation behavior, ensuring consistency with the behavior of regular installation packages without displaying any interfaces. This avoids the need to maintain two different installation logic branches for regular and silent installations.
At the same time, silent installation can also specify the path to which the software should be installed. If not specified, it will be installed using the default installation path of the installation package.
For example, in the directory where the nsNiuniuSkin Interface Online Design Engine installation package is located, by entering the following command in the command line, you can specify the installation directory and start silent installation automatically:
NSNiuniuSKin_DuiDesigner_Setup.exe -AutoOpen=1 -fakecmd=1 /S /D=E:\Software\Test\
Compared to the software upgrade process, silent installation mainly adds an /S parameter to determine whether it is a silent installation. When running, the installation package launched with this parameter will have no interface display. At the same time, there is no need to specify whether to start the installation automatically; silent installations always start automatically.
If you want to silently install our installation package in an NSIS installation package, the script can be written like this:
ExecWait '"$INSTDIR\NSNiuniuSKin_DuiDesigner_Setup.exe" -AutoOpen=0 -fakecmd=1 /S /D=E:\Software\Test\'
Does your product also need such functionality? How do you plan to implement it? Let's discuss it together!
You can also download our nsNiuniuSkin Interface Online Design Engine installation package and test it: http://www.ggniu.com/download/NSNiuniuSKin_DuiDesigner_Setup.exe
In the installation package installation process, a beautiful UI can often leave customers with a more profound impression of the installed product, reflecting the software service provider's focus and dedication to user experience! We hope our efforts can make installation package creation a bit easier and more enjoyable!
May there be no difficult installation packages in the world!