1 ; basic script template for NullsoftInstallerPackager
3 ; Copyright 2013 Patrick von Reth <vonreth@kde.org>
4 ; Copyright 2010 Patrick Spendrin <ps_ml@gmx.de>
5 ; adapted from marble.nsi
10 !define productname "Quassel"
15 !include SnoreNotify.nsh
19 !define regkey "Software\${company}\${productname}"
20 !define uninstkey "Software\Microsoft\Windows\CurrentVersion\Uninstall\Quassel"
22 !define startmenu "$SMPROGRAMS\${productname}"
23 !define uninstaller "uninstall.exe"
27 !define PRODUCT_WEB_SITE http://quassel-irc.org/
28 !define MyApp_AppUserModelId QuasselProject.QuasselIRC
29 !define SnoreToastExe "$INSTDIR\SnoreToast.exe"
31 ;Start Menu Folder Page Configuration
32 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
33 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${regkey}"
34 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
37 ;--------------------------------
42 ShowUninstDetails hide
44 SetCompressor /SOLID lzma
49 OutFile "${setupname}"
51 !define MUI_ICON ${gitDir}\pics\quassel.ico
53 !insertmacro MUI_PAGE_WELCOME
55 ;!insertmacro MUI_PAGE_LICENSE
57 ;!insertmacro MUI_PAGE_LICENSE
59 !insertmacro MUI_PAGE_DIRECTORY
61 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
63 !define MUI_COMPONENTSPAGE_NODESC
64 !insertmacro MUI_PAGE_COMPONENTS
66 !insertmacro MUI_PAGE_INSTFILES
68 !define MUI_FINISHPAGE_RUN $ToBeRunned
69 !define MUI_FINISHPAGE_RUN_TEXT $nameOfToBeRunend
70 !define MUI_FINISHPAGE_LINK "Visit project homepage"
71 !define MUI_FINISHPAGE_LINK_LOCATION "${PRODUCT_WEB_SITE}"
72 !insertmacro MUI_PAGE_FINISH
75 !insertmacro MUI_UNPAGE_WELCOME
76 !insertmacro MUI_UNPAGE_CONFIRM
77 !insertmacro MUI_UNPAGE_INSTFILES
78 !insertmacro MUI_UNPAGE_FINISH
81 !insertmacro MUI_LANGUAGE "English"
84 SetDatablockOptimize on
88 InstallDir "${defaultinstdir}\${productname}"
89 InstallDirRegKey HKLM "${regkey}" ""
92 ;--------------------------------
96 ; beginning (invisible) section
97 Section "--hidden Quassel Base" QUASSEL_BASE
100 SetShellVarContext all
101 StrCpy $ToBeRunned ""
103 WriteRegStr HKLM "${regkey}" "Install_Dir" "$INSTDIR"
104 WriteRegStr HKLM "${regkey}" "Version" "${version}"
105 WriteRegStr HKLM "${regkey}" "" "$INSTDIR\uninstall.exe"
107 WriteRegStr HKLM "${uninstkey}" "DisplayName" "Quassel (remove only)"
108 WriteRegStr HKLM "${uninstkey}" "DisplayIcon" "$INSTDIR\${MUI_ICON}"
109 WriteRegStr HKLM "${uninstkey}" "DisplayVersion" "${version}"
110 WriteRegStr HKLM "${uninstkey}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
111 WriteRegStr HKLM "${uninstkey}" "UninstallString" '"$INSTDIR\${uninstaller}"'
112 WriteRegStr HKLM "${uninstkey}" "Publisher" "${company}"
117 ; package all files, recursively, preserving attributes
118 ; assume files are in the correct places
120 File /a /r /x "*.nsi" /x "*quassel.exe" /x "*quasselclient.exe" /x "*quasselcore.exe" /x "${setupname}" "${srcdir}\*.*"
123 !if "${vcredist}" != "none"
124 File /a /oname=vcredist.exe "${vcredist}"
125 ExecWait '"$INSTDIR\vcredist.exe" /passive'
126 Delete "$INSTDIR\vcredist.exe"
129 WriteUninstaller "${uninstaller}"
133 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
134 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
135 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\uninstall.exe"
136 !insertmacro MUI_STARTMENU_WRITE_END
140 Section "Quassel" QUASSEL_ALL_IN_ONE
143 StrCpy $ToBeRunned "$INSTDIR\quassel.exe"
144 StrCpy $nameOfToBeRunend "Run Quassel"
145 File /a /oname=quassel.exe "${srcdir}\quassel.exe"
146 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
147 !insertmacro SnoreShortcut "$SMPROGRAMS\$StartMenuFolder\Quassel.lnk" "$INSTDIR\quassel.exe" "${MyApp_AppUserModelId}"
148 !insertmacro MUI_STARTMENU_WRITE_END
151 Section "QuasselClient" QUASSEL_CLIENT
154 ${If} $ToBeRunned == ""
155 StrCpy $ToBeRunned "$INSTDIR\quasselclient.exe"
156 StrCpy $nameOfToBeRunend "Run QuasselClient"
158 File /a /oname=quasselclient.exe "${srcdir}\quasselclient.exe"
159 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
160 !insertmacro SnoreShortcut "$SMPROGRAMS\$StartMenuFolder\Quassel Client.lnk" "$INSTDIR\quasselclient.exe" "${MyApp_AppUserModelId}"
161 !insertmacro MUI_STARTMENU_WRITE_END
164 Section "QuasselCore" QUASSEL_CORE
167 ${If} $ToBeRunned == ""
168 StrCpy $ToBeRunned "$INSTDIR\quasselcore.exe"
169 StrCpy $nameOfToBeRunend "Run QuasselCore"
171 File /a /oname=quasselcore.exe "${srcdir}\quasselcore.exe"
172 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
173 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Quassel Core.lnk" "$INSTDIR\quasselcore.exe"
174 !insertmacro MUI_STARTMENU_WRITE_END
177 ; Section /o "QuasselCoreService" QUASSEL_CORE_SERVICE
178 ; SimpleSC::ExistsService "QuasselCore"
179 ; Pop $0 ; returns an errorcode if the service doesn't exists (<>0)/service exists (0)
181 ; MessageBox MB_OK|MB_ICONSTOP "Install Service QUassel failed - Reason: Service already exists"
183 ; SimpleSC::InstallService "QuasselCore" "QuasselCore" "16" "2" "$INSTDIR\bin\quasselcore.exe" "" "" ""
184 ; Pop $0 ; returns an errorcode (<>0) otherwise success (0)
187 ; SimpleSC::GetErrorMessage
189 ; MessageBox MB_OK|MB_ICONSTOP "Install of Service QUassel failed - Reason: $0"
191 ; SimpleSC::StartService "QuasselCore" "" 30
192 ; Pop $0 ; returns an errorcode (<>0) otherwise success (0)
195 ; SimpleSC::GetErrorMessage
197 ; MessageBox MB_OK|MB_ICONSTOP "Install of Service QUassel failed - Reason: $0"
204 ; All section names prefixed by "Un" will be in the uninstaller
206 UninstallText "This will uninstall Quassel."
209 SetShellVarContext all
210 SetShellVarContext all
212 DeleteRegKey HKLM "${uninstkey}"
213 DeleteRegKey HKLM "${regkey}"
215 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
218 ; SimpleSC::ExistsService "QuasselCore"
219 ; Pop $0 ; returns an errorcode if the service doesn't exists (<>0)/service exists (0)
221 ; SimpleSC::ServiceIsStopped "QuasselCore"
222 ; Pop $0 ; returns an errorcode (<>0) otherwise success (0)
223 ; Pop $1 ; returns 1 (service is stopped) - returns 0 (service is not stopped)
226 ; SimpleSC::StopService "QuasselCore" 1 30
227 ; Pop $0 ; returns an errorcode (<>0) otherwise success (0)
230 ; SimpleSC::GetErrorMessage
232 ; MessageBox MB_OK|MB_ICONSTOP "Stopping failed - Reason: $0"
234 ; SimpleSC::RemoveService "QuasselCore"
235 ; Pop $0 ; returns an errorcode (<>0) otherwise success (0)
238 ; SimpleSC::GetErrorMessage
240 ; MessageBox MB_OK|MB_ICONSTOP "Remove fails - Reason: $0"
246 RMDir /r "$SMPROGRAMS\$StartMenuFolder"
250 Function .onSelChange
251 ${If} ${SectionIsSelected} ${QUASSEL_CORE}
252 ${OrIf} ${SectionIsSelected} ${QUASSEL_CLIENT}
253 ${OrIf} ${SectionIsSelected} ${QUASSEL_ALL_IN_ONE}
254 GetDlgItem $0 $HWNDPARENT 1
257 GetDlgItem $0 $HWNDPARENT 1
263 ReadRegStr $R0 HKLM "${uninstkey}" "UninstallString"
265 ReadRegStr $INSTDIR HKLM "${regkey}" "Install_Dir"
269 ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file