| 1 |
; vim: ts=4:sw=4:expandtab |
| 2 |
; |
| 3 |
; BleachBit |
| 4 |
; Copyright (C) 2008-2025 Andrew Ziem |
| 5 |
; https://www.bleachbit.org |
| 6 |
; |
| 7 |
; This program is free software: you can redistribute it and/or modify |
| 8 |
; it under the terms of the GNU General Public License as published by |
| 9 |
; the Free Software Foundation, either version 3 of the License, or |
| 10 |
; (at your option) any later version. |
| 11 |
; |
| 12 |
; This program is distributed in the hope that it will be useful, |
| 13 |
; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
; GNU General Public License for more details. |
| 16 |
; |
| 17 |
; You should have received a copy of the GNU General Public License |
| 18 |
; along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
|
| 20 |
; @scriptversion v3.0.1.1429 |
| 21 |
; @scriptdate 2019-12-01 |
| 22 |
|
| 23 |
|
| 24 |
;-------------------------------- |
| 25 |
;Pack header: |
| 26 |
|
| 27 |
; Compress installer exehead with an executable compressor. |
| 28 |
|
| 29 |
; Paths should be absolute to allow building from any location. |
| 30 |
; Note that your executable compressor should not compress the first icon. |
| 31 |
|
| 32 |
!ifdef packhdr |
| 33 |
;Using UPX path info from windows/setup.py -> |
| 34 |
!ifndef UPX_EXE |
| 35 |
!error "packhdr is defined but UPX_EXE is not. Pass /DUPX_EXE=<path> to makensis." |
| 36 |
!endif |
| 37 |
!packhdr "$%TEMP%\exehead.tmp" '"${UPX_EXE}" -9 -q "$%TEMP%\exehead.tmp"' |
| 38 |
!endif |
| 39 |
|
| 40 |
|
| 41 |
;-------------------------------- |
| 42 |
;Include Modern UI |
| 43 |
|
| 44 |
!include "MUI2.nsh" |
| 45 |
|
| 46 |
|
| 47 |
;-------------------------------- |
| 48 |
;General |
| 49 |
|
| 50 |
;Name and file |
| 51 |
!define prodname "BleachBit" |
| 52 |
!define COMPANY_NAME "BleachBit" ; # used by NsisMultiUser |
| 53 |
!define PROG_AUTHOR "Andrew Ziem" |
| 54 |
!define PROG_COPYRIGHT "Andrew Ziem" |
| 55 |
BrandingText "${PROG_COPYRIGHT}" |
| 56 |
Name "${prodname}" |
| 57 |
; ----------------------------- disable warning overwrite default language strings (wrn 6030) |
| 58 |
;!pragma warning disable 6030 |
| 59 |
; ----------------------------- disable warning missing strings in some not english section (wrn 6040) |
| 60 |
;!pragma warning disable 6040 |
| 61 |
|
| 62 |
!ifdef NoTranslations |
| 63 |
OutFile "${prodname}-${VERSION}-setup-English.exe" |
| 64 |
!else |
| 65 |
OutFile "${prodname}-${VERSION}-setup.exe" |
| 66 |
!endif |
| 67 |
|
| 68 |
; Unicode requires NSIS version 3 or later |
| 69 |
Unicode true |
| 70 |
|
| 71 |
|
| 72 |
;-------------------------------- |
| 73 |
;MultiUser defines |
| 74 |
|
| 75 |
; https://github.com/Drizin/NsisMultiUser/wiki/Defines |
| 76 |
!define PRODUCT_NAME "${prodname}" ; exact copy to another name for multi-user script |
| 77 |
; !define VERSION "2.3" |
| 78 |
; "VERSION" already defined! |
| 79 |
!define PROGEXE "${prodname}.exe" |
| 80 |
; !define COMPANY_NAME "BleachBit" |
| 81 |
; "COMPANY_NAME" already defined! |
| 82 |
|
| 83 |
; An option (MULTIUSER_INSTALLMODE_ALLOW_BOTH_INSTALLATIONS) defines whether simultaneous per-user |
| 84 |
; and per-machine installations on the same machine are allowed. If set to disallow, the installer |
| 85 |
; always requires elevation when there's per-machine installation in order to remove it first. |
| 86 |
!define MULTIUSER_INSTALLMODE_ALLOW_BOTH_INSTALLATIONS 0 |
| 87 |
; Decision to don't ALLOW_BOTH_INSTALLATIONS was, because it's just to risky to have to versions |
| 88 |
; installed at the same time and BB maybe run into unknown issues. |
| 89 |
; This means now, that maybe a per-machine installation gets deinstalled and a per-user installation |
| 90 |
; gets preferenced! |
| 91 |
|
| 92 |
; An option (MULTIUSER_INSTALLMODE_ALLOW_ELEVATION) defines whether elevation if allowed. |
| 93 |
; If elevation is disabled, the per-machine option becomes available only if the (un)installer |
| 94 |
; is started elevated from Windows and is disabled otherwise. |
| 95 |
!define MULTIUSER_INSTALLMODE_ALLOW_ELEVATION 1 |
| 96 |
|
| 97 |
!define MULTIUSER_INSTALLMODE_ALLOW_ELEVATION_IF_SILENT 0 |
| 98 |
|
| 99 |
; MULTIUSER_INSTALLMODE_DEFAULT_ALLUSERS: |
| 100 |
; 0 or 1, (only available if MULTIUSER_INSTALLMODE_ALLOW_ELEVATION = 1 and there are 0 or 2 installations |
| 101 |
; on the system) when running as user and is set to 1, per-machine installation is pre-selected, otherwise |
| 102 |
; per-user installation. |
| 103 |
!define MULTIUSER_INSTALLMODE_DEFAULT_ALLUSERS 1 |
| 104 |
|
| 105 |
; MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER: |
| 106 |
; 0 or 1, (only available if there are 0 or 2 installations on the system) when running as admin and |
| 107 |
; is set to 1, per-user installation is pre-selected, otherwise per-machine installation. |
| 108 |
!define MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER 0 |
| 109 |
|
| 110 |
!define MULTIUSER_INSTALLMODE_64_BIT 0 |
| 111 |
!define MULTIUSER_INSTALLMODE_INSTDIR "${prodname}" |
| 112 |
|
| 113 |
|
| 114 |
;-------------------------------- |
| 115 |
;Installer-/UnInstaller-Attributes - Version Information |
| 116 |
; https://nsis.sourceforge.io/Docs/Chapter4.html#versioninfo |
| 117 |
|
| 118 |
;!define File_VERSION 2.3.0.0 |
| 119 |
; Later: |
| 120 |
!define File_VERSION ${VERSION}.0 |
| 121 |
|
| 122 |
!ifdef NoTranslations |
| 123 |
VIAddVersionKey /LANG=1033 "ProductName" "${prodname}" |
| 124 |
VIAddVersionKey /LANG=1033 "ProductVersion" "${File_VERSION}" |
| 125 |
VIAddVersionKey /LANG=1033 "Comments" "" |
| 126 |
VIAddVersionKey /LANG=1033 "CompanyName" "BleachBit.org" |
| 127 |
VIAddVersionKey /LANG=1033 "LegalTrademarks" "${PROG_AUTHOR}" |
| 128 |
VIAddVersionKey /LANG=1033 "LegalCopyright" "${PROG_COPYRIGHT}" |
| 129 |
VIAddVersionKey /LANG=1033 "FileVersion" "${File_VERSION}" |
| 130 |
VIAddVersionKey /LANG=1033 "FileDescription" "${prodname} Setup" |
| 131 |
!endif |
| 132 |
|
| 133 |
!ifndef NoTranslations |
| 134 |
VIAddVersionKey /LANG=0 "ProductName" "${prodname}" |
| 135 |
VIAddVersionKey /LANG=0 "ProductVersion" "${File_VERSION}" |
| 136 |
VIAddVersionKey /LANG=0 "Comments" "" |
| 137 |
VIAddVersionKey /LANG=0 "CompanyName" "BleachBit.org" |
| 138 |
VIAddVersionKey /LANG=0 "LegalTrademarks" "${PROG_AUTHOR}" |
| 139 |
VIAddVersionKey /LANG=0 "LegalCopyright" "${PROG_COPYRIGHT}" |
| 140 |
VIAddVersionKey /LANG=0 "FileVersion" "${File_VERSION}" |
| 141 |
VIAddVersionKey /LANG=0 "FileDescription" "${prodname} Setup" |
| 142 |
!endif |
| 143 |
|
| 144 |
; VIAddVersionKey "InternalName" "" |
| 145 |
; VIAddVersionKey "OriginalFilename" "" |
| 146 |
|
| 147 |
VIProductVersion ${File_VERSION} |
| 148 |
VIFileVersion ${File_VERSION} |
| 149 |
|
| 150 |
|
| 151 |
;-------------------------------- |
| 152 |
;Default installation folder |
| 153 |
; NsisMultiUser sets the directory. |
| 154 |
;InstallDir "$PROGRAMFILES\${prodname}" |
| 155 |
|
| 156 |
;Get installation folder from registry if available |
| 157 |
InstallDirRegKey HKCU "Software\${prodname}" "" |
| 158 |
|
| 159 |
;Request application privileges for Windows Vista |
| 160 |
; NsisMultiUser sets this, when needed. |
| 161 |
;RequestExecutionLevel admin |
| 162 |
|
| 163 |
|
| 164 |
;-------------------------------- |
| 165 |
;Installer-/UnInstaller-Attributes - Compiler Flags |
| 166 |
; https://nsis.sourceforge.io/Docs/Chapter4.html#flags |
| 167 |
|
| 168 |
; Set default compressor: |
| 169 |
; CI already does "SetCompressor /FINAL zlib" |
| 170 |
; Best compression: https://nsis.sourceforge.io/Docs/Chapter1.html#intro-features |
| 171 |
!ifdef Compressor |
| 172 |
SetCompressor /SOLID lzma |
| 173 |
!endif |
| 174 |
|
| 175 |
|
| 176 |
;-------------------------------- |
| 177 |
; Rest of old part "multi-user" |
| 178 |
|
| 179 |
!addplugindir /x86-unicode ".\NsisPluginsUnicode\" |
| 180 |
!addincludedir ".\NsisInclude" |
| 181 |
!include UAC.nsh |
| 182 |
!include NsisMultiUser.nsh |
| 183 |
!include LogicLib.nsh |
| 184 |
!include StdUtils.nsh |
| 185 |
!include WinVer.nsh |
| 186 |
|
| 187 |
Caption "$(INSTALLER_CAPTION)" |
| 188 |
|
| 189 |
;-------------------------------- |
| 190 |
;Interface Settings |
| 191 |
|
| 192 |
!define MUI_ABORTWARNING |
| 193 |
|
| 194 |
|
| 195 |
;-------------------------------- |
| 196 |
;Language Selection Dialog Settings |
| 197 |
|
| 198 |
;Remember the installer language |
| 199 |
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU" |
| 200 |
!define MUI_LANGDLL_REGISTRY_KEY "Software\${prodname}" |
| 201 |
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language" |
| 202 |
|
| 203 |
|
| 204 |
;-------------------------------- |
| 205 |
;Pages |
| 206 |
|
| 207 |
; General: |
| 208 |
!define /IfNDef MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install-nsis.ico" |
| 209 |
!define /IfNDef MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall-nsis.ico" |
| 210 |
!define MUI_HEADERIMAGE |
| 211 |
!define MUI_HEADERIMAGE_BITMAP "picture.MUI2\bleachbit_150x57.bmp" |
| 212 |
!define MUI_COMPONENTSPAGE_SMALLDESC |
| 213 |
|
| 214 |
; Installer: |
| 215 |
!define MUI_WELCOMEFINISHPAGE_BITMAP "picture.MUI2\bleachbit_164x314.bmp" |
| 216 |
!insertmacro MUI_PAGE_WELCOME |
| 217 |
!define MUI_LICENSEPAGE_RADIOBUTTONS |
| 218 |
!insertmacro MUI_PAGE_LICENSE "..\COPYING" |
| 219 |
;Later: |
| 220 |
;!insertmacro MUI_PAGE_LICENSE "$(MUI_LICENSE)" |
| 221 |
;!define MUI_PAGE_CUSTOMFUNCTION_PRE "MULTIUSER_PAGE_INSTALLMODE_Pre" |
| 222 |
;!define MUI_PAGE_CUSTOMFUNCTION_LEAVE "MULTIUSER_PAGE_INSTALLMODE_Leave" |
| 223 |
!insertmacro MULTIUSER_PAGE_INSTALLMODE |
| 224 |
!insertmacro MUI_PAGE_DIRECTORY |
| 225 |
!insertmacro MUI_PAGE_COMPONENTS |
| 226 |
!insertmacro MUI_PAGE_INSTFILES |
| 227 |
!define MUI_FINISHPAGE_NOAUTOCLOSE |
| 228 |
!define MUI_FINISHPAGE_RUN "$INSTDIR\${prodname}.exe" |
| 229 |
;!define MUI_FINISHPAGE_LINK "Visit the ${prodname} web site." |
| 230 |
;Later: |
| 231 |
!define MUI_FINISHPAGE_LINK "$(BLEACHBIT_MUI_FINISHPAGE_LINK)" |
| 232 |
!define MUI_FINISHPAGE_LINK_LOCATION "https://www.bleachbit.org" |
| 233 |
;Later: |
| 234 |
;!define MUI_FINISHPAGE_LINK_LOCATION "${PRODURL}" |
| 235 |
!define MUI_FINISHPAGE_NOREBOOTSUPPORT |
| 236 |
!insertmacro MUI_PAGE_FINISH |
| 237 |
|
| 238 |
; Uninstaller: |
| 239 |
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "picture.MUI2\bleachbit_164x314.bmp" |
| 240 |
!insertmacro MUI_UNPAGE_WELCOME |
| 241 |
!insertmacro MUI_UNPAGE_CONFIRM |
| 242 |
;Later: |
| 243 |
;!define MUI_PAGE_CUSTOMFUNCTION_PRE "un.MULTIUSER_UnPAGE_INSTALLMODE_Pre" |
| 244 |
;!define MUI_PAGE_CUSTOMFUNCTION_LEAVE "un.MULTIUSER_UnPAGE_INSTALLMODE_Leave" |
| 245 |
!insertmacro MULTIUSER_UNPAGE_INSTALLMODE |
| 246 |
; MUI_UNPAGE_DIRECTORY not needed, ATM. |
| 247 |
; !insertmacro MUI_UNPAGE_DIRECTORY |
| 248 |
!insertmacro MUI_UNPAGE_COMPONENTS |
| 249 |
!insertmacro MUI_UNPAGE_INSTFILES |
| 250 |
!define MUI_UNFINISHPAGE_NOAUTOCLOSE |
| 251 |
!insertmacro MUI_UNPAGE_FINISH |
| 252 |
|
| 253 |
; MUI_LANGUAGE[EX] should be inserted after the MUI_[UN]PAGE_* macros! |
| 254 |
|
| 255 |
|
| 256 |
;-------------------------------- |
| 257 |
;Languages |
| 258 |
|
| 259 |
!insertmacro MUI_LANGUAGE "English" |
| 260 |
!ifndef NoTranslations |
| 261 |
!insertmacro MUI_LANGUAGE "Albanian" |
| 262 |
!insertmacro MUI_LANGUAGE "Arabic" |
| 263 |
!insertmacro MUI_LANGUAGE "Armenian" |
| 264 |
!insertmacro MUI_LANGUAGE "Asturian" |
| 265 |
!insertmacro MUI_LANGUAGE "Basque" |
| 266 |
!insertmacro MUI_LANGUAGE "Belarusian" |
| 267 |
!insertmacro MUI_LANGUAGE "Bosnian" |
| 268 |
!insertmacro MUI_LANGUAGE "Bulgarian" |
| 269 |
!insertmacro MUI_LANGUAGE "Catalan" |
| 270 |
!insertmacro MUI_LANGUAGE "Croatian" |
| 271 |
!insertmacro MUI_LANGUAGE "Czech" |
| 272 |
!insertmacro MUI_LANGUAGE "Danish" |
| 273 |
!insertmacro MUI_LANGUAGE "Dutch" |
| 274 |
!insertmacro MUI_LANGUAGE "Estonian" |
| 275 |
!insertmacro MUI_LANGUAGE "Finnish" |
| 276 |
!insertmacro MUI_LANGUAGE "French" |
| 277 |
!insertmacro MUI_LANGUAGE "Galician" |
| 278 |
!insertmacro MUI_LANGUAGE "German" |
| 279 |
!insertmacro MUI_LANGUAGE "Greek" |
| 280 |
!insertmacro MUI_LANGUAGE "Hebrew" |
| 281 |
!insertmacro MUI_LANGUAGE "Hungarian" |
| 282 |
!insertmacro MUI_LANGUAGE "Indonesian" |
| 283 |
!insertmacro MUI_LANGUAGE "Italian" |
| 284 |
!insertmacro MUI_LANGUAGE "Japanese" |
| 285 |
!insertmacro MUI_LANGUAGE "Korean" |
| 286 |
!insertmacro MUI_LANGUAGE "Latvian" |
| 287 |
!insertmacro MUI_LANGUAGE "Lithuanian" |
| 288 |
!insertmacro MUI_LANGUAGE "Malay" |
| 289 |
!insertmacro MUI_LANGUAGE "Norwegian" |
| 290 |
!insertmacro MUI_LANGUAGE "Polish" |
| 291 |
!insertmacro MUI_LANGUAGE "Portuguese" |
| 292 |
!insertmacro MUI_LANGUAGE "PortugueseBR" |
| 293 |
!insertmacro MUI_LANGUAGE "Romanian" |
| 294 |
!insertmacro MUI_LANGUAGE "Russian" |
| 295 |
!insertmacro MUI_LANGUAGE "Serbian" |
| 296 |
!insertmacro MUI_LANGUAGE "SimpChinese" |
| 297 |
!insertmacro MUI_LANGUAGE "Slovak" |
| 298 |
!insertmacro MUI_LANGUAGE "Slovenian" |
| 299 |
!insertmacro MUI_LANGUAGE "Spanish" |
| 300 |
!insertmacro MUI_LANGUAGE "Swedish" |
| 301 |
!insertmacro MUI_LANGUAGE "Thai" |
| 302 |
!insertmacro MUI_LANGUAGE "TradChinese" |
| 303 |
!insertmacro MUI_LANGUAGE "Turkish" |
| 304 |
!insertmacro MUI_LANGUAGE "Ukrainian" |
| 305 |
!insertmacro MUI_LANGUAGE "Uzbek" |
| 306 |
!insertmacro MUI_LANGUAGE "Vietnamese" |
| 307 |
!endif |
| 308 |
|
| 309 |
|
| 310 |
!include NsisMultiUserLang.nsh |
| 311 |
|
| 312 |
!include "StrFunc.nsh" |
| 313 |
# Declare used functions |
| 314 |
${StrCase} |
| 315 |
|
| 316 |
;-------------------------------- |
| 317 |
;Function |
| 318 |
|
| 319 |
; http://nsis.sourceforge.net/RefreshShellIcons |
| 320 |
Function RefreshShellIcons |
| 321 |
!define SHCNE_ASSOCCHANGED 0x08000000 |
| 322 |
!define SHCNF_IDLIST 0 |
| 323 |
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)' |
| 324 |
FunctionEnd |
| 325 |
|
| 326 |
Function .onVerifyInstDir |
| 327 |
; This callback belongs to MUI_PAGE_DIRECTORY and is called every time the user presses Browse |
| 328 |
; button and selects install directory. It does not affect typing in the input field. |
| 329 |
|
| 330 |
; The purpose is to prevent installation in a shared folder such as %ProgramFiles% |
| 331 |
; by adding the product name to the end. |
| 332 |
|
| 333 |
${GetFileName} $INSTDIR $R0 ; get the last part of the path |
| 334 |
StrCmp $R0 ${prodname} no_append |
| 335 |
StrCpy $INSTDIR "$INSTDIR\${prodname}" |
| 336 |
no_append: |
| 337 |
FunctionEnd |
| 338 |
|
| 339 |
;-------------------------------- |
| 340 |
;Default section |
| 341 |
Section "$(SECTION_CORE_NAME)" SectionCore |
| 342 |
SectionIn RO |
| 343 |
|
| 344 |
!include FilesToInstall.nsh |
| 345 |
|
| 346 |
# uninstaller |
| 347 |
WriteUninstaller "$INSTDIR\uninstall.exe" |
| 348 |
|
| 349 |
SetOutPath "$INSTDIR\" |
| 350 |
CreateDirectory "$SMPROGRAMS\${prodname}" |
| 351 |
|
| 352 |
# register uninstaller in Add/Remove Programs |
| 353 |
!insertmacro MULTIUSER_RegistryAddInstallInfo ; add registry keys |
| 354 |
WriteRegStr SHCTX "${MULTIUSER_INSTALLMODE_UNINSTALL_REGISTRY_KEY_PATH}$0" \ |
| 355 |
"HelpLink" "https://www.bleachbit.org/help" |
| 356 |
WriteRegStr SHCTX "${MULTIUSER_INSTALLMODE_UNINSTALL_REGISTRY_KEY_PATH}$0" \ |
| 357 |
"URLInfoAbout" "https://www.bleachbit.org/" |
| 358 |
WriteRegStr SHCTX "${MULTIUSER_INSTALLMODE_UNINSTALL_REGISTRY_KEY_PATH}$0" \ |
| 359 |
"URLUpdateInfo" "https://www.bleachbit.org/download" |
| 360 |
WriteRegStr SHCTX "${MULTIUSER_INSTALLMODE_UNINSTALL_REGISTRY_KEY_PATH}$0" \ |
| 361 |
"DisplayName" "${prodname}" |
| 362 |
|
| 363 |
# Build cache now while there is a GUI progress bar. |
| 364 |
DetailPrint "$(MULTIPRINT1)" |
| 365 |
DetailPrint "$(MULTIPRINT2)" |
| 366 |
ExecWait '"$instdir\fc-cache.exe"' |
| 367 |
SectionEnd |
| 368 |
|
| 369 |
|
| 370 |
SectionGroup /e "$(SECTION_SHORTCUTS_NAME)" SectionShortCuts |
| 371 |
Section "$(SECTION_START_MENU_NAME)" SectionStart |
| 372 |
SetOutPath "$INSTDIR\" # this affects CreateShortCut's 'Start in' directory |
| 373 |
CreateShortCut "$SMPROGRAMS\${prodname}\${prodname}.lnk" "$INSTDIR\${prodname}.exe" \ |
| 374 |
"" "$INSTDIR\${prodname}.exe" |
| 375 |
CreateShortCut "$SMPROGRAMS\${prodname}\$(SHORTCUT_NO_UAC).lnk" \ |
| 376 |
"$INSTDIR\${prodname}.exe" \ |
| 377 |
"--no-uac --gui" "$INSTDIR\${prodname}.exe" |
| 378 |
CreateShortCut "$SMPROGRAMS\${prodname}\$(SHORTCUT_DEBUGGING_TERMINAL).lnk" \ |
| 379 |
"$INSTDIR\${prodname}_console.exe" "" "$INSTDIR\${prodname}.exe" |
| 380 |
Call RefreshShellIcons |
| 381 |
SectionEnd |
| 382 |
|
| 383 |
Section "$(SECTION_DESKTOP_NAME)" SectionDesktop |
| 384 |
IfSilent 0 addDesktopShortcut |
| 385 |
${GetParameters} $R0 |
| 386 |
${StrCase} $R0 $R0 "L" # "L" means lowercase |
| 387 |
${GetOptions} $R0 "/nodesktopshortcut" $R1 |
| 388 |
IfErrors addDesktopShortcut doNotAddDesktopShortcut |
| 389 |
addDesktopShortcut: |
| 390 |
SetOutPath "$INSTDIR\" # this affects CreateShortCut's 'Start in' directory |
| 391 |
CreateShortcut "$DESKTOP\BleachBit.lnk" "$INSTDIR\${prodname}.exe" |
| 392 |
Call RefreshShellIcons |
| 393 |
|
| 394 |
doNotAddDesktopShortcut: |
| 395 |
|
| 396 |
SectionEnd |
| 397 |
|
| 398 |
Section /o "$(SECTION_QUICK_LAUNCH_NAME)" SectionQuickLaunch |
| 399 |
SetOutPath "$INSTDIR\" # this affects CreateShortCut's 'Start in' directory |
| 400 |
CreateShortcut "$QUICKLAUNCH\BleachBit.lnk" "$INSTDIR\${prodname}.exe" |
| 401 |
Call RefreshShellIcons |
| 402 |
SectionEnd |
| 403 |
|
| 404 |
SectionGroupEnd |
| 405 |
|
| 406 |
|
| 407 |
!ifndef NoTranslations |
| 408 |
Section "$(SECTION_TRANSLATIONS_NAME)" SectionTranslations |
| 409 |
!include LocaleToInstall.nsh |
| 410 |
SectionEnd |
| 411 |
!endif |
| 412 |
|
| 413 |
; Section for making Shred Integration optional |
| 414 |
!ifndef NoSectionShred |
| 415 |
Section "$(SECTION_INTEGRATE_SHRED_NAME)" SectionShred |
| 416 |
; Register Windows Explorer Shell Extension (Shredder) |
| 417 |
WriteRegStr HKCR "${SHRED_REGEX_KEY}" "" '$(SHRED_SHELL_MENU)' |
| 418 |
WriteRegStr HKCR "${SHRED_REGEX_KEY}" "Icon" "$INSTDIR\bleachbit.exe,0" |
| 419 |
WriteRegStr HKCR "${SHRED_REGEX_KEY}\command" "" '"$INSTDIR\bleachbit.exe" --context-menu "%1"' |
| 420 |
SectionEnd |
| 421 |
!endif |
| 422 |
|
| 423 |
; Keep this section last. It must be last because that is when the |
| 424 |
; actual size is known. |
| 425 |
; This is a hidden section. |
| 426 |
Section "-Write Install Size" |
| 427 |
!insertmacro MULTIUSER_RegistryAddInstallSizeInfo |
| 428 |
SectionEnd |
| 429 |
|
| 430 |
;-------------------------------- |
| 431 |
;Installer Functions |
| 432 |
|
| 433 |
Function .onInit |
| 434 |
|
| 435 |
${If} ${AtMostWin8.1} |
| 436 |
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(OLD_WINDOWS_WARNING)" /SD IDOK IDOK open_old_windows_page |
| 437 |
Abort |
| 438 |
${EndIf} |
| 439 |
|
| 440 |
!insertmacro MULTIUSER_INIT |
| 441 |
|
| 442 |
; Language display dialog |
| 443 |
!insertmacro MUI_LANGDLL_DISPLAY |
| 444 |
|
| 445 |
; Check whether application is already installed |
| 446 |
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}" \ |
| 447 |
"UninstallString" |
| 448 |
|
| 449 |
; If not already installed, skip uninstallation |
| 450 |
StrCmp $R0 "" new_install |
| 451 |
|
| 452 |
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \ |
| 453 |
"$(ALREADY_INSTALLED)" \ |
| 454 |
/SD IDOK \ |
| 455 |
IDOK uninstall_old |
| 456 |
|
| 457 |
Abort |
| 458 |
|
| 459 |
uninstall_old: |
| 460 |
; If installing in silent mode, also uninstall in silent mode |
| 461 |
Var /GLOBAL uninstaller_cmd |
| 462 |
StrCpy $uninstaller_cmd '$R0 _?=$INSTDIR' |
| 463 |
IfSilent 0 +2 |
| 464 |
StrCpy $uninstaller_cmd "$uninstaller_cmd /S" |
| 465 |
ExecWait $uninstaller_cmd ; Actually run the uninstaller |
| 466 |
|
| 467 |
new_install: |
| 468 |
Return |
| 469 |
|
| 470 |
; On old version of Windows after user agrees to open the link. |
| 471 |
open_old_windows_page: |
| 472 |
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "CurrentVersion" |
| 473 |
ExecShell "open" "https://www.bleachbit.org/goto/old-windows?ver=${VERSION}&os=$R0&lang=$LANGUAGE" |
| 474 |
Abort |
| 475 |
|
| 476 |
FunctionEnd |
| 477 |
|
| 478 |
|
| 479 |
;-------------------------------- |
| 480 |
;Uninstaller Section |
| 481 |
|
| 482 |
UninstallText "$(UNINSTALL_TEXT)" |
| 483 |
|
| 484 |
Section "Uninstall" SectionUninstall |
| 485 |
Delete $INSTDIR\bleachbit.exe.log |
| 486 |
|
| 487 |
!ifndef NoTranslations |
| 488 |
!include LocaleToUninstall.nsh |
| 489 |
!endif |
| 490 |
|
| 491 |
!include FilesToUninstall.nsh |
| 492 |
|
| 493 |
DeleteRegKey HKCU "Software\${prodname}" |
| 494 |
# delete normal shortcuts |
| 495 |
RMDir /r "$SMPROGRAMS\${prodname}" |
| 496 |
# delete any extra shortcuts |
| 497 |
Delete "$DESKTOP\BleachBit.lnk" |
| 498 |
Delete "$QUICKLAUNCH\BleachBit.lnk" |
| 499 |
Delete "$SMSTARTUP\BleachBit.lnk" |
| 500 |
# Remove Windows Explorer Shell Extension (Shredder) |
| 501 |
DeleteRegKey HKCR "${SHRED_REGEX_KEY}" |
| 502 |
|
| 503 |
# Remove the uninstaller as the very last step. |
| 504 |
# If something goes wrong, let the user run it again. |
| 505 |
Delete $INSTDIR\uninstall.exe |
| 506 |
RMDir /REBOOTOK "$INSTDIR\." |
| 507 |
|
| 508 |
# Remove the uninstaller from registry as the very last step. |
| 509 |
# If something goes wrong, let the user run it again. |
| 510 |
!insertmacro MULTIUSER_RegistryRemoveInstallInfo |
| 511 |
SectionEnd |
| 512 |
|
| 513 |
;-------------------------------- Set SectionDescription |
| 514 |
|
| 515 |
;Assign descriptions to sections |
| 516 |
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN |
| 517 |
!insertmacro MUI_DESCRIPTION_TEXT ${SectionCore} "$(SECTION_CORE_DESCRIPTION)" |
| 518 |
!insertmacro MUI_DESCRIPTION_TEXT ${SectionShortCuts} "$(SECTION_SHORTCUTS_DESCRIPTION)" |
| 519 |
!insertmacro MUI_DESCRIPTION_TEXT ${SectionStart} "$(SECTION_START_MENU_DESCRIPTION)" |
| 520 |
!insertmacro MUI_DESCRIPTION_TEXT ${SectionDesktop} "$(SECTION_DESKTOP_DESCRIPTION)" |
| 521 |
!insertmacro MUI_DESCRIPTION_TEXT ${SectionQuickLaunch} "$(SECTION_QUICK_LAUNCH_DESCRIPTION)" |
| 522 |
!ifndef NoTranslations |
| 523 |
!insertmacro MUI_DESCRIPTION_TEXT ${SectionTranslations} "$(SECTION_TRANSLATIONS_DESCRIPTION)" |
| 524 |
!endif |
| 525 |
!insertmacro MUI_DESCRIPTION_TEXT ${SectionShred} "$(SECTION_INTEGRATE_SHRED_DESCRIPTION)" |
| 526 |
!insertmacro MUI_DESCRIPTION_TEXT ${SectionUninstall} "$(SECTION_UNINSTALL_DESCRIPTION)" |
| 527 |
!insertmacro MUI_FUNCTION_DESCRIPTION_END |
| 528 |
|
| 529 |
;-------------------------------- |
| 530 |
;Uninstaller Functions |
| 531 |
|
| 532 |
Function un.onInit |
| 533 |
|
| 534 |
!insertmacro MULTIUSER_UNINIT |
| 535 |
|
| 536 |
!insertmacro MUI_UNGETLANGUAGE |
| 537 |
|
| 538 |
FunctionEnd |