mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Merge pull request #1357 from owncloud/nsis_fixes
NSIS preparations for upgrade mode
This commit is contained in:
commit
484ad28cd6
@ -35,6 +35,7 @@ StrCpy $UNINSTALLER_FINISHED_Detail "Finished"
|
||||
StrCpy $UNINSTALL_MESSAGEBOX "It does not appear that ${APPLICATION_NAME} is installed in the directory '$INSTDIR'.$\r$\nContinue anyway (not recommended)?"
|
||||
StrCpy $UNINSTALL_ABORT "Uninstall aborted by user"
|
||||
StrCpy $INIT_NO_QUICK_LAUNCH "Quick Launch Shortcut (N/A)"
|
||||
StrCpy $INIT_NO_DESKTOP "Desktop Shortcut (overwrites existing)"
|
||||
StrCpy $UAC_ERROR_ELEVATE "Unable to elevate, error:"
|
||||
StrCpy $UAC_INSTALLER_REQUIRE_ADMIN "This installer requires admin access, try again"
|
||||
StrCpy $INIT_INSTALLER_RUNNING "The installer is already running."
|
||||
|
||||
@ -35,6 +35,7 @@ Var UNINSTALLER_FINISHED_Detail
|
||||
Var UNINSTALL_MESSAGEBOX
|
||||
Var UNINSTALL_ABORT
|
||||
Var INIT_NO_QUICK_LAUNCH
|
||||
Var INIT_NO_DESKTOP
|
||||
Var UAC_ERROR_ELEVATE
|
||||
Var UAC_INSTALLER_REQUIRE_ADMIN
|
||||
Var INIT_INSTALLER_RUNNING
|
||||
|
||||
@ -212,6 +212,13 @@ UninstPage custom un.UnPageUserAppData un.UnPageUserAppDataLeave
|
||||
!insertmacro SETLANG ""
|
||||
!insertmacro SETLANG "un."
|
||||
|
||||
; Usage: ${If} ${HasSection} SectionName
|
||||
!macro _HasSection _a _b _t _f
|
||||
ReadRegDWORD $_LOGICLIB_TEMP "${MEMENTO_REGISTRY_ROOT}" "${MEMENTO_REGISTRY_KEY}" "MementoSection_${_b}"
|
||||
IntCmpU $_LOGICLIB_TEMP 0 ${_f} ${_t}
|
||||
!macroend
|
||||
!define HasSection `"" HasSection`
|
||||
|
||||
##############################################################################
|
||||
# #
|
||||
# FINISH PAGE LAUNCHER FUNCTIONS #
|
||||
@ -318,7 +325,7 @@ Function PageLeaveReinstall
|
||||
StrCmp $R0 "2" 0 +3
|
||||
StrCmp $R1 "1" reinst_done reinst_uninstall
|
||||
reinst_uninstall:
|
||||
ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "UninstallString"
|
||||
ReadRegStr $R1 ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "UninstallString"
|
||||
HideWindow
|
||||
ClearErrors
|
||||
ExecWait '$R1 _?=$INSTDIR'
|
||||
@ -483,18 +490,18 @@ Section -post
|
||||
WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionBuild" "${VER_BUILD}"
|
||||
|
||||
;Add or Remove Programs entry.
|
||||
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
|
||||
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "InstallLocation" "$INSTDIR"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "DisplayName" "${APPLICATION_NAME}"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "Publisher" "${APPLICATION_VENDOR}"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "DisplayIcon" "$INSTDIR\Uninstall.exe,0"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "DisplayVersion" "${VERSION}"
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "VersionMajor" "${VER_MAJOR}"
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "VersionMinor" "${VER_MINOR}.${REVISION}"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "URLInfoAbout" "http://${APPLICATION_DOMAIN}/"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "HelpLink" "http://${APPLICATION_DOMAIN}/"
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "NoModify" "1"
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "NoRepair" "1"
|
||||
WriteRegExpandStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
|
||||
WriteRegExpandStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "InstallLocation" "$INSTDIR"
|
||||
WriteRegStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "DisplayName" "${APPLICATION_NAME}"
|
||||
WriteRegStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "Publisher" "${APPLICATION_VENDOR}"
|
||||
WriteRegStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "DisplayIcon" "$INSTDIR\Uninstall.exe,0"
|
||||
WriteRegStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "DisplayVersion" "${VERSION}"
|
||||
WriteRegDWORD ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "VersionMajor" "${VER_MAJOR}"
|
||||
WriteRegDWORD ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "VersionMinor" "${VER_MINOR}.${REVISION}"
|
||||
WriteRegStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "URLInfoAbout" "http://${APPLICATION_DOMAIN}/"
|
||||
WriteRegStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "HelpLink" "http://${APPLICATION_DOMAIN}/"
|
||||
WriteRegDWORD ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "NoModify" "1"
|
||||
WriteRegDWORD ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "NoRepair" "1"
|
||||
|
||||
|
||||
SetDetailsPrint textonly
|
||||
@ -547,12 +554,11 @@ FunctionEnd
|
||||
|
||||
Section Uninstall
|
||||
IfFileExists "$INSTDIR\${APPLICATION_EXECUTABLE}" owncloud_installed
|
||||
MessageBox MB_YESNO $UNINSTALL_MESSAGEBOX IDYES owncloud_installed
|
||||
MessageBox MB_YESNO $UNINSTALL_MESSAGEBOX /SD IDYES IDYES owncloud_installed
|
||||
Abort $UNINSTALL_ABORT
|
||||
owncloud_installed:
|
||||
|
||||
;Delete registry keys.
|
||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}"
|
||||
DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionBuild"
|
||||
DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionMajor"
|
||||
DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionMinor"
|
||||
@ -562,23 +568,31 @@ Section Uninstall
|
||||
|
||||
DeleteRegKey HKCR "${APPLICATION_NAME}"
|
||||
|
||||
;Start menu shortcuts.
|
||||
;Start menu shortcut
|
||||
!ifdef OPTION_SECTION_SC_START_MENU
|
||||
SetShellVarContext all
|
||||
Delete "$SMPROGRAMS\${APPLICATION_NAME}.lnk"
|
||||
${If} ${HasSection} SEC_START_MENU
|
||||
Delete "$SMPROGRAMS\${APPLICATION_NAME}.lnk"
|
||||
${EndIf}
|
||||
SetShellVarContext current
|
||||
!endif
|
||||
|
||||
;Desktop shortcut.
|
||||
!ifdef OPTION_SECTION_SC_DESKTOP
|
||||
IfFileExists "$DESKTOP\${APPLICATION_NAME}.lnk" 0 +2
|
||||
Delete "$DESKTOP\${APPLICATION_NAME}.lnk"
|
||||
${If} ${HasSection} SEC_DESKTOP
|
||||
${If} ${FileExists} "$DESKTOP\${APPLICATION_NAME}.lnk"
|
||||
Delete "$DESKTOP\${APPLICATION_NAME}.lnk"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
!endif
|
||||
|
||||
;Quick Launch shortcut.
|
||||
!ifdef OPTION_SECTION_SC_QUICK_LAUNCH
|
||||
IfFileExists "$QUICKLAUNCH\${APPLICATION_NAME}.lnk" 0 +2
|
||||
Delete "$QUICKLAUNCH\${APPLICATION_NAME}.lnk"
|
||||
${If} ${HasSection} SEC_QUICK_LAUNCH
|
||||
${If} ${FileExists} "$QUICKLAUNCH\${APPLICATION_NAME}.lnk"
|
||||
Delete "$QUICKLAUNCH\${APPLICATION_NAME}.lnk"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
!endif
|
||||
|
||||
;Remove all the Program Files.
|
||||
@ -589,6 +603,8 @@ Section Uninstall
|
||||
RMDir /r "$LOCALAPPDATA\${APPLICATION_NAME}"
|
||||
${EndIf}
|
||||
|
||||
DeleteRegKey ${MEMENTO_REGISTRY_ROOT} ${MEMENTO_REGISTRY_KEY}
|
||||
|
||||
SetDetailsPrint textonly
|
||||
DetailPrint $UNINSTALLER_FINISHED_Detail
|
||||
SectionEnd
|
||||
@ -610,13 +626,23 @@ Function .onInit
|
||||
|
||||
Call SetLang
|
||||
|
||||
;Remove Quick Launch option from Windows 7, as no longer applicable - usually.
|
||||
; Remove Quick Launch option from Windows 7, as no longer applicable - usually.
|
||||
${IfNot} ${AtMostWinVista}
|
||||
SectionSetText ${SEC_QUICK_LAUNCH} $INIT_NO_QUICK_LAUNCH
|
||||
SectionSetFlags ${SEC_QUICK_LAUNCH} ${SF_RO}
|
||||
SectionSetInstTypes ${SEC_QUICK_LAUNCH} 0
|
||||
${EndIf}
|
||||
|
||||
; Some people might have a shortcut called 'ownCloud' pointing elsewhere, see #356
|
||||
; Unselect item and adjust text
|
||||
${If} ${FileExists} "$DESKTOP\${APPLICATION_NAME}.lnk"
|
||||
SectionSetText ${SEC_DESKTOP} $INIT_NO_DESKTOP
|
||||
Push $0
|
||||
SectionSetFlags ${SEC_DESKTOP} 0
|
||||
SectionSetInstTypes ${SEC_DESKTOP} 0
|
||||
Pop $0
|
||||
${EndIf}
|
||||
|
||||
${MementoSectionRestore}
|
||||
|
||||
UAC_Elevate:
|
||||
@ -648,7 +674,7 @@ Function .onInit
|
||||
|
||||
;Use available InstallLocation when possible. This is useful in the uninstaller
|
||||
;via re-install, which would otherwise use a default location - a bug.
|
||||
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "InstallLocation"
|
||||
ReadRegStr $R0 ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "InstallLocation"
|
||||
StrCmp $R0 "" SkipSetInstDir
|
||||
StrCpy $INSTDIR $R0
|
||||
SkipSetInstDir:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user