diff --git a/bin/Packager/NullsoftInstaller.nsi b/bin/Packager/NullsoftInstaller.nsi index 01399396b..ea61a9265 100644 --- a/bin/Packager/NullsoftInstaller.nsi +++ b/bin/Packager/NullsoftInstaller.nsi @@ -1,150 +1,170 @@ -; basic script template for NullsoftInstallerPackager -; ; Copyright 2010 Patrick Spendrin ; Copyright 2016 Kevin Funk +; Copyright Hannah von Reth +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions +; are met: +; 1. Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; 2. Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; +; THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +; ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +; SUCH DAMAGE. ; registry stuff !define regkey "Software\@{company}\@{productname}" !define uninstkey "Software\Microsoft\Windows\CurrentVersion\Uninstall\@{productname}" !define startmenu "$SMPROGRAMS\@{productname}" !define uninstaller "uninstall.exe" BrandingText "Generated by Craft https://community.kde.org/Craft" ;-------------------------------- XPStyle on ShowInstDetails hide ShowUninstDetails hide SetCompressor /SOLID lzma Name "@{productname}" Caption "@{productname} @{version}" OutFile "@{setupname}" !include "MUI2.nsh" !include "LogicLib.nsh" !include "x64.nsh" ;!define MUI_ICON @{installerIcon} ;!define MUI_ICON !insertmacro MUI_PAGE_WELCOME ;!insertmacro MUI_PAGE_LICENSE @{license} ;!insertmacro MUI_PAGE_LICENSE !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !define MUI_FINISHPAGE_LINK "Visit project homepage" !define MUI_FINISHPAGE_LINK_LOCATION "@{website}" !insertmacro MUI_PAGE_FINISH !insertmacro MUI_LANGUAGE "English" SetDateSave on SetDatablockOptimize on CRCCheck on SilentInstall normal InstallDir "@{defaultinstdir}\@{productname}" ; InstallDirRegKey must use HKLM InstallDirRegKey HKLM "${regkey}" "Install_Dir" Var /global ExistingInstallation Function .onInit !if @{architecture} == "x64" ${IfNot} ${RunningX64} MessageBox MB_OK|MB_ICONEXCLAMATION "This installer can only be run on 64-bit Windows." Abort ${EndIf} !endif ;InstallDirRegKey must use HKLM ReadRegStr $R0 HKLM "${regkey}" "Install_Dir" ${IfNot} $R0 == "" StrCpy $ExistingInstallation $R0 ${EndIf} FunctionEnd ;-------------------------------- AutoCloseWindow false ; beginning (invisible) section Section ${IfNot} $ExistingInstallation == "" ExecWait '"$ExistingInstallation\${uninstaller}" /S _?=$ExistingInstallation' ${EndIf} WriteRegStr @{HKLM} "${regkey}" "Install_Dir" "$INSTDIR" ; write uninstall strings WriteRegStr @{HKLM} "${uninstkey}" "DisplayName" "@{productname}" WriteRegStr @{HKLM} "${uninstkey}" "UninstallString" '"$INSTDIR\${uninstaller}"' WriteRegStr @{HKLM} "${uninstkey}" "DisplayIcon" "$INSTDIR\@{iconname}" WriteRegStr @{HKLM} "${uninstkey}" "URLInfoAbout" "@{website}" WriteRegStr @{HKLM} "${uninstkey}" "Publisher" "@{company}" WriteRegStr @{HKLM} "${uninstkey}" "DisplayVersion" "@{version}" @{registy_hook} SetOutPath $INSTDIR ; package all files, recursively, preserving attributes ; assume files are in the correct places File /a /r "@{srcdir}\*.*" File /a "@{icon}" WriteUninstaller "${uninstaller}" SectionEnd ; create shortcuts Section SetShellVarContext all CreateDirectory "${startmenu}" SetOutPath $INSTDIR ; for working directory @{shortcuts} CreateShortCut "${startmenu}\Uninstall.lnk" "$INSTDIR\uninstall.exe" SectionEnd ;post install Section SetOutPath "$INSTDIR" !if "@{vcredist}" != "none" File /a /oname=vcredist.exe "@{vcredist}" ExecWait '"$INSTDIR\vcredist.exe" /passive /norestart' !endif Delete "$INSTDIR\vcredist.exe" SectionEnd ; Uninstaller ; All section names prefixed by "Un" will be in the uninstaller UninstallText "This will uninstall @{productname}." Section "Uninstall" SetShellVarContext all ; TODO: we need something independent of a tier3.... ExecWait '"$INSTDIR\bin\kdeinit5.exe" "--shutdown"' DeleteRegKey @{HKLM} "${uninstkey}" DeleteRegKey @{HKLM} "${regkey}" Delete "${startmenu}\@{productname}.lnk" Delete "${startmenu}\Uninstall.lnk" RMDir /r "${startmenu}" RMDir /r "$INSTDIR" SectionEnd