如何使用 NSIS 制作更新安装程序?

发布于 2024-07-24 04:49:05 字数 92 浏览 8 评论 0原文

我目前有一个使用 NSIS 制作的安装程序的项目,但我希望更新到仅包含更改的文件并显示更改日志的新版本。 目标平台是windows。 你有什么方法/建议来做到这一点?

I currently have a project with an installer I made with NSIS, but I would like to have an update to new versions that only has the changed files and will show a changelog. The target platform is windows. What methods/suggestions do you have to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

-小熊_ 2024-07-31 04:49:05

您可能需要重新考虑使用 NSIS。 如果您热衷于修补和分发更新,您可能会从使用利用 Windows Installer 功能 (msiexec) 的安装程序技术中获得最大收益。

NSIS 基本上是一个运行并执行您想要的操作的程序,而 Windows Installer 类型的安装程序会强制您将应用程序拆分为可以由 Windows Installer msi 服务管理的功能和组件。 MSI 将跟踪您安装的产品版本、再次运行安装程序是否会在维护模式下运行、是否允许您安装 2 个不同版本的产品、补丁是否可以应用于产品的特定版本或与更新和安装相关的任何其他问题。

基本上,如果您更改为 Windows Installer 技术,您请求的大部分内容都可以开箱即用。 然而,如果您使用 NSIS(不使用 Windows Installer 技术),那么您将必须自己实现这一切。

举个例子,有一个非常全面的安装程序构建器,名为 AdvancedInstaller ( http://www.advancedinstaller.com/ )这听起来像你想要的。
或者,如果您想将余生花在搜索论坛和新闻组上,那么有一个名为 WiX 的开源产品可以做类似的事情;)

You might want to reconsider using NSIS. If you are into patching and distributing updates you will probably get the most benefit from using an installer technology that utilises the Windows Installer capabilities (msiexec).

NSIS is basically a program that runs and does what you want whereas a Windows Installer type installer forces you to split your application into features and components which can be managed by the windows installer msi service. MSI will track things like what versions of products you have installed, whether running the installer again will run in maintenance mode, whether you are allowed to install 2 products of different versions, whether a patch can be applied to a particular version of a product or any other question relating to updates and installs.

