2012-04-18 12:15:52 +00:00
|
|
|
# Deluge Windows installer script
|
|
|
|
#
|
2014-09-19 18:21:42 +00:00
|
|
|
# Copyright (C) 2009 Jesper Lund <mail@jesperlund.com>
|
|
|
|
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
|
|
|
|
# Copyright (C) 2009 John Garland <johnnybg@gmail.com>
|
2012-04-18 12:15:52 +00:00
|
|
|
#
|
2014-09-19 18:21:42 +00:00
|
|
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later.
|
|
|
|
# See LICENSE for more details.
|
2012-04-18 12:15:52 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# Set default compressor
|
2012-11-22 23:22:34 +00:00
|
|
|
SetCompressor /FINAL /SOLID lzma
|
|
|
|
SetCompressorDictSize 64
|
2012-04-18 12:15:52 +00:00
|
|
|
|
|
|
|
# Script version; displayed when running the installer
|
2015-09-10 13:24:32 +00:00
|
|
|
!define DELUGE_INSTALLER_VERSION "0.8"
|
2012-04-18 12:15:52 +00:00
|
|
|
|
|
|
|
# Deluge program information
|
|
|
|
!define PROGRAM_NAME "Deluge"
|
2012-11-22 23:22:34 +00:00
|
|
|
# Deluge program information
|
|
|
|
!searchparse /file VERSION.tmp `build_version = "` PROGRAM_VERSION `"`
|
|
|
|
!ifndef PROGRAM_VERSION
|
|
|
|
!error "Program Version Undefined"
|
|
|
|
!endif
|
2012-04-18 12:15:52 +00:00
|
|
|
!define PROGRAM_WEB_SITE "http://deluge-torrent.org"
|
|
|
|
|
2012-11-22 23:22:34 +00:00
|
|
|
# Python files generated with bbfreeze
|
2015-08-27 10:27:37 +00:00
|
|
|
!define BUILD_DIR "build-win32"
|
2015-08-23 11:34:19 +00:00
|
|
|
!define BBFREEZE_DIR "${BUILD_DIR}\deluge-bbfreeze-${PROGRAM_VERSION}"
|
2012-04-18 12:15:52 +00:00
|
|
|
|
|
|
|
# --- Interface settings ---
|
|
|
|
|
|
|
|
# Modern User Interface 2
|
|
|
|
!include MUI2.nsh
|
|
|
|
|
|
|
|
# Installer
|
2015-08-23 11:34:19 +00:00
|
|
|
!define MUI_ICON "..\..\deluge\ui\data\pixmaps\deluge.ico"
|
2012-04-18 12:15:52 +00:00
|
|
|
!define MUI_HEADERIMAGE
|
|
|
|
!define MUI_HEADERIMAGE_RIGHT
|
|
|
|
!define MUI_HEADERIMAGE_BITMAP "installer-top.bmp"
|
|
|
|
!define MUI_WELCOMEFINISHPAGE_BITMAP "installer-side.bmp"
|
|
|
|
!define MUI_COMPONENTSPAGE_SMALLDESC
|
|
|
|
!define MUI_FINISHPAGE_NOAUTOCLOSE
|
|
|
|
!define MUI_ABORTWARNING
|
|
|
|
|
|
|
|
# Uninstaller
|
|
|
|
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
|
|
|
|
!define MUI_HEADERIMAGE_UNBITMAP "installer-top.bmp"
|
|
|
|
!define MUI_WELCOMEFINISHPAGE_UNBITMAP "installer-side.bmp"
|
|
|
|
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
|
|
|
|
|
|
|
|
# --- Start of Modern User Interface ---
|
|
|
|
|
|
|
|
# Welcome page
|
|
|
|
!insertmacro MUI_PAGE_WELCOME
|
|
|
|
|
|
|
|
# License page
|
2015-08-23 11:34:19 +00:00
|
|
|
!insertmacro MUI_PAGE_LICENSE "..\..\LICENSE"
|
2012-04-18 12:15:52 +00:00
|
|
|
|
|
|
|
# Components page
|
|
|
|
!insertmacro MUI_PAGE_COMPONENTS
|
|
|
|
|
|
|
|
# Let the user select the installation directory
|
|
|
|
!insertmacro MUI_PAGE_DIRECTORY
|
|
|
|
|
|
|
|
# Run installation
|
|
|
|
!insertmacro MUI_PAGE_INSTFILES
|
|
|
|
|
|
|
|
# Display 'finished' page
|
|
|
|
!insertmacro MUI_PAGE_FINISH
|
|
|
|
|
|
|
|
# Uninstaller pages
|
|
|
|
!insertmacro MUI_UNPAGE_INSTFILES
|
|
|
|
|
|
|
|
# Language files
|
|
|
|
!insertmacro MUI_LANGUAGE "English"
|
|
|
|
|
2015-09-10 13:24:32 +00:00
|
|
|
VIProductVersion "${DELUGE_INSTALLER_VERSION}.0.0"
|
|
|
|
VIAddVersionKey ProductName "${PROGRAM_NAME}"
|
|
|
|
VIAddVersionKey Comments "Deluge Bittorrent Client"
|
|
|
|
VIAddVersionKey CompanyName "Deluge Team"
|
|
|
|
VIAddVersionKey LegalCopyright "Deluge Team"
|
|
|
|
VIAddVersionKey FileDescription "${PROGRAM_NAME} Application Installer"
|
|
|
|
VIAddVersionKey FileVersion "${DELUGE_INSTALLER_VERSION}.0.0"
|
|
|
|
VIAddVersionKey ProductVersion "${PROGRAM_VERSION}.0"
|
|
|
|
VIAddVersionKey OriginalFilename "deluge-${PROGRAM_VERSION}-win32-setup.exe"
|
2012-04-18 12:15:52 +00:00
|
|
|
|
|
|
|
# --- Functions ---
|
|
|
|
|
2012-11-22 23:22:34 +00:00
|
|
|
Function .onInit
|
|
|
|
System::Call 'kernel32::OpenMutex(i 0x100000, b 0, t "deluge") i .R0'
|
|
|
|
IntCmp $R0 0 notRunning
|
|
|
|
System::Call 'kernel32::CloseHandle(i $R0)'
|
|
|
|
MessageBox MB_OK|MB_ICONEXCLAMATION "Deluge is running. Please close it first" /SD IDOK
|
|
|
|
Abort
|
|
|
|
notRunning:
|
|
|
|
FunctionEnd
|
|
|
|
|
2012-04-18 12:15:52 +00:00
|
|
|
Function un.onUninstSuccess
|
|
|
|
HideWindow
|
2013-11-19 22:40:51 +00:00
|
|
|
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." /SD IDOK
|
2012-04-18 12:15:52 +00:00
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function un.onInit
|
2015-09-10 13:24:32 +00:00
|
|
|
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Do you want to completely remove $(^Name)?" /SD IDYES IDYES +2
|
2012-04-18 12:15:52 +00:00
|
|
|
Abort
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
# --- Installation sections ---
|
|
|
|
!define PROGRAM_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}"
|
|
|
|
!define PROGRAM_UNINST_ROOT_KEY "HKLM"
|
|
|
|
|
|
|
|
BrandingText "Deluge Windows Installer v${DELUGE_INSTALLER_VERSION}"
|
|
|
|
Name "${PROGRAM_NAME} ${PROGRAM_VERSION}"
|
2015-08-23 11:34:19 +00:00
|
|
|
OutFile "${BUILD_DIR}\deluge-${PROGRAM_VERSION}-win32-setup.exe"
|
2012-04-18 12:15:52 +00:00
|
|
|
InstallDir "$PROGRAMFILES\Deluge"
|
|
|
|
|
|
|
|
ShowInstDetails show
|
|
|
|
ShowUnInstDetails show
|
|
|
|
|
|
|
|
# Install main application
|
|
|
|
Section "Deluge Bittorrent Client" Section1
|
|
|
|
SectionIn RO
|
2015-09-10 13:24:32 +00:00
|
|
|
!include "install_files.nsh"
|
2012-04-18 12:15:52 +00:00
|
|
|
|
|
|
|
SetOverwrite ifnewer
|
2015-09-10 13:24:32 +00:00
|
|
|
SetOutPath "$INSTDIR"
|
2015-08-23 11:34:19 +00:00
|
|
|
File "..\..\LICENSE"
|
2012-04-18 12:15:52 +00:00
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
Section -StartMenu_Desktop_Links
|
|
|
|
WriteIniStr "$INSTDIR\homepage.url" "InternetShortcut" "URL" "${PROGRAM_WEB_SITE}"
|
|
|
|
# create shortcuts for all users
|
|
|
|
SetShellVarContext all
|
|
|
|
CreateDirectory "$SMPROGRAMS\Deluge"
|
|
|
|
CreateShortCut "$SMPROGRAMS\Deluge\Deluge.lnk" "$INSTDIR\deluge.exe"
|
2015-09-10 13:24:32 +00:00
|
|
|
CreateShortCut "$SMPROGRAMS\Deluge\Website.lnk" "$INSTDIR\homepage.url"
|
|
|
|
CreateShortCut "$SMPROGRAMS\Deluge\Uninstall Deluge.lnk" "$INSTDIR\deluge-uninst.exe"
|
2012-04-18 12:15:52 +00:00
|
|
|
CreateShortCut "$DESKTOP\Deluge.lnk" "$INSTDIR\deluge.exe"
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
Section -Uninstaller
|
2015-09-10 13:24:32 +00:00
|
|
|
WriteUninstaller "$INSTDIR\deluge-uninst.exe"
|
2012-04-18 12:15:52 +00:00
|
|
|
WriteRegStr ${PROGRAM_UNINST_ROOT_KEY} "${PROGRAM_UNINST_KEY}" "DisplayName" "$(^Name)"
|
2015-09-10 13:24:32 +00:00
|
|
|
WriteRegStr ${PROGRAM_UNINST_ROOT_KEY} "${PROGRAM_UNINST_KEY}" "UninstallString" "$INSTDIR\deluge-uninst.exe"
|
2012-04-18 12:15:52 +00:00
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
# Create file association for .torrent
|
2015-09-10 13:24:32 +00:00
|
|
|
Section "Associate .torrent files with Deluge" Section2
|
2012-04-18 12:15:52 +00:00
|
|
|
# Set up file association for .torrent files
|
|
|
|
DeleteRegKey HKCR ".torrent"
|
|
|
|
WriteRegStr HKCR ".torrent" "" "Deluge"
|
|
|
|
WriteRegStr HKCR ".torrent" "Content Type" "application/x-bittorrent"
|
|
|
|
|
|
|
|
DeleteRegKey HKCR "Deluge"
|
|
|
|
WriteRegStr HKCR "Deluge" "" "Deluge"
|
|
|
|
WriteRegStr HKCR "Deluge\Content Type" "" "application/x-bittorrent"
|
|
|
|
WriteRegStr HKCR "Deluge\DefaultIcon" "" "$INSTDIR\deluge.exe,0"
|
|
|
|
WriteRegStr HKCR "Deluge\shell" "" "open"
|
|
|
|
WriteRegStr HKCR "Deluge\shell\open\command" "" '"$INSTDIR\deluge.exe" "%1"'
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
# Create magnet uri association
|
2015-09-10 13:24:32 +00:00
|
|
|
Section "Associate Magnet URI links with Deluge" Section3
|
2014-08-24 09:51:47 +00:00
|
|
|
DeleteRegKey HKCR "Magnet"
|
|
|
|
WriteRegStr HKCR "Magnet" "" "URL:Magnet Protocol"
|
|
|
|
WriteRegStr HKCR "Magnet" "URL Protocol" ""
|
|
|
|
WriteRegStr HKCR "Magnet\shell\open\command" "" '"$INSTDIR\deluge.exe" "%1"'
|
2012-04-18 12:15:52 +00:00
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
LangString DESC_Section1 ${LANG_ENGLISH} "Install Deluge Bittorrent client."
|
2015-09-10 13:24:32 +00:00
|
|
|
LangString DESC_Section2 ${LANG_ENGLISH} "Select this option to let Deluge handle the opening of .torrent files."
|
|
|
|
LangString DESC_Section3 ${LANG_ENGLISH} "Select this option to let Deluge handle Magnet URI links from the web-browser."
|
2012-04-18 12:15:52 +00:00
|
|
|
|
|
|
|
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
|
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${Section1} $(DESC_Section1)
|
|
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(DESC_Section2)
|
|
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${Section3} $(DESC_Section3)
|
|
|
|
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
|
|
|
|
2015-09-10 13:24:32 +00:00
|
|
|
# --- Uninstallation section ---
|
2012-04-18 12:15:52 +00:00
|
|
|
Section Uninstall
|
2015-09-10 13:24:32 +00:00
|
|
|
Delete "$INSTDIR\LICENSE"
|
|
|
|
Delete "$INSTDIR\homepage.url"
|
|
|
|
Delete "$INSTDIR\deluge-uninst.exe"
|
|
|
|
!include "uninstall_files.nsh"
|
2012-04-18 12:15:52 +00:00
|
|
|
|
|
|
|
SetShellVarContext all
|
|
|
|
Delete "$SMPROGRAMS\Deluge\Deluge.lnk"
|
|
|
|
Delete "$SMPROGRAMS\Deluge\Uninstall Deluge.lnk"
|
2015-09-10 13:24:32 +00:00
|
|
|
Delete "$SMPROGRAMS\Deluge\Deluge Website.lnk"
|
2012-04-18 12:15:52 +00:00
|
|
|
RmDir "$SMPROGRAMS\Deluge"
|
2015-09-10 13:24:32 +00:00
|
|
|
Delete "$DESKTOP\Deluge.lnk"
|
2012-04-18 12:15:52 +00:00
|
|
|
|
|
|
|
DeleteRegKey ${PROGRAM_UNINST_ROOT_KEY} "${PROGRAM_UNINST_KEY}"
|
|
|
|
|
|
|
|
# Only delete the .torrent association if Deluge owns it
|
|
|
|
ReadRegStr $1 HKCR ".torrent" ""
|
|
|
|
StrCmp $1 "Deluge" 0 DELUGE_skip_delete
|
2015-09-10 13:24:32 +00:00
|
|
|
# Delete the key since it is owned by Deluge; afterwards there is no .torrent association
|
|
|
|
DeleteRegKey HKCR ".torrent"
|
2012-04-18 12:15:52 +00:00
|
|
|
DELUGE_skip_delete:
|
|
|
|
# This key is only used by Deluge, so we should always delete it
|
|
|
|
DeleteRegKey HKCR "Deluge"
|
|
|
|
SectionEnd
|