[#2325] [Packaging] Fix uninstaller deleting non-deluge files

This commit is contained in:
Calum Lind 2015-09-10 14:24:32 +01:00
parent 3eefc81d9d
commit 40c0c8ef6a
2 changed files with 59 additions and 37 deletions

View File

@ -70,7 +70,7 @@ if not DEBUG:
# Include python modules not picked up automatically by bbfreeze.
includes = ("libtorrent", "cairo", "pangocairo", "atk", "pango", "twisted.internet.utils",
"gio", "gzip", "email.mime.multipart", "email.mime.text", "_cffi_backend")
excludes = ("numpy", "OpenGL", "psyco", "win32ui")
excludes = ("numpy", "OpenGL", "psyco", "win32ui", "unittest")
def recipe_gtk_override(mf):
@ -111,7 +111,7 @@ for script in script_list:
os.remove(script)
# Exclude files which are already included in GTK or Windows.
excludeDlls = ("MSIMG32.dll", "MSVCR90.dll", "MSVCP90.dll", "POWRPROF.dll", "DNSAPI.dll", "USP10.dll")
excludeDlls = ("MSIMG32.dll", "MSVCR90.dll", "MSVCP90.dll", "MSVCR120.dll", "POWRPROF.dll", "DNSAPI.dll", "USP10.dll")
for dll in excludeDlls:
try:
os.remove(os.path.join(build_dir, dll))
@ -165,9 +165,35 @@ for script in script_list:
description="Deluge Bittorrent Client",
company="Deluge Team",
product="Deluge",
copyright="GPLv3")
copyright="Deluge Team")
stamp(os.path.join(build_dir, script_exe), versionInfo)
# Copy version info to file for nsis script.
with open('VERSION.tmp', 'w') as ver_file:
ver_file.write("build_version = \"%s\"" % build_version)
# Create the install and uninstall file list for NSIS.
filedir_list = []
for root, dirnames, filenames in os.walk(build_dir):
dirnames.sort()
filenames.sort()
filedir_list.append((root[len(build_dir):], filenames))
with open('install_files.nsh', 'w') as f:
f.write('; Files to install\n')
for dirname, files in filedir_list:
if not dirname:
dirname = os.sep
f.write('\nSetOutPath "$INSTDIR%s"\n' % dirname)
for filename in files:
f.write('File "${BBFREEZE_DIR}%s"\n' % os.path.join(dirname, filename))
with open('uninstall_files.nsh', 'w') as f:
f.write('; Files to uninstall\n')
for dirname, files in reversed(filedir_list):
f.write('\n')
if not dirname:
dirname = os.sep
for filename in files:
f.write('Delete "$INSTDIR%s"\n' % os.path.join(dirname, filename))
f.write('RMDir "$INSTDIR%s"\n' % dirname)

View File

