Changeset View
Changeset View
Standalone View
Standalone View
bin/Packager/NullsoftInstaller.nsi
Show All 29 Lines | |||||
30 | !define startmenu "$SMPROGRAMS\@{productname}" | 30 | !define startmenu "$SMPROGRAMS\@{productname}" | ||
31 | !define uninstaller "uninstall.exe" | 31 | !define uninstaller "uninstall.exe" | ||
32 | 32 | | |||
33 | BrandingText "Generated by Craft https://community.kde.org/Craft" | 33 | BrandingText "Generated by Craft https://community.kde.org/Craft" | ||
34 | 34 | | |||
35 | ;-------------------------------- | 35 | ;-------------------------------- | ||
36 | 36 | | |||
37 | XPStyle on | 37 | XPStyle on | ||
38 | ShowInstDetails hide | 38 | | ||
39 | ShowUninstDetails hide | | |||
40 | 39 | | |||
41 | Name "@{productname}" | 40 | Name "@{productname}" | ||
42 | Caption "@{productname} @{version}" | 41 | Caption "@{productname} @{version}" | ||
43 | 42 | | |||
44 | OutFile "@{setupname}" | 43 | OutFile "@{setupname}" | ||
44 | | ||||
45 | !define MULTIUSER_EXECUTIONLEVEL Highest | ||||
46 | !define MULTIUSER_MUI | ||||
47 | !define MULTIUSER_INSTALLMODE_COMMANDLINE | ||||
48 | !define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "${regkey}" | ||||
49 | !define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "Install_Mode" | ||||
50 | !define MULTIUSER_INSTALLMODE_INSTDIR "@{productname}" | ||||
51 | !define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "${regkey}" | ||||
52 | !define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME "Install_Dir" | ||||
53 | | ||||
54 | ;!define MULTIUSER_USE_PROGRAMFILES64 | ||||
55 | @{multiuser_use_programfiles64} | ||||
56 | ;!define MULTIUSER_USE_PROGRAMFILES64 | ||||
57 | !include "MultiUser.nsh" | ||||
45 | !include "MUI2.nsh" | 58 | !include "MUI2.nsh" | ||
46 | !include "LogicLib.nsh" | 59 | !include "LogicLib.nsh" | ||
47 | !include "x64.nsh" | 60 | !include "x64.nsh" | ||
48 | 61 | | |||
49 | ;!define MUI_ICON | 62 | ;!define MUI_ICON | ||
50 | @{installerIcon} | 63 | @{installerIcon} | ||
51 | ;!define MUI_ICON | 64 | ;!define MUI_ICON | ||
52 | 65 | | |||
53 | !insertmacro MUI_PAGE_WELCOME | 66 | !insertmacro MUI_PAGE_WELCOME | ||
54 | 67 | | |||
55 | ;!insertmacro MUI_PAGE_LICENSE | 68 | ;!insertmacro MUI_PAGE_LICENSE | ||
56 | @{license} | 69 | @{license} | ||
57 | ;!insertmacro MUI_PAGE_LICENSE | 70 | ;!insertmacro MUI_PAGE_LICENSE | ||
58 | 71 | | |||
72 | !insertmacro MULTIUSER_PAGE_INSTALLMODE | ||||
59 | !insertmacro MUI_PAGE_DIRECTORY | 73 | !insertmacro MUI_PAGE_DIRECTORY | ||
60 | !insertmacro MUI_PAGE_INSTFILES | 74 | !insertmacro MUI_PAGE_INSTFILES | ||
61 | !insertmacro MUI_UNPAGE_CONFIRM | 75 | !insertmacro MUI_UNPAGE_CONFIRM | ||
62 | !insertmacro MUI_UNPAGE_INSTFILES | 76 | !insertmacro MUI_UNPAGE_INSTFILES | ||
63 | !define MUI_FINISHPAGE_LINK "Visit project homepage" | 77 | !define MUI_FINISHPAGE_LINK "Visit project homepage" | ||
64 | !define MUI_FINISHPAGE_LINK_LOCATION "@{website}" | 78 | !define MUI_FINISHPAGE_LINK_LOCATION "@{website}" | ||
65 | !insertmacro MUI_PAGE_FINISH | 79 | !insertmacro MUI_PAGE_FINISH | ||
66 | 80 | | |||
67 | !insertmacro MUI_LANGUAGE "English" | 81 | !insertmacro MUI_LANGUAGE "English" | ||
68 | 82 | | |||
69 | SetDateSave on | 83 | SetDateSave on | ||
70 | SetDatablockOptimize on | 84 | SetDatablockOptimize on | ||
71 | CRCCheck on | 85 | CRCCheck on | ||
72 | SilentInstall normal | 86 | SilentInstall normal | ||
73 | 87 | | |||
74 | InstallDir "@{defaultinstdir}\@{productname}" | | |||
75 | ; InstallDirRegKey must use HKLM | | |||
76 | InstallDirRegKey HKLM "${regkey}" "Install_Dir" | | |||
77 | | ||||
78 | Var /global ExistingInstallation | | |||
79 | | ||||
80 | Function .onInit | 88 | Function .onInit | ||
89 | !insertmacro MULTIUSER_INIT | ||||
81 | !if @{architecture} == "x64" | 90 | !if @{architecture} == "x64" | ||
82 | ${IfNot} ${RunningX64} | 91 | ${IfNot} ${RunningX64} | ||
83 | MessageBox MB_OK|MB_ICONEXCLAMATION "This installer can only be run on 64-bit Windows." | 92 | MessageBox MB_OK|MB_ICONEXCLAMATION "This installer can only be run on 64-bit Windows." | ||
84 | Abort | 93 | Abort | ||
85 | ${EndIf} | 94 | ${EndIf} | ||
86 | !endif | 95 | !endif | ||
87 | ;InstallDirRegKey must use HKLM | | |||
88 | ReadRegStr $R0 HKLM "${regkey}" "Install_Dir" | | |||
89 | ${IfNot} $R0 == "" | | |||
90 | StrCpy $ExistingInstallation $R0 | | |||
91 | ${EndIf} | | |||
92 | FunctionEnd | 96 | FunctionEnd | ||
93 | 97 | | |||
98 | Function un.onInit | ||||
99 | !insertmacro MULTIUSER_UNINIT | ||||
100 | FunctionEnd | ||||
94 | 101 | | |||
95 | ;-------------------------------- | 102 | ;-------------------------------- | ||
96 | 103 | | |||
97 | AutoCloseWindow false | 104 | AutoCloseWindow false | ||
98 | 105 | | |||
99 | 106 | | |||
100 | ; beginning (invisible) section | 107 | ; beginning (invisible) section | ||
101 | Section | 108 | Section | ||
102 | ${IfNot} $ExistingInstallation == "" | 109 | ExecWait '"$MultiUser.InstDir\${uninstaller}" /S _?=$MultiUser.InstDir' | ||
103 | ExecWait '"$ExistingInstallation\${uninstaller}" /S _?=$ExistingInstallation' | 110 | WriteRegStr SHCTX "${regkey}" "Install_Dir" "$INSTDIR" | ||
104 | ${EndIf} | 111 | WriteRegStr SHCTX "${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY}" "${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME}" "$MultiUser.InstallMode" | ||
105 | WriteRegStr @{HKLM} "${regkey}" "Install_Dir" "$INSTDIR" | | |||
106 | ; write uninstall strings | 112 | ; write uninstall strings | ||
107 | WriteRegStr @{HKLM} "${uninstkey}" "DisplayName" "@{productname}" | 113 | WriteRegStr SHCTX "${uninstkey}" "DisplayName" "@{productname}" | ||
108 | WriteRegStr @{HKLM} "${uninstkey}" "UninstallString" '"$INSTDIR\${uninstaller}"' | 114 | WriteRegStr SHCTX "${uninstkey}" "UninstallString" '"$INSTDIR\${uninstaller}"' | ||
109 | WriteRegStr @{HKLM} "${uninstkey}" "DisplayIcon" "$INSTDIR\@{iconname}" | 115 | WriteRegStr SHCTX "${uninstkey}" "DisplayIcon" "$INSTDIR\@{iconname}" | ||
110 | WriteRegStr @{HKLM} "${uninstkey}" "URLInfoAbout" "@{website}" | 116 | WriteRegStr SHCTX "${uninstkey}" "URLInfoAbout" "@{website}" | ||
111 | WriteRegStr @{HKLM} "${uninstkey}" "Publisher" "@{company}" | 117 | WriteRegStr SHCTX "${uninstkey}" "Publisher" "@{company}" | ||
112 | WriteRegStr @{HKLM} "${uninstkey}" "DisplayVersion" "@{version}" | 118 | WriteRegStr SHCTX "${uninstkey}" "DisplayVersion" "@{version}" | ||
113 | 119 | | |||
114 | @{registy_hook} | 120 | @{registy_hook} | ||
115 | 121 | | |||
116 | SetOutPath $INSTDIR | 122 | SetOutPath $INSTDIR | ||
117 | 123 | | |||
118 | 124 | | |||
119 | ; package all files, recursively, preserving attributes | 125 | ; package all files, recursively, preserving attributes | ||
120 | ; assume files are in the correct places | 126 | ; assume files are in the correct places | ||
Show All 26 Lines | |||||
147 | 153 | | |||
148 | UninstallText "This will uninstall @{productname}." | 154 | UninstallText "This will uninstall @{productname}." | ||
149 | 155 | | |||
150 | Section "Uninstall" | 156 | Section "Uninstall" | ||
151 | SetShellVarContext all | 157 | SetShellVarContext all | ||
152 | ; TODO: we need something independent of a tier3.... | 158 | ; TODO: we need something independent of a tier3.... | ||
153 | nsExec::ExecToLog '"$INSTDIR\bin\kdeinit5.exe" "--shutdown"' | 159 | nsExec::ExecToLog '"$INSTDIR\bin\kdeinit5.exe" "--shutdown"' | ||
154 | 160 | | |||
155 | DeleteRegKey @{HKLM} "${uninstkey}" | 161 | ${If} $MultiUser.InstallMode == "CurrentUser" | ||
156 | DeleteRegKey @{HKLM} "${regkey}" | 162 | SetShellVarContext current | ||
163 | ${EndIf} | ||||
164 | | ||||
165 | DeleteRegKey SHCTX "${uninstkey}" | ||||
166 | DeleteRegKey SHCTX "${regkey}" | ||||
157 | 167 | | |||
158 | Delete "${startmenu}\@{productname}.lnk" | 168 | Delete "${startmenu}\@{productname}.lnk" | ||
159 | Delete "${startmenu}\Uninstall.lnk" | 169 | Delete "${startmenu}\Uninstall.lnk" | ||
160 | 170 | | |||
161 | RMDir /r "${startmenu}" | 171 | RMDir /r "${startmenu}" | ||
162 | RMDir /r "$INSTDIR" | 172 | RMDir /r "$INSTDIR" | ||
163 | 173 | | |||
164 | SectionEnd | 174 | SectionEnd | ||
165 | 175 | |