mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 09:30:13 +03:00
900397c05e
Installer will fallback to English in case there are no translations available for the current system language
706 lines
27 KiB
Text
706 lines
27 KiB
Text
;ownCloud installer script.
|
|
|
|
!define APPLICATION_SHORTNAME "@APPLICATION_EXECUTABLE@"
|
|
!define APPLICATION_NAME "@APPLICATION_NAME@"
|
|
!define APPLICATION_VENDOR "@APPLICATION_VENDOR@"
|
|
!define APPLICATION_EXECUTABLE "@APPLICATION_EXECUTABLE@.exe"
|
|
!define APPLICATION_DOMAIN "@APPLICATION_DOMAIN@"
|
|
!define APPLICATION_LICENSE "@APPLICATION_LICENSE@"
|
|
!define WIN_SETUP_BITMAP_PATH "@WIN_SETUP_BITMAP_PATH@"
|
|
|
|
;-----------------------------------------------------------------------------
|
|
; Some installer script options (comment-out options not required)
|
|
;-----------------------------------------------------------------------------
|
|
!if "@APPLICATION_LICENSE@" != ""
|
|
!define OPTION_LICENSE_AGREEMENT
|
|
!endif
|
|
!define OPTION_UAC_PLUGIN_ENHANCED
|
|
!define OPTION_SECTION_SC_START_MENU
|
|
!define OPTION_SECTION_SC_DESKTOP
|
|
!define OPTION_SECTION_SC_QUICK_LAUNCH
|
|
!define OPTION_FINISHPAGE
|
|
!define OPTION_FINISHPAGE_LAUNCHER
|
|
; !define OPTION_FINISHPAGE_RELEASE_NOTES
|
|
|
|
;-----------------------------------------------------------------------------
|
|
; Some paths.
|
|
;-----------------------------------------------------------------------------
|
|
!ifndef MING_PATH
|
|
!define MING_PATH "/usr/i686-w64-mingw32/sys-root/mingw"
|
|
!endif
|
|
!define MING_BIN "${MING_PATH}/bin"
|
|
!define MING_LIB "${MING_PATH}/lib"
|
|
!define MING_SHARE "${MING_PATH}/share"
|
|
!define BUILD_PATH "@CMAKE_BINARY_DIR@"
|
|
!define SOURCE_PATH "@CMAKE_SOURCE_DIR@"
|
|
!define QT_DLL_PATH "${MING_BIN}"
|
|
!define ACCESSIBLE_DLL_PATH "${MING_LIB}/qt4/plugins/accessible"
|
|
!define SQLITE_DLL_PATH "${MING_LIB}/qt4/plugins/sqldrivers"
|
|
!define IMAGEFORMATS_DLL_PATH "${MING_LIB}/qt4/plugins/imageformats"
|
|
|
|
!define CSYNC_LIBRARY_DIR "@CSYNC_LIBRARY_DIR@"
|
|
!define CSYNC_CONFIG_DIR "@CSYNC_CONFIG_DIR@"
|
|
|
|
!define NSI_PATH "${source_path}/admin/win/nsi"
|
|
|
|
;-----------------------------------------------------------------------------
|
|
; Installer version
|
|
;-----------------------------------------------------------------------------
|
|
|
|
!define VER_MAJOR "@CPACK_PACKAGE_VERSION_MAJOR@"
|
|
!define VER_MINOR "@CPACK_PACKAGE_VERSION_MINOR@"
|
|
!define VER_PATCH "@CPACK_PACKAGE_VERSION_PATCH@"
|
|
!define VER_BUILD "@CPACK_PACKAGE_VERSION_BUILD@"
|
|
!define VERSION "@CPACK_PACKAGE_VERSION@"
|
|
|
|
;-----------------------------------------------------------------------------
|
|
; Installer build timestamp.
|
|
;-----------------------------------------------------------------------------
|
|
!define /date BUILD_TIME "built on %Y/%m/%d at %I:%M %p"
|
|
|
|
;-----------------------------------------------------------------------------
|
|
; Initial installer setup and definitions.
|
|
;-----------------------------------------------------------------------------
|
|
Name "@CPACK_NSIS_PACKAGE_NAME@"
|
|
BrandingText "${APPLICATION_NAME} ${VERSION} -- ${BUILD_TIME}"
|
|
OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
|
|
InstallDir "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
|
|
InstallDirRegKey HKCU "Software\${APPLICATION_NAME}" ""
|
|
InstType Standard
|
|
InstType Full
|
|
InstType Minimal
|
|
CRCCheck On
|
|
SetCompressor @CPACK_NSIS_COMPRESSOR@
|
|
RequestExecutionLevel user ;Now using the UAC plugin.
|
|
ReserveFile NSIS.InstallOptions.ini
|
|
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
|
|
|
|
@CPACK_NSIS_SECTION_SELECTED_VARS@
|
|
|
|
;-----------------------------------------------------------------------------
|
|
; Include some required header files.
|
|
;-----------------------------------------------------------------------------
|
|
!include LogicLib.nsh ;Used by APPDATA uninstaller.
|
|
!include nsDialogs.nsh ;Used by APPDATA uninstaller.
|
|
!include MUI2.nsh ;Used by APPDATA uninstaller.
|
|
!include InstallOptions.nsh ;Required by MUI2 to support old MUI_INSTALLOPTIONS.
|
|
!include Memento.nsh ;Remember user selections.
|
|
!include WinVer.nsh ;Windows version detection.
|
|
!include WordFunc.nsh ;Used by VersionCompare macro function.
|
|
!include UAC.nsh ;Used by the UAC elevation to install as user or admin.
|
|
|
|
;-----------------------------------------------------------------------------
|
|
; Memento selections stored in registry.
|
|
;-----------------------------------------------------------------------------
|
|
!define MEMENTO_REGISTRY_ROOT HKLM
|
|
!define MEMENTO_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}"
|
|
|
|
;-----------------------------------------------------------------------------
|
|
; Modern User Interface (MUI) defintions and setup.
|
|
;-----------------------------------------------------------------------------
|
|
!define MUI_ABORTWARNING
|
|
!define MUI_ICON ${NSI_PATH}\installer.ico
|
|
!define MUI_UNICON ${NSI_PATH}\installer.ico
|
|
!define MUI_WELCOMEFINISHPAGE_BITMAP ${WIN_SETUP_BITMAP_PATH}/welcome.bmp
|
|
!define MUI_HEADERIMAGE
|
|
!define MUI_HEADERIMAGE_BITMAP ${WIN_SETUP_BITMAP_PATH}/page_header.bmp
|
|
!define MUI_COMPONENTSPAGE_SMALLDESC
|
|
!define MUI_FINISHPAGE_LINK "www.${APPLICATION_DOMAIN}"
|
|
!define MUI_FINISHPAGE_LINK_LOCATION "http://www.${APPLICATION_DOMAIN}"
|
|
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
|
|
!ifdef OPTION_FINISHPAGE_RELEASE_NOTES
|
|
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
|
|
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\NOTES.txt"
|
|
!define MUI_FINISHPAGE_SHOWREADME_TEXT $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING
|
|
!endif
|
|
!ifdef OPTION_FINISHPAGE_LAUNCHER
|
|
!define MUI_FINISHPAGE_NOAUTOCLOSE
|
|
!define MUI_FINISHPAGE_RUN
|
|
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchApplication"
|
|
!endif
|
|
|
|
;-----------------------------------------------------------------------------
|
|
; Page macros.
|
|
;-----------------------------------------------------------------------------
|
|
!insertmacro MUI_PAGE_WELCOME
|
|
!ifdef OPTION_LICENSE_AGREEMENT
|
|
!insertmacro MUI_PAGE_LICENSE "${APPLICATION_LICENSE}"
|
|
!endif
|
|
Page custom PageReinstall PageLeaveReinstall
|
|
!insertmacro MUI_PAGE_COMPONENTS
|
|
!insertmacro MUI_PAGE_DIRECTORY
|
|
!insertmacro MUI_PAGE_INSTFILES
|
|
!ifdef OPTION_FINISHPAGE
|
|
!insertmacro MUI_PAGE_FINISH
|
|
!endif
|
|
!insertmacro MUI_UNPAGE_CONFIRM
|
|
UninstPage custom un.UnPageUserAppData un.UnPageUserAppDataLeave
|
|
!insertmacro MUI_UNPAGE_INSTFILES
|
|
|
|
;-----------------------------------------------------------------------------
|
|
; Other MUI macros.
|
|
;-----------------------------------------------------------------------------
|
|
!insertmacro MUI_LANGUAGE "English"
|
|
|
|
!include ${source_path}/admin/win/nsi/l10n/languages.nsh
|
|
!include ${source_path}/admin/win/nsi/l10n/declarations.nsh
|
|
|
|
##############################################################################
|
|
# #
|
|
# FINISH PAGE LAUNCHER FUNCTIONS #
|
|
# #
|
|
##############################################################################
|
|
|
|
Function LaunchApplication
|
|
${UAC.CallFunctionAsUser} LaunchApplicationAsUser
|
|
FunctionEnd
|
|
|
|
Function LaunchApplicationAsUser
|
|
Exec "$INSTDIR\${APPLICATION_EXECUTABLE}"
|
|
FunctionEnd
|
|
|
|
##############################################################################
|
|
# #
|
|
# PROCESS HANDLING FUNCTIONS AND MACROS #
|
|
# #
|
|
##############################################################################
|
|
|
|
!macro CheckForProcess processName gotoWhenFound gotoWhenNotFound
|
|
Processes::FindProcess ${processName}
|
|
StrCmp $R0 "0" ${gotoWhenNotFound} ${gotoWhenFound}
|
|
!macroend
|
|
|
|
!macro ConfirmEndProcess processName
|
|
MessageBox MB_YESNO|MB_ICONEXCLAMATION \
|
|
$ConfirmEndProcess_MESSAGEBOX_TEXT \
|
|
IDYES process_${processName}_kill IDNO process_${processName}_ended
|
|
process_${processName}_kill:
|
|
DetailPrint $ConfirmEndProcess_KILLING_PROCESSES_TEXT
|
|
Processes::KillProcess ${processName}
|
|
Sleep 1500
|
|
StrCmp $R0 "1" process_${processName}_ended
|
|
DetailPrint $ConfirmEndProcess_KILL_NOT_FOUND_TEXT
|
|
process_${processName}_ended:
|
|
!macroend
|
|
|
|
!macro CheckAndConfirmEndProcess processName
|
|
!insertmacro CheckForProcess ${processName} 0 no_process_${processName}_to_end
|
|
!insertmacro ConfirmEndProcess ${processName}
|
|
no_process_${processName}_to_end:
|
|
!macroend
|
|
|
|
Function EnsureOwncloudShutdown
|
|
!insertmacro CheckAndConfirmEndProcess "${APPLICATION_EXECUTABLE}"
|
|
FunctionEnd
|
|
|
|
##############################################################################
|
|
# #
|
|
# RE-INSTALLER FUNCTIONS #
|
|
# #
|
|
##############################################################################
|
|
|
|
Function PageReinstall
|
|
ReadRegStr $R0 HKLM "Software\${APPLICATION_NAME}" ""
|
|
StrCmp $R0 "" 0 +2
|
|
Abort
|
|
|
|
;Detect version
|
|
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionMajor"
|
|
IntCmp $R0 ${VER_MAJOR} minor_check new_version older_version
|
|
minor_check:
|
|
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionMinor"
|
|
IntCmp $R0 ${VER_MINOR} rev_check new_version older_version
|
|
rev_check:
|
|
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionRevision"
|
|
IntCmp $R0 ${VER_PATCH} build_check new_version older_version
|
|
build_check:
|
|
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionBuild"
|
|
IntCmp $R0 ${VER_BUILD} same_version new_version older_version
|
|
|
|
new_version:
|
|
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 1" "Text" $PageReinstall_NEW_Field_1
|
|
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 2" "Text" $PageReinstall_NEW_Field_2
|
|
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 3" "Text" $PageReinstall_NEW_Field_3
|
|
!insertmacro MUI_HEADER_TEXT $PageReinstall_NEW_MUI_HEADER_TEXT_TITLE $PageReinstall_NEW_MUI_HEADER_TEXT_SUBTITLE
|
|
StrCpy $R0 "1"
|
|
Goto reinst_start
|
|
|
|
older_version:
|
|
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 1" "Text" $PageReinstall_OLD_Field_1
|
|
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 2" "Text" $PageReinstall_OLD_Field_2
|
|
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 3" "Text" $PageReinstall_OLD_Field_3
|
|
!insertmacro MUI_HEADER_TEXT $PageReinstall_NEW_MUI_HEADER_TEXT_TITLE $PageReinstall_OLD_MUI_HEADER_TEXT_SUBTITLE
|
|
StrCpy $R0 "1"
|
|
Goto reinst_start
|
|
|
|
same_version:
|
|
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 1" "Text" $PageReinstall_SAME_Field_1
|
|
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 2" "Text" $PageReinstall_SAME_Field_2
|
|
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 3" "Text" $PageReinstall_SAME_Field_3
|
|
!insertmacro MUI_HEADER_TEXT $PageReinstall_NEW_MUI_HEADER_TEXT_TITLE $PageReinstall_SAME_MUI_HEADER_TEXT_SUBTITLE
|
|
StrCpy $R0 "2"
|
|
|
|
reinst_start:
|
|
!insertmacro INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini"
|
|
FunctionEnd
|
|
|
|
Function PageLeaveReinstall
|
|
!insertmacro INSTALLOPTIONS_READ $R1 "NSIS.InstallOptions.ini" "Field 2" "State"
|
|
StrCmp $R0 "1" 0 +2
|
|
StrCmp $R1 "1" reinst_uninstall reinst_done
|
|
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"
|
|
HideWindow
|
|
ClearErrors
|
|
ExecWait '$R1 _?=$INSTDIR'
|
|
IfErrors no_remove_uninstaller
|
|
IfFileExists "$INSTDIR\${APPLICATION_EXECUTABLE}" no_remove_uninstaller
|
|
Delete $R1
|
|
RMDir $INSTDIR
|
|
no_remove_uninstaller:
|
|
StrCmp $R0 "2" 0 +3
|
|
UAC::Unload
|
|
Quit
|
|
BringToFront
|
|
reinst_done:
|
|
FunctionEnd
|
|
|
|
##############################################################################
|
|
# #
|
|
# INSTALLER SECTIONS #
|
|
# #
|
|
##############################################################################
|
|
Section "${APPLICATION_NAME}" SEC_APPLICATION
|
|
SectionIn 1 2 3 RO
|
|
SetDetailsPrint listonly
|
|
|
|
SetDetailsPrint textonly
|
|
DetailPrint $SEC_APPLICATION_DETAILS
|
|
SetDetailsPrint listonly
|
|
SetOutPath "$INSTDIR"
|
|
|
|
!ifdef INSTALL_PATH
|
|
;Main executable.
|
|
File "${INSTALL_PATH}\bin\${APPLICATION_EXECUTABLE}"
|
|
!endif
|
|
!ifndef INSTALL_PATH
|
|
;Main executable.
|
|
File "${BUILD_PATH}\bin\${APPLICATION_EXECUTABLE}"
|
|
File "${BUILD_PATH}\src\lib${APPLICATION_SHORTNAME}sync.dll"
|
|
|
|
File "${BUILD_PATH}\src\mirall_*.qm"
|
|
; Make sure only to copy qt, not qt_help, etc
|
|
File "${MING_SHARE}\qt4\translations\qt_??.qm"
|
|
File "${MING_SHARE}\qt4\translations\qt_??_??.qm"
|
|
File "${MING_SHARE}\qt4\translations\qtkeychain_*.qm"
|
|
|
|
SetOutPath "$INSTDIR\accessible"
|
|
File "${ACCESSIBLE_DLL_PATH}\qtaccessiblewidgets4.dll"
|
|
SetOutPath "$INSTDIR\imageformats"
|
|
File "${IMAGEFORMATS_DLL_PATH}\qgif4.dll"
|
|
File "${IMAGEFORMATS_DLL_PATH}\qjpeg4.dll"
|
|
File "${IMAGEFORMATS_DLL_PATH}\qico4.dll"
|
|
|
|
SetOutPath "$INSTDIR\sqldrivers"
|
|
File "${SQLITE_DLL_PATH}\qsqlite4.dll"
|
|
|
|
SetOutPath "$INSTDIR"
|
|
!endif
|
|
|
|
|
|
|
|
;License & release notes.
|
|
File "@CPACK_RESOURCE_FILE_LICENSE@"
|
|
;File /oname=NOTES.txt ${NSI_PATH}\RELEASE_NOTES.txt
|
|
|
|
;QT stuff:
|
|
File "${QT_DLL_PATH}\QtCore4.dll"
|
|
File "${QT_DLL_PATH}\QtGui4.dll"
|
|
File "${QT_DLL_PATH}\QtNetwork4.dll"
|
|
File "${QT_DLL_PATH}\QtSql4.dll"
|
|
File "${QT_DLL_PATH}\QtXml4.dll"
|
|
File "${QT_DLL_PATH}\QtWebKit4.dll"
|
|
|
|
;QtKeyChain stuff
|
|
File "${MING_BIN}\libqtkeychain.dll"
|
|
|
|
File "${CSYNC_LIBRARY_DIR}\libocsync.dll"
|
|
File "${MING_BIN}\libsqlite3-0.dll"
|
|
File "${MING_BIN}\libpng15-15.dll"
|
|
|
|
; ownCloud plugin
|
|
File "${MING_BIN}\libintl-8.dll"
|
|
File "${MING_BIN}\libneon-27.dll"
|
|
File "${MING_BIN}\libproxy.dll"
|
|
File "${MING_BIN}\libmodman.dll"
|
|
File "${MING_BIN}\libxml2-2.dll"
|
|
|
|
;MinGW stuff
|
|
File "${MING_BIN}\libgcc_s_sjlj-1.dll"
|
|
File "${MING_BIN}\libstdc++-6.dll"
|
|
|
|
; Other
|
|
;File "${MING_BIN}\libpng15-15.dll"
|
|
File "${MING_BIN}\libjpeg-8.dll"
|
|
File "${MING_BIN}\zlib1.dll"
|
|
File "${MING_BIN}\libcrypto-10.dll"
|
|
File "${MING_BIN}\libssl-10.dll"
|
|
|
|
; CSync configs
|
|
File "${SOURCE_PATH}/sync-exclude.lst"
|
|
|
|
SectionEnd
|
|
|
|
SectionGroup $SectionGroup_Shortcuts
|
|
|
|
!ifdef OPTION_SECTION_SC_START_MENU
|
|
${MementoSection} $OPTION_SECTION_SC_START_MENU_SECTION SEC_START_MENU
|
|
SectionIn 1 2 3
|
|
SetDetailsPrint textonly
|
|
DetailPrint $OPTION_SECTION_SC_START_MENU_DetailPrint
|
|
SetDetailsPrint listonly
|
|
SetShellVarContext all
|
|
CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}.lnk" "$INSTDIR\${APPLICATION_EXECUTABLE}"
|
|
SetShellVarContext current
|
|
${MementoSectionEnd}
|
|
!endif
|
|
|
|
!ifdef OPTION_SECTION_SC_DESKTOP
|
|
${MementoSection} $OPTION_SECTION_SC_DESKTOP_SECTION SEC_DESKTOP
|
|
SectionIn 1 2
|
|
SetDetailsPrint textonly
|
|
DetailPrint $OPTION_SECTION_SC_DESKTOP_DetailPrint
|
|
SetDetailsPrint listonly
|
|
CreateShortCut "$DESKTOP\${APPLICATION_NAME}.lnk" "$INSTDIR\${APPLICATION_EXECUTABLE}"
|
|
${MementoSectionEnd}
|
|
!endif
|
|
|
|
!ifdef OPTION_SECTION_SC_QUICK_LAUNCH
|
|
${MementoSection} $OPTION_SECTION_SC_QUICK_LAUNCH_SECTION SEC_QUICK_LAUNCH
|
|
SectionIn 1 2
|
|
SetDetailsPrint textonly
|
|
DetailPrint $OPTION_SECTION_SC_QUICK_LAUNCH_DetailPrint
|
|
SetDetailsPrint listonly
|
|
CreateShortCut "$QUICKLAUNCH\${APPLICATION_NAME}.lnk" "$INSTDIR\${APPLICATION_EXECUTABLE}"
|
|
${MementoSectionEnd}
|
|
!endif
|
|
|
|
SectionGroupEnd
|
|
|
|
${MementoSectionDone}
|
|
|
|
; Installer section descriptions
|
|
;--------------------------------
|
|
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_APPLICATION} $OPTION_SECTION_SC_APPLICATION_Desc
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_START_MENU} $OPTION_SECTION_SC_START_MENU_Desc
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DESKTOP} $OPTION_SECTION_SC_DESKTOP_Desc
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QUICK_LAUNCH} $OPTION_SECTION_SC_QUICK_LAUNCH_Desc
|
|
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
|
|
|
|
|
Section -post
|
|
|
|
;Uninstaller file.
|
|
SetDetailsPrint textonly
|
|
DetailPrint $UNINSTALLER_FILE_Detail
|
|
SetDetailsPrint listonly
|
|
WriteUninstaller $INSTDIR\uninstall.exe
|
|
|
|
;Registry keys required for installer version handling and uninstaller.
|
|
SetDetailsPrint textonly
|
|
DetailPrint $UNINSTALLER_REGISTRY_Detail
|
|
SetDetailsPrint listonly
|
|
|
|
;Version numbers used to detect existing installation version for comparisson.
|
|
WriteRegStr HKLM "Software\${APPLICATION_NAME}" "" $INSTDIR
|
|
WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionMajor" "${VER_MAJOR}"
|
|
WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionMinor" "${VER_MINOR}"
|
|
WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionRevision" "${VER_PATCH}"
|
|
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"
|
|
|
|
|
|
SetDetailsPrint textonly
|
|
DetailPrint $UNINSTALLER_FINISHED_Detail
|
|
SectionEnd
|
|
|
|
##############################################################################
|
|
# #
|
|
# UNINSTALLER SECTION #
|
|
# #
|
|
##############################################################################
|
|
|
|
Var UnPageUserAppDataDialog
|
|
Var UnPageUserAppDataCheckbox
|
|
Var UnPageUserAppDataCheckbox_State
|
|
Var UnPageUserAppDataEditBox
|
|
|
|
Function un.UnPageUserAppData
|
|
!insertmacro MUI_HEADER_TEXT $UNINSTALLER_APPDATA_TITLE $UNINSTALLER_APPDATA_SUBTITLE
|
|
nsDialogs::Create /NOUNLOAD 1018
|
|
Pop $UnPageUserAppDataDialog
|
|
|
|
${If} $UnPageUserAppDataDialog == error
|
|
Abort
|
|
${EndIf}
|
|
|
|
${NSD_CreateLabel} 0 0 100% 12u $UNINSTALLER_APPDATA_LABEL_1
|
|
Pop $0
|
|
|
|
${NSD_CreateText} 0 13u 100% 12u "$LOCALAPPDATA\${APPLICATION_NAME}"
|
|
Pop $UnPageUserAppDataEditBox
|
|
SendMessage $UnPageUserAppDataEditBox ${EM_SETREADONLY} 1 0
|
|
|
|
${NSD_CreateLabel} 0 46u 100% 24u $UNINSTALLER_APPDATA_LABEL_2
|
|
Pop $0
|
|
|
|
${NSD_CreateCheckbox} 0 71u 100% 8u $UNINSTALLER_APPDATA_CHECKBOX
|
|
Pop $UnPageUserAppDataCheckbox
|
|
|
|
nsDialogs::Show
|
|
FunctionEnd
|
|
|
|
Function un.UnPageUserAppDataLeave
|
|
${NSD_GetState} $UnPageUserAppDataCheckbox $UnPageUserAppDataCheckbox_State
|
|
FunctionEnd
|
|
|
|
Function un.EnsureOwncloudShutdown
|
|
!insertmacro CheckAndConfirmEndProcess "${APPLICATION_EXECUTABLE}"
|
|
FunctionEnd
|
|
|
|
Section Uninstall
|
|
IfFileExists "$INSTDIR\${APPLICATION_EXECUTABLE}" owncloud_installed
|
|
MessageBox MB_YESNO $UNINSTALL_MESSAGEBOX 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"
|
|
DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionRevision"
|
|
DeleteRegValue HKLM "Software\${APPLICATION_NAME}" ""
|
|
DeleteRegKey HKLM "Software\${APPLICATION_NAME}"
|
|
|
|
DeleteRegKey HKCR "${APPLICATION_NAME}"
|
|
|
|
;Start menu shortcuts.
|
|
!ifdef OPTION_SECTION_SC_START_MENU
|
|
SetShellVarContext all
|
|
Delete "$SMPROGRAMS\${APPLICATION_NAME}.lnk"
|
|
SetShellVarContext current
|
|
!endif
|
|
|
|
;Desktop shortcut.
|
|
!ifdef OPTION_SECTION_SC_DESKTOP
|
|
IfFileExists "$DESKTOP\${APPLICATION_NAME}.lnk" 0 +2
|
|
Delete "$DESKTOP\${APPLICATION_NAME}.lnk"
|
|
!endif
|
|
|
|
;Quick Launch shortcut.
|
|
!ifdef OPTION_SECTION_SC_QUICK_LAUNCH
|
|
IfFileExists "$QUICKLAUNCH\${APPLICATION_NAME}.lnk" 0 +2
|
|
Delete "$QUICKLAUNCH\${APPLICATION_NAME}.lnk"
|
|
!endif
|
|
|
|
;Remove all the Program Files.
|
|
RMDir /r $INSTDIR
|
|
|
|
;Uninstall User Data if option is checked, otherwise skip.
|
|
${If} $UnPageUserAppDataCheckbox_State == ${BST_CHECKED}
|
|
RMDir /r "$LOCALAPPDATA\${APPLICATION_NAME}"
|
|
${EndIf}
|
|
|
|
SetDetailsPrint textonly
|
|
DetailPrint $UNINSTALLER_FINISHED_Detail
|
|
SectionEnd
|
|
|
|
##############################################################################
|
|
# #
|
|
# NSIS Installer Event Handler Functions #
|
|
# #
|
|
##############################################################################
|
|
|
|
Function .onInit
|
|
!insertmacro INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
|
|
|
|
; uncomment this line if you want to see the language selection
|
|
;!insertmacro MUI_LANGDLL_DISPLAY
|
|
|
|
# load the selected language file
|
|
!include "${source_path}/admin/win/nsi/l10n\English.nsh"
|
|
StrCmp $LANGUAGE ${LANG_GERMAN} German 0
|
|
StrCmp $LANGUAGE ${LANG_DUTCH} Dutch 0
|
|
StrCmp $LANGUAGE ${LANG_FINNISH} Finnish 0
|
|
StrCmp $LANGUAGE ${LANG_JAPANESE} Japanese 0
|
|
StrCmp $LANGUAGE ${LANG_SLOVENIAN} Slovenian 0
|
|
StrCmp $LANGUAGE ${LANG_SPANISH} Spanish 0
|
|
StrCmp $LANGUAGE ${LANG_ITALIAN} Italian 0
|
|
StrCmp $LANGUAGE ${LANG_ESTONIAN} Estonian 0
|
|
StrCmp $LANGUAGE ${LANG_GREEK} Greek 0
|
|
StrCmp $LANGUAGE ${LANG_GREEK} Basque 0
|
|
StrCmp $LANGUAGE ${LANG_GREEK} Galician 0
|
|
StrCmp $LANGUAGE ${LANG_GREEK} Slovak 0
|
|
StrCmp $LANGUAGE ${LANG_GREEK} Turkish 0
|
|
StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} Brazilian EndLanguageCmp
|
|
German:
|
|
!include "${source_path}/admin/win/nsi/l10n\German.nsh"
|
|
Goto EndLanguageCmp
|
|
Dutch:
|
|
!include "${source_path}/admin/win/nsi/l10n\Dutch.nsh"
|
|
Goto EndLanguageCmp
|
|
Finnish:
|
|
!include "${source_path}/admin/win/nsi/l10n\Finnish.nsh"
|
|
Goto EndLanguageCmp
|
|
Japanese:
|
|
!include "${source_path}/admin/win/nsi/l10n\Japanese.nsh"
|
|
Goto EndLanguageCmp
|
|
Slovenian:
|
|
!include "${source_path}/admin/win/nsi/l10n\Slovenian.nsh"
|
|
Goto EndLanguageCmp
|
|
Spanish:
|
|
!include "${source_path}/admin/win/nsi/l10n\Spanish.nsh"
|
|
Goto EndLanguageCmp
|
|
Italian:
|
|
!include "${source_path}/admin/win/nsi/l10n\Italian.nsh"
|
|
Goto EndLanguageCmp
|
|
Estonian:
|
|
!include "${source_path}/admin/win/nsi/l10n\Estonian.nsh"
|
|
Goto EndLanguageCmp
|
|
Greek:
|
|
!include "${source_path}/admin/win/nsi/l10n\Greek.nsh"
|
|
Goto EndLanguageCmp
|
|
Basque:
|
|
!include "${source_path}/admin/win/nsi/l10n\Basque.nsh"
|
|
Goto EndLanguageCmp
|
|
Galician:
|
|
!include "${source_path}/admin/win/nsi/l10n\Galician.nsh"
|
|
Goto EndLanguageCmp
|
|
Slovak:
|
|
!include "${source_path}/admin/win/nsi/l10n\Slovak.nsh"
|
|
Goto EndLanguageCmp
|
|
Turkish:
|
|
!include "${source_path}/admin/win/nsi/l10n\Turkish.nsh"
|
|
Goto EndLanguageCmp
|
|
Brazilian:
|
|
!include "${source_path}/admin/win/nsi/l10n\PortugueseBR.nsh"
|
|
EndLanguageCmp:
|
|
|
|
;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}
|
|
|
|
${MementoSectionRestore}
|
|
|
|
UAC_Elevate:
|
|
UAC::RunElevated
|
|
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
|
|
StrCmp 0 $0 0 UAC_Err ; Error?
|
|
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
|
|
Quit
|
|
|
|
UAC_Err:
|
|
MessageBox MB_ICONSTOP "$UAC_ERROR_ELEVATE $0"
|
|
Abort
|
|
|
|
UAC_ElevationAborted:
|
|
Abort
|
|
|
|
UAC_Success:
|
|
StrCmp 1 $3 +4 ;Admin?
|
|
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
|
|
MessageBox MB_ICONSTOP $UAC_INSTALLER_REQUIRE_ADMIN
|
|
goto UAC_Elevate
|
|
|
|
;Prevent multiple instances.
|
|
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "owncloudInstaller") i .r1 ?e'
|
|
Pop $R0
|
|
StrCmp $R0 0 +3
|
|
MessageBox MB_OK|MB_ICONEXCLAMATION $INIT_INSTALLER_RUNNING
|
|
Abort
|
|
|
|
;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"
|
|
StrCmp $R0 "" SkipSetInstDir
|
|
StrCpy $INSTDIR $R0
|
|
SkipSetInstDir:
|
|
|
|
;Shutdown ${APPLICATION_NAME} in case Add/Remove re-installer option used.
|
|
Call EnsureOwncloudShutdown
|
|
FunctionEnd
|
|
|
|
Function .onInstSuccess
|
|
${MementoSectionSave}
|
|
UAC::Unload ;Must call unload!
|
|
FunctionEnd
|
|
|
|
Function .onInstFailed
|
|
UAC::Unload ;Must call unload!
|
|
FunctionEnd
|
|
|
|
##############################################################################
|
|
# #
|
|
# NSIS Uninstaller Event Handler Functions #
|
|
# #
|
|
##############################################################################
|
|
|
|
Function un.onInit
|
|
UAC_Elevate:
|
|
UAC::RunElevated
|
|
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
|
|
StrCmp 0 $0 0 UAC_Err ; Error?
|
|
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
|
|
Quit
|
|
|
|
UAC_Err:
|
|
MessageBox MB_ICONSTOP "$UAC_ERROR_ELEVATE $0"
|
|
Abort
|
|
|
|
UAC_ElevationAborted:
|
|
Abort
|
|
|
|
UAC_Success:
|
|
StrCmp 1 $3 +4 ;Admin?
|
|
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
|
|
MessageBox MB_ICONSTOP $UAC_UNINSTALLER_REQUIRE_ADMIN
|
|
goto UAC_Elevate
|
|
|
|
;Prevent multiple instances.
|
|
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "owncloudUninstaller") i .r1 ?e'
|
|
Pop $R0
|
|
StrCmp $R0 0 +3
|
|
MessageBox MB_OK|MB_ICONEXCLAMATION $INIT_UNINSTALLER_RUNNING
|
|
Abort
|
|
|
|
;Shutdown ${APPLICATION_NAME} in order to remove locked files.
|
|
Call un.EnsureOwncloudShutdown
|
|
FunctionEnd
|
|
|
|
Function un.onUnInstSuccess
|
|
UAC::Unload ;Must call unload!
|
|
FunctionEnd
|
|
|
|
Function un.onUnInstFailed
|
|
UAC::Unload ;Must call unload!
|
|
FunctionEnd
|