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"
38 ;--------------------------------
43 ShowUninstDetails hide
45 SetCompressor /SOLID lzma
50 OutFile "${setupname}"
52 !define MUI_ICON ${gitDir}\pics\quassel.ico
54 !insertmacro MUI_PAGE_WELCOME
56 ;!insertmacro MUI_PAGE_LICENSE
58 ;!insertmacro MUI_PAGE_LICENSE
60 !insertmacro MUI_PAGE_DIRECTORY
62 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
64 !define MUI_COMPONENTSPAGE_NODESC
65 !insertmacro MUI_PAGE_COMPONENTS
67 !insertmacro MUI_PAGE_INSTFILES
69 !define MUI_FINISHPAGE_RUN $ToBeRunned
70 !define MUI_FINISHPAGE_RUN_TEXT $nameOfToBeRunend
71 !define MUI_FINISHPAGE_LINK "Visit project homepage"
72 !define MUI_FINISHPAGE_LINK_LOCATION "${PRODUCT_WEB_SITE}"
73 !insertmacro MUI_PAGE_FINISH
76 !insertmacro MUI_UNPAGE_WELCOME
77 !insertmacro MUI_UNPAGE_CONFIRM
78 !insertmacro MUI_UNPAGE_INSTFILES
79 !insertmacro MUI_UNPAGE_FINISH
82 !insertmacro MUI_LANGUAGE "English"
85 SetDatablockOptimize on
89 InstallDir "$PROGRAMFILES\${productname}"
90 InstallDirRegKey HKLM "${regkey}" ""
93 ;--------------------------------
97 ; beginning (invisible) section
98 Section "--hidden Quassel Base" QUASSEL_BASE
101 SetShellVarContext all
102 StrCpy $ToBeRunned ""
104 WriteRegStr HKLM "${regkey}" "Install_Dir" "$INSTDIR"
105 WriteRegStr HKLM "${regkey}" "Version" "${version}"
106 WriteRegStr HKLM "${regkey}" "" "$INSTDIR\uninstall.exe"
108 WriteRegStr HKLM "${uninstkey}" "DisplayName" "Quassel (remove only)"
109 WriteRegStr HKLM "${uninstkey}" "DisplayIcon" "$INSTDIR\${MUI_ICON}"
110 WriteRegStr HKLM "${uninstkey}" "DisplayVersion" "${version}"
111 WriteRegStr HKLM "${uninstkey}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
112 WriteRegStr HKLM "${uninstkey}" "UninstallString" '"$INSTDIR\${uninstaller}"'
113 WriteRegStr HKLM "${uninstkey}" "Publisher" "${company}"
118 ; package all files, recursively, preserving attributes
119 ; assume files are in the correct places
121 File /a /r /x "*.nsi" /x "*quassel.exe" /x "*quasselclient.exe" /x "*quasselcore.exe" /x "${setupname}" "${srcdir}\*.*"
124 !if "${vcredist}" != "none"
125 File /a /oname=vcredist.exe "${vcredist}"
126 ExecWait '"$INSTDIR\vcredist.exe" /passive'
127 Delete "$INSTDIR\vcredist.exe"
130 WriteUninstaller "${uninstaller}"
134 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
135 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
136 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\uninstall.exe"
137 !insertmacro MUI_STARTMENU_WRITE_END
141 Section "Quassel" QUASSEL_ALL_IN_ONE
144 StrCpy $ToBeRunned "$INSTDIR\quassel.exe"
145 StrCpy $nameOfToBeRunend "Run Quassel"
146 File /a /oname=quassel.exe "${srcdir}\quassel.exe"
147 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
148 !insertmacro SnoreShortcut "$SMPROGRAMS\$StartMenuFolder\Quassel.lnk" "$INSTDIR\quassel.exe" "${MyApp_AppUserModelId}"
149 !insertmacro MUI_STARTMENU_WRITE_END
152 Section /o "QuasselClient" QUASSEL_CLIENT
155 ${If} $ToBeRunned == ""
156 StrCpy $ToBeRunned "$INSTDIR\quasselclient.exe"
157 StrCpy $nameOfToBeRunend "Run QuasselClient"
159 File /a /oname=quasselclient.exe "${srcdir}\quasselclient.exe"
160 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
161 !insertmacro SnoreShortcut "$SMPROGRAMS\$StartMenuFolder\Quassel Client.lnk" "$INSTDIR\quasselclient.exe" "${MyApp_AppUserModelId}"
162 !insertmacro MUI_STARTMENU_WRITE_END
165 Section /o "QuasselCore" QUASSEL_CORE
168 ${If} $ToBeRunned == ""
169 StrCpy $ToBeRunned "$INSTDIR\quasselcore.exe"
170 StrCpy $nameOfToBeRunend "Run QuasselCore"
172 File /a /oname=quasselcore.exe "${srcdir}\quasselcore.exe"
173 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
174 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Quassel Core.lnk" "$INSTDIR\quasselcore.exe"
175 !insertmacro MUI_STARTMENU_WRITE_END
178 ; Section /o "QuasselCoreService" QUASSEL_CORE_SERVICE
179 ; SimpleSC::ExistsService "QuasselCore"
180 ; Pop $0 ; returns an errorcode if the service doesn't exists (<>0)/service exists (0)
182 ; MessageBox MB_OK|MB_ICONSTOP "Install Service QUassel failed - Reason: Service already exists"
184 ; SimpleSC::InstallService "QuasselCore" "QuasselCore" "16" "2" "$INSTDIR\bin\quasselcore.exe" "" "" ""
185 ; Pop $0 ; returns an errorcode (<>0) otherwise success (0)
188 ; SimpleSC::GetErrorMessage
190 ; MessageBox MB_OK|MB_ICONSTOP "Install of Service QUassel failed - Reason: $0"
192 ; SimpleSC::StartService "QuasselCore" "" 30
193 ; Pop $0 ; returns an errorcode (<>0) otherwise success (0)
196 ; SimpleSC::GetErrorMessage
198 ; MessageBox MB_OK|MB_ICONSTOP "Install of Service QUassel failed - Reason: $0"
205 ; All section names prefixed by "Un" will be in the uninstaller
207 UninstallText "This will uninstall Quassel."
210 SetShellVarContext all
211 SetShellVarContext all
213 DeleteRegKey HKLM "${uninstkey}"
214 DeleteRegKey HKLM "${regkey}"
216 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
219 ; SimpleSC::ExistsService "QuasselCore"
220 ; Pop $0 ; returns an errorcode if the service doesn't exists (<>0)/service exists (0)
222 ; SimpleSC::ServiceIsStopped "QuasselCore"
223 ; Pop $0 ; returns an errorcode (<>0) otherwise success (0)
224 ; Pop $1 ; returns 1 (service is stopped) - returns 0 (service is not stopped)
227 ; SimpleSC::StopService "QuasselCore" 1 30
228 ; Pop $0 ; returns an errorcode (<>0) otherwise success (0)
231 ; SimpleSC::GetErrorMessage
233 ; MessageBox MB_OK|MB_ICONSTOP "Stopping failed - Reason: $0"
235 ; SimpleSC::RemoveService "QuasselCore"
236 ; Pop $0 ; returns an errorcode (<>0) otherwise success (0)
239 ; SimpleSC::GetErrorMessage
241 ; MessageBox MB_OK|MB_ICONSTOP "Remove fails - Reason: $0"
247 RMDir /r "$SMPROGRAMS\$StartMenuFolder"
251 Function .onSelChange
252 ${If} ${SectionIsSelected} ${QUASSEL_CORE}
253 ${OrIf} ${SectionIsSelected} ${QUASSEL_CLIENT}
254 ${OrIf} ${SectionIsSelected} ${QUASSEL_ALL_IN_ONE}
255 GetDlgItem $0 $HWNDPARENT 1
258 GetDlgItem $0 $HWNDPARENT 1
264 ReadRegStr $R0 HKLM "${uninstkey}" "UninstallString"
266 ReadRegStr $INSTDIR HKLM "${regkey}" "Install_Dir"
270 ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file