Basically most of the stuff you are requesting will be available out-of-the-box if you change to a Windows Installer technology. Whereas if you use NSIS (which doesn't use Windows Installer technology) then you will have to implement it all yourself.

Just as an example there is a pretty comprehensive installer builder called AdvancedInstaller ( http://www.advancedinstaller.com/ ) that sounds like what you want.
Alternatively, if you want to spend the rest of your life trawling forums and newsgroups then there is an open source product called WiX that does something similar ;)

放我走吧 2024-07-31 04:49:05

尽管我之前发表过评论,但我还是使用 NSIS 编写了一个包含 13 个自定义页面的 5000 行安装程序。 我什至看过修补程序,这有点麻烦。 主要的建议是确保您正在修补您认为正在修补的版本,然后使用可用的修补插件之一。

有几种修补技术可以比较文件并生成修补程序更改文件以及“安装”它们所需的 NSIS 代码。 我发现 NSIS Patch Gen 很好地完成了我想要的任务,而且麻烦最少。 文档有点薄,但是一旦你弄清楚了,你就会想“哦耶”。

自动生成的变更日志可能会给您带来一些麻烦。 我建议您自己创建更改日志(或者至少在您所做的每个应用程序更改时添加额外的更改),然后将其包含在内,就好像它是普通应用程序文件一样,然后让补丁生成器更新它。

http://sourceforge.net/projects/nsispatchgen/

In spite of my previous comment I have written a 5000 line installer using NSIS with 13 custom pages. I have even looked at patching and it's a bit of a hack. The main bit of advice is to make sure you are patching the version you think you are patching then use one of the patching plugins available.

There are several patching technologies that compare files and produce patch change files and the NSIS code required to "install" them. I have found that NSIS Patch Gen did what I wanted pretty well with the least amount of hassle. The documentation is a bit thin but once you figure it out you think "Oh yeh".

You are probably going to have a little bit of trouble with an automatically generated Change Log. I would suggest that you create the Change Log yourself (or at least add the extra changes to it with each application change you make) and just include it as if it was a normal application file and let the patch generator update it.

http://sourceforge.net/projects/nsispatchgen/

独自←快乐 2024-07-31 04:49:05

一种可能的方法是在下载服务器上存储一个 XML 文件,该文件包含每个发布的版本以及每个版本更改的文件列表。 安装程序会在安装其安装的文件版本时写入一个注册表项。

然后,在更新时,安装程​​序会下载并解析 XML 文件,并查找版本号高于当前安装版本的任何节点。 您将所有文件显示在安装程序页面上的文本框中,当用户确认时,安装程​​序将下载所有文件,然后将注册表更新到最新版本。

One possible way would be to store an XML file on your download server that has each released version and a list of files that changed for each release. The installer would write a registry key on install of the version of files it installed.

Then, on update, the installer downloads and parses the XML file, and finds any nodes that have higher version numbers than what is currently installed. You display all the files in a text box on an installer page, and when the user confirms, the installer downloads all the files, and then updates the registry to the latest version.

萌辣 2024-07-31 04:49:05

你熟悉cURL吗?
http://www.shininglightpro.com/products/Win32OpenSSL.html
http://curl.haxx.se/download.html#openssl

它将下载任何协议,您可以使用它来下载文件。 这是一个命令行应用程序。

在安装程序中,安排一个程序,该程序应首先检查主程序是否正在运行,如果正在运行则退出,如果没有运行,则调用curl从您的站点下载包含更新的批处理文件,然后运行该批处理文件。
它下载的批处理文件通过使用curl下载正确的文件来更新应用程序。
该过程可能每两周运行一次或每月一次,具体取决于您更新的频率。

安装程序的卸载部分应该能够删除有问题的应用程序的所有部分,包括任何更新。 这可以通过从程序文件的该子目录中删除所有文件来完成。

RMDir /r /REBOOTOK '$INSTDIR'
RMDir /r /REBOOTOK "$SMPROGRAMS\$StartMenuFolder"
Delete '$SMPROGRAMS\$StartMenuFolder\gpl3license.lnk'
Delete '$SMPROGRAMS\$StartMenuFolder\readme.lnk'
Delete '$SMPROGRAMS\$StartMenuFolder\${PRODUCT_TITLE}.lnk'
DeleteRegKey HKCU "Software\Your major subkey\${PRODUCT_NAME}"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
DeleteRegKey /ifempty HKCU "Software\${PRODUCT_NAME}"

PRODUCT_NAME 是我所做的一个 !define,因为我像模板一样使用这些 nsi 文件。
这只是安装程序文件的卸载程序部分的一部分。

are you familiar with cURL?
http://www.shininglightpro.com/products/Win32OpenSSL.html
http://curl.haxx.se/download.html#openssl

it will download any protocol, and you can use it to download your files. it's a commandline app.

in the installer, schedule a program which should check first to see if the main program is running or not and quit if it is running if not, calls curl to download a batch file from your site with the updates, then runs the batch file.
the batch file it downloads updates the app by downloading the correct files using curl.
the process should run maybe every 2 weeks or once a month, depending on how often you update.

the uninstall part of the installer should be capable of removing all parts of the app in question,including any updates. this can be accomplished by removing all files from that subdir of program files.

RMDir /r /REBOOTOK '$INSTDIR'
RMDir /r /REBOOTOK "$SMPROGRAMS\$StartMenuFolder"
Delete '$SMPROGRAMS\$StartMenuFolder\gpl3license.lnk'
Delete '$SMPROGRAMS\$StartMenuFolder\readme.lnk'
Delete '$SMPROGRAMS\$StartMenuFolder\${PRODUCT_TITLE}.lnk'
DeleteRegKey HKCU "Software\Your major subkey\${PRODUCT_NAME}"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
DeleteRegKey /ifempty HKCU "Software\${PRODUCT_NAME}"

PRODUCT_NAME is a !define I made because I use these nsi files like a template.
this is only a piece of the installer file's uninstaller section.

岁月无声 2024-07-31 04:49:05

即使您更改了代码的一小部分,像 Delphi 这样的一些编译器也会对最终的可执行文件进行大量更改。

因此,首先您应该看看是否值得修补。

另一个考虑因素是修补本身。
修补程序可能会被某些防病毒软件阻止,特别是在某些系统文件夹中。

最后,增量修补数据大小可能会超出原始文件。

基于以上主题我不建议你打补丁。
请改用完整安装程序

Some compilers like Delphi make a lot of changes in the final executable even if you change a little part of your code.

So first you should see if it worth patching.

Another consideration is patching by itself.
Patching maybe blocked by some Anti Virus Software specially in some system folders.

and finally incremental patching data size can grow beyond the original files.

Based on above subjects I don't suggest you patching.
Use full installers instead

看海 2024-07-31 04:49:05

我已经能够通过将应用程序发布到我的个人 CDN(或某些托管平台)并利用 Node.js 模块(如 path 替换二进制文件(使用与 equinox.io) 使用 CDN 中的给定版本和 winreg 来相应更新 Windows 注册表。 由于我已经对 Windows 注册表项进行了命名,因此卸载程序仍然可以使用它。

如果有人想了解更多详细信息,请询问。 我很乐意提供帮助。

I've been able to create a patch updater program for my Windows app (a CLI which uses NSIS as its installer) by releasing the app to my personal CDN (or some hosting platform) and taking advantage of Node.js modules like path to replace the binary (using a similar procedure to equinox.io) with a given version from the CDN and winreg to update the Windows Registry accordingly. Since I've namespaced my Windows Registry key, the uninstaller still works for it.

If anyone wants more details on this, please ask. I'm happy to help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文