@ -13,7 +13,7 @@ SetCompressor /FINAL /SOLID lzma
SetCompressorDictSize 64
# Script version; displayed when running the installer
!define DELUGE_INSTALLER_VERSION "0.7"
!define DELUGE_INSTALLER_VERSION "0.8"
# Deluge program information
!define PROGRAM_NAME "Deluge"
@ -75,6 +75,15 @@ SetCompressorDictSize 64
# Language files
!insertmacro MUI_LANGUAGE "English"
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"
# --- Functions ---
@ -93,24 +102,17 @@ Function un.onUninstSuccess
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Do you want to completely remove $(^Name) and all of its components?" /SD IDYES IDYES +2
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Do you want to completely remove $(^Name)?" /SD IDYES IDYES +2
Abort
FunctionEnd
# --- Installation sections ---
# Compare versions
!include "WordFunc.nsh"
!define PROGRAM_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}"
!define PROGRAM_UNINST_ROOT_KEY "HKLM"
# Branding text
BrandingText "Deluge Windows Installer v${DELUGE_INSTALLER_VERSION}"
Name "${PROGRAM_NAME} ${PROGRAM_VERSION}"
OutFile "${BUILD_DIR}\deluge-${PROGRAM_VERSION}-win32-setup.exe"
InstallDir "$PROGRAMFILES\Deluge"
ShowInstDetails show
@ -119,11 +121,10 @@ ShowUnInstDetails show
# Install main application
Section "Deluge Bittorrent Client" Section1
SectionIn RO
SetOutPath $INSTDIR
File /r "${BBFREEZE_DIR}\*.*"
!include "install_files.nsh"
SetOverwrite ifnewer
SetOutPath "$INSTDIR"
File "..\..\LICENSE"
SectionEnd
@ -133,19 +134,19 @@ Section -StartMenu_Desktop_Links
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\Deluge"
CreateShortCut "$SMPROGRAMS\Deluge\Deluge.lnk" "$INSTDIR\deluge.exe"
CreateShortCut "$SMPROGRAMS\Deluge\Project homepage.lnk" "$INSTDIR\Homepage.url"
CreateShortCut "$SMPROGRAMS\Deluge\Uninstall Deluge.lnk" "$INSTDIR\Deluge-uninst.exe"
CreateShortCut "$SMPROGRAMS\Deluge\Website.lnk" "$INSTDIR\homepage.url"
CreateShortCut "$SMPROGRAMS\Deluge\Uninstall Deluge.lnk" "$INSTDIR\deluge-uninst.exe"
CreateShortCut "$DESKTOP\Deluge.lnk" "$INSTDIR\deluge.exe"
SectionEnd
Section -Uninstaller
WriteUninstaller "$INSTDIR\Deluge-uninst.exe"
WriteUninstaller "$INSTDIR\deluge-uninst.exe"
WriteRegStr ${PROGRAM_UNINST_ROOT_KEY} "${PROGRAM_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PROGRAM_UNINST_ROOT_KEY} "${PROGRAM_UNINST_KEY}" "UninstallString" "$INSTDIR\Deluge-uninst.exe"
WriteRegStr ${PROGRAM_UNINST_ROOT_KEY} "${PROGRAM_UNINST_KEY}" "UninstallString" "$INSTDIR\deluge-uninst.exe"
SectionEnd
# Create file association for .torrent
Section "Create .torrent file association for Deluge" Section2
Section "Associate .torrent files with Deluge" Section2
# Set up file association for .torrent files
DeleteRegKey HKCR ".torrent"
WriteRegStr HKCR ".torrent" "" "Deluge"
@ -159,20 +160,17 @@ Section "Create .torrent file association for Deluge" Section2
WriteRegStr HKCR "Deluge\shell\open\command" "" '"$INSTDIR\deluge.exe" "%1"'
SectionEnd
# Create magnet uri association
Section "Create magnet uri link association for Deluge" Section3
Section "Associate Magnet URI links with Deluge" Section3
DeleteRegKey HKCR "Magnet"
WriteRegStr HKCR "Magnet" "" "URL:Magnet Protocol"
WriteRegStr HKCR "Magnet" "URL Protocol" ""
WriteRegStr HKCR "Magnet\shell\open\command" "" '"$INSTDIR\deluge.exe" "%1"'
SectionEnd
LangString DESC_Section1 ${LANG_ENGLISH} "Install Deluge Bittorrent client."
LangString DESC_Section2 ${LANG_ENGLISH} "Select this option unless you have another torrent client which you want to use for opening .torrent files."
LangString DESC_Section3 ${LANG_ENGLISH} "Select this option to have Deluge handle magnet links."
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."
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Section1} $(DESC_Section1)
@ -180,29 +178,27 @@ LangString DESC_Section3 ${LANG_ENGLISH} "Select this option to have Deluge hand
!insertmacro MUI_DESCRIPTION_TEXT ${Section3} $(DESC_Section3)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
# --- Uninstallation section(s) ---
# --- Uninstallation section ---
Section Uninstall
RmDir /r "$INSTDIR"
Delete "$INSTDIR\LICENSE"
Delete "$INSTDIR\homepage.url"
Delete "$INSTDIR\deluge-uninst.exe"
!include "uninstall_files.nsh"
SetShellVarContext all
Delete "$SMPROGRAMS\Deluge\Deluge.lnk"
Delete "$SMPROGRAMS\Deluge\Uninstall Deluge.lnk"
Delete "$SMPROGRAMS\Deluge\Project homepage.lnk"
Delete "$DESKTOP\Deluge.lnk"
Delete "$SMPROGRAMS\Deluge\Deluge Website.lnk"
RmDir "$SMPROGRAMS\Deluge"
Delete "$DESKTOP\Deluge.lnk"
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
# Delete the key since it is owned by Deluge; afterwards there is no .torrent association
DeleteRegKey HKCR ".torrent"
# Delete the key since it is owned by Deluge; afterwards there is no .torrent association
DeleteRegKey HKCR ".torrent"
DELUGE_skip_delete:
# This key is only used by Deluge, so we should always delete it
DeleteRegKey HKCR "Deluge"