Bug 349551 - Updated builds won't uninstall via Windows Control Panel (Sunbird). r=dmose

This commit is contained in:
rob_strong%exchangecode.com 2006-08-30 00:08:59 +00:00
Родитель 8c9f4f95c5
Коммит e7a53e5ec6
6 изменённых файлов: 673 добавлений и 518 удалений

Просмотреть файл

@ -54,6 +54,7 @@ PP_LOCALIZED_FILES = \
INSTALLER_FILES = \ INSTALLER_FILES = \
app.tag \ app.tag \
nsis/installer.nsi \ nsis/installer.nsi \
nsis/uninstaller.nsi \
$(NULL) $(NULL)
BRANDING_FILES = \ BRANDING_FILES = \
@ -79,6 +80,10 @@ installer::
$(MAKE) -C .. installer-stage $(MAKE) -C .. installer-stage
$(MAKE) $(CONFIG_DIR)/setup.exe $(MAKE) $(CONFIG_DIR)/setup.exe
# For building the uninstaller during the application build so it can be
# included for mar file generation.
uninstaller::
$(CONFIG_DIR)/setup.exe:: $(CONFIG_DIR)/setup.exe::
$(RM) -rf $(CONFIG_DIR) && mkdir $(CONFIG_DIR) $(RM) -rf $(CONFIG_DIR) && mkdir $(CONFIG_DIR)
$(INSTALL) $(addprefix $(srcdir)/,$(INSTALLER_FILES)) $(CONFIG_DIR) $(INSTALL) $(addprefix $(srcdir)/,$(INSTALLER_FILES)) $(CONFIG_DIR)

Просмотреть файл

@ -37,11 +37,8 @@
# Also requires: # Also requires:
# ShellLink plugin http://nsis.sourceforge.net/ShellLink_plug-in # ShellLink plugin http://nsis.sourceforge.net/ShellLink_plug-in
; NOTES ; Set verbosity to 3 (e.g. no script) to lessen the noise in the build logs
; Size matters! Try different methods to accomplish the same result and use the !verbose 3
; one that results in the smallest size. Every KB counts!
; LogicLib.nsh must be included in all installers to ease script creation and
; readability. It adds a couple of KB to the size but it is worth it.
; 7-Zip provides better compression than the lzma from NSIS so we add the files ; 7-Zip provides better compression than the lzma from NSIS so we add the files
; uncompressed and use 7-Zip to create a SFX archive of it ; uncompressed and use 7-Zip to create a SFX archive of it
@ -49,13 +46,24 @@ SetDatablockOptimize on
SetCompress off SetCompress off
CRCCheck on CRCCheck on
; empty files - except for the comment line - for generating custom pages.
!system 'echo ; > options.ini'
!system 'echo ; > shortcuts.ini'
!addplugindir ./ !addplugindir ./
; Other files may depend upon these includes! ; empty files - except for the comment line - for generating custom pages.
!system 'echo ; > options.ini'
!system 'echo ; > components.ini'
!system 'echo ; > shortcuts.ini'
Var TmpVal
Var StartMenuDir
Var InstallType
Var AddStartMenuSC
Var AddQuickLaunchSC
Var AddDesktopSC
Var fhInstallLog
Var fhUninstallLog
; Other included files may depend upon these includes!
; The following includes are provided by NSIS.
!include FileFunc.nsh !include FileFunc.nsh
!include LogicLib.nsh !include LogicLib.nsh
!include TextFunc.nsh !include TextFunc.nsh
@ -66,28 +74,17 @@ CRCCheck on
!insertmacro FileJoin !insertmacro FileJoin
!insertmacro GetTime !insertmacro GetTime
!insertmacro LineFind !insertmacro LineFind
!insertmacro un.LineFind
!insertmacro StrFilter !insertmacro StrFilter
!insertmacro TrimNewLines !insertmacro TrimNewLines
!insertmacro un.TrimNewLines
!insertmacro WordFind !insertmacro WordFind
!insertmacro WordReplace !insertmacro WordReplace
!insertmacro GetSize !insertmacro GetSize
!insertmacro GetParameters !insertmacro GetParameters
!insertmacro un.GetParameters
!insertmacro GetOptions !insertmacro GetOptions
!insertmacro GetRoot
!insertmacro DriveSpace
; Use the pre-processor where ever possible ; The following includes are custom.
; Remember that !define's create smaller packages than Var's!
Var TmpVal
Var StartMenuDir
Var InstallType
Var AddStartMenuSC
Var AddQuickLaunchSC
Var AddDesktopSC
Var fhInstallLog
Var fhUninstallLog
!include branding.nsi !include branding.nsi
!include defines.nsi !include defines.nsi
!include common.nsh !include common.nsh
@ -95,16 +92,14 @@ Var fhUninstallLog
!include version.nsh !include version.nsh
!insertmacro RegCleanMain !insertmacro RegCleanMain
!insertmacro un.RegCleanMain
!insertmacro RegCleanUninstall !insertmacro RegCleanUninstall
!insertmacro un.RegCleanUninstall
!insertmacro CloseApp !insertmacro CloseApp
!insertmacro un.CloseApp
!insertmacro WriteRegStr2 !insertmacro WriteRegStr2
!insertmacro WriteRegDWORD2 !insertmacro WriteRegDWORD2
!insertmacro WriteRegStrHKCR !insertmacro WriteRegStrHKCR
!insertmacro CreateRegKey !insertmacro CreateRegKey
!insertmacro un.GetSecondInstallPath !insertmacro CanWriteToInstallDir
!insertmacro CheckDiskSpace
!include overrides.nsh !include overrides.nsh
!insertmacro LocateNoDetails !insertmacro LocateNoDetails
@ -114,27 +109,22 @@ Name "${BrandFullName}"
OutFile "setup.exe" OutFile "setup.exe"
InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} (${AppVersion})" "InstallLocation" InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} (${AppVersion})" "InstallLocation"
InstallDir "$PROGRAMFILES\${BrandFullName}" InstallDir "$PROGRAMFILES\${BrandFullName}"
ShowInstDetails nevershow ShowInstDetails nevershow
ShowUnInstDetails nevershow
ReserveFile options.ini
ReserveFile components.ini
ReserveFile shortcuts.ini
################################################################################ ################################################################################
# Modern User Interface - MUI # Modern User Interface - MUI
ReserveFile options.ini
ReserveFile shortcuts.ini
!define MUI_ABORTWARNING !define MUI_ABORTWARNING
!define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_ICON setup.ico !define MUI_ICON setup.ico
!define MUI_UNICON setup.ico !define MUI_UNICON setup.ico
!define MUI_WELCOMEPAGE_TITLE_3LINES !define MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_WELCOMEFINISHPAGE_BITMAP wizWatermark.bmp
!define MUI_UNWELCOMEFINISHPAGE_BITMAP wizWatermark.bmp
!define MUI_HEADERIMAGE !define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_RIGHT !define MUI_HEADERIMAGE_RIGHT
!define MUI_WELCOMEFINISHPAGE_BITMAP wizWatermark.bmp
; Use a right to left header image when the language is right to left ; Use a right to left header image when the language is right to left
!ifdef ${AB_CD}_rtl !ifdef ${AB_CD}_rtl
@ -154,21 +144,22 @@ ReserveFile shortcuts.ini
!insertmacro MUI_PAGE_LICENSE license.txt !insertmacro MUI_PAGE_LICENSE license.txt
; Custom Options Page ; Custom Options Page
Page custom preOptions ChangeOptions Page custom preOptions leaveOptions
; Select Install Components Page ; Custom Components Page
!define MUI_PAGE_CUSTOMFUNCTION_PRE preComponents Page custom preComponents leaveComponents
!insertmacro MUI_PAGE_COMPONENTS
; Select Install Directory Page ; Select Install Directory Page
!define MUI_PAGE_CUSTOMFUNCTION_PRE CheckCustom !define MUI_PAGE_CUSTOMFUNCTION_PRE preDirectory
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE leaveDirectory
!define MUI_DIRECTORYPAGE_VERIFYONLEAVE
!insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_DIRECTORY
; Custom Shortcuts Page - CheckCustom is Called in Shortcuts ; Custom Shortcuts Page
Page custom preShortcuts ChangeShortcuts Page custom preShortcuts leaveShortcuts
; Start Menu Folder Page Configuration ; Start Menu Folder Page Configuration
!define MUI_PAGE_CUSTOMFUNCTION_PRE preCheckStartMenu !define MUI_PAGE_CUSTOMFUNCTION_PRE preStartMenu
!define MUI_STARTMENUPAGE_NODISABLE !define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Mozilla\${BrandFullNameInternal}\${AppVersion} (${AB_CD})\Main" !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Mozilla\${BrandFullNameInternal}\${AppVersion} (${AB_CD})\Main"
@ -176,7 +167,7 @@ Page custom preShortcuts ChangeShortcuts
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuDir !insertmacro MUI_PAGE_STARTMENU Application $StartMenuDir
; Install Files Page ; Install Files Page
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE FinishInstall !define MUI_PAGE_CUSTOMFUNCTION_LEAVE leaveInstFiles
!insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_INSTFILES
; Finish Page ; Finish Page
@ -185,45 +176,19 @@ Page custom preShortcuts ChangeShortcuts
!define MUI_FINISHPAGE_RUN !define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION LaunchApp !define MUI_FINISHPAGE_RUN_FUNCTION LaunchApp
!define MUI_FINISHPAGE_RUN_TEXT $(LAUNCH_TEXT) !define MUI_FINISHPAGE_RUN_TEXT $(LAUNCH_TEXT)
!define MUI_PAGE_CUSTOMFUNCTION_PRE disableCancel !define MUI_PAGE_CUSTOMFUNCTION_PRE preFinish
!insertmacro MUI_PAGE_FINISH !insertmacro MUI_PAGE_FINISH
/** ################################################################################
* Uninstall Pages # Install Sections
*/
; Welcome Page
!insertmacro MUI_UNPAGE_WELCOME
; Uninstall Confirm Page Section "-Application" Section1
!insertmacro MUI_UNPAGE_CONFIRM SectionIn 1 RO
SetDetailsPrint textonly
DetailPrint $(STATUS_CLEANUP)
SetDetailsPrint none
SetOutPath $INSTDIR
; Remove Files Page
!define MUI_PAGE_CUSTOMFUNCTION_PRE un.checkIfAppIsLoaded
!insertmacro MUI_UNPAGE_INSTFILES
; Finish Page
!define MUI_PAGE_CUSTOMFUNCTION_PRE un.disableCancel
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_FINISHPAGE_SHOWREADME ""
; Setup the survey controls, functions, etc. except when the application has
; defined NO_UNINSTALL_SURVEY
!ifndef NO_UNINSTALL_SURVEY
!define MUI_FINISHPAGE_SHOWREADME_TEXT $(SURVEY_TEXT)
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION un.survey
!endif
!insertmacro MUI_UNPAGE_FINISH\
/**
* Adds a section divider to the human readable log.
*/
Function WriteLogSeparator
FileWrite $fhInstallLog "$\r$\n-------------------------------------------------------------------------------$\r$\n"
FunctionEnd
; Callback used to check if the app being uninstalled is running.
Function un.checkIfAppIsLoaded
; Try to delete the app executable and if we can't delete it try to close the ; Try to delete the app executable and if we can't delete it try to close the
; app. This allows running an instance that is located in another directory. ; app. This allows running an instance that is located in another directory.
ClearErrors ClearErrors
@ -232,114 +197,13 @@ Function un.checkIfAppIsLoaded
${EndIf} ${EndIf}
${If} ${Errors} ${If} ${Errors}
ClearErrors ClearErrors
${un.CloseApp} "true" $(WARN_APP_RUNNING_UNINSTALL) ${CloseApp} "true" $(WARN_APP_RUNNING_INSTALL)
; Try to delete it again to prevent launching the app while we are ; Try to delete it again to prevent launching the app while we are
; installing. ; installing.
${DeleteFile} "$INSTDIR\${FileMainEXE}" ${DeleteFile} "$INSTDIR\${FileMainEXE}"
ClearErrors ClearErrors
${EndIf} ${EndIf}
FunctionEnd
; Setup the survey controls, functions, etc. except when the application has
; defined NO_UNINSTALL_SURVEY
!ifndef NO_UNINSTALL_SURVEY
Function un.survey
ExecShell "open" "${SurveyURL}"
FunctionEnd
!endif
; Check whether to display the current page (e.g. if we aren't performing a
; custom install don't display the custom pages).
Function CheckCustom
${If} $InstallType != 4
Abort
${EndIf}
FunctionEnd
Function preCheckStartMenu
Call CheckCustom
${If} $AddStartMenuSC != 1
Abort
${EndIf}
FunctionEnd
Function onInstallDeleteFile
${TrimNewLines} "$R9" "$R9"
StrCpy $R1 "$R9" 5
${If} $R1 == "File:"
StrCpy $R9 "$R9" "" 6
${If} ${FileExists} "$INSTDIR$R9"
ClearErrors
Delete "$INSTDIR$R9"
${If} ${Errors}
${LogMsg} "** ERROR Deleting File: $INSTDIR$R9 **"
${Else}
${LogMsg} "Deleted File: $INSTDIR$R9"
${EndIf}
${EndIf}
${EndIf}
ClearErrors
Push 0
FunctionEnd
; The previous installer removed directories even when they aren't empty so this
; funtion does as well.
Function onInstallRemoveDir
${TrimNewLines} "$R9" "$R9"
StrCpy $R1 "$R9" 4
${If} $R1 == "Dir:"
StrCpy $R9 "$R9" "" 5
StrCpy $R1 "$R9" "" -1
${If} $R1 == "\"
StrCpy $R9 "$R9" -1
${EndIf}
${If} ${FileExists} "$INSTDIR$R9"
ClearErrors
RmDir /r "$INSTDIR$R9"
${If} ${Errors}
${LogMsg} "** ERROR Removing Directory: $INSTDIR$R9 **"
${Else}
${LogMsg} "Removed Directory: $INSTDIR$R9"
${EndIf}
${EndIf}
${EndIf}
ClearErrors
Push 0
FunctionEnd
Function FinishInstall
FileClose $fhUninstallLog
; Diff and add missing entries from the previous file log if it exists
${If} ${FileExists} "$INSTDIR\uninstall\uninstall.bak"
SetDetailsPrint textonly
DetailPrint $(STATUS_CLEANUP)
SetDetailsPrint none
${LogHeader} "Updating Uninstall Log With Previous Uninstall Log"
StrCpy $R0 "$INSTDIR\uninstall\uninstall.log"
StrCpy $R1 "$INSTDIR\uninstall\uninstall.bak"
GetTempFileName $R2
FileOpen $R3 $R2 w
${TextCompareNoDetails} "$R1" "$R0" "SlowDiff" "GetDiff"
FileClose $R3
${Unless} ${Errors}
${FileJoin} "$INSTDIR\uninstall\uninstall.log" "$R2" "$INSTDIR\uninstall\uninstall.log"
${EndUnless}
${DeleteFile} "$INSTDIR\uninstall\uninstall.bak"
${DeleteFile} "$R2"
${EndIf}
Call WriteLogSeparator
${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6
FileWrite $fhInstallLog "${BrandFullName} Installation Finished: $2-$1-$0 $4:$5:$6$\r$\n"
FileClose $fhInstallLog
FunctionEnd
Section "-Application" Section1
SectionIn 1 RO
SetDetailsPrint textonly
DetailPrint $(STATUS_CLEANUP)
SetDetailsPrint none
SetOutPath $INSTDIR
; For a "Standard" upgrade without talkback installed add the InstallDisabled ; For a "Standard" upgrade without talkback installed add the InstallDisabled
; file to the talkback source files so it will be disabled by the extension ; file to the talkback source files so it will be disabled by the extension
; manager. This is done at the start of the installation since we check for ; manager. This is done at the start of the installation since we check for
@ -356,21 +220,22 @@ Section "-Application" Section1
FileWrite $2 "$\r$\n" FileWrite $2 "$\r$\n"
FileClose $2 FileClose $2
${EndUnless} ${EndUnless}
${EndIf} ${Else}
; Custom installs.
; Try to delete the app executable and if we can't delete it try to close the ; If DOMi is installed and this install includes DOMi remove it from
; app. This allows running an instance that is located in another directory. ; the installation directory. This will remove it if the user deselected
ClearErrors ; DOMi on the components page.
${If} ${FileExists} "$INSTDIR\${FileMainEXE}" ${If} ${FileExists} "$INSTDIR\extensions\inspector@mozilla.org"
${DeleteFile} "$INSTDIR\${FileMainEXE}" ${AndIf} ${FileExists} "$EXEDIR\optional\extensions\inspector@mozilla.org"
${EndIf} RmDir /r "$INSTDIR\extensions\inspector@mozilla.org"
${If} ${Errors} ${EndIf}
ClearErrors ; If TalkBack is installed and this install includes TalkBack remove it from
${CloseApp} "true" $(WARN_APP_RUNNING_INSTALL) ; the installation directory. This will remove it if the user deselected
; Try to delete it again to prevent launching the app while we are ; TalkBack on the components page.
; installing. ${If} ${FileExists} "$INSTDIR\extensions\talkback@mozilla.org"
${DeleteFile} "$INSTDIR\${FileMainEXE}" ${AndIf} ${FileExists} "$EXEDIR\optional\extensions\talkback@mozilla.org"
ClearErrors RmDir /r "$INSTDIR\extensions\talkback@mozilla.org"
${EndIf}
${EndIf} ${EndIf}
Call CleanupOldLogs Call CleanupOldLogs
@ -465,9 +330,9 @@ Section "-Application" Section1
Call DoCopyFiles Call DoCopyFiles
${If} $InstallType != 4 ${If} $InstallType != 4
Call install_talkback Call installTalkback
${If} ${FileExists} "$INSTDIR\extensions\inspector@mozilla.org" ${If} ${FileExists} "$INSTDIR\extensions\inspector@mozilla.org"
Call install_inspector Call installInspector
${EndIf} ${EndIf}
${EndIf} ${EndIf}
@ -547,57 +412,8 @@ Section "-Application" Section1
${WriteRegStr2} $TmpVal "$0" "" "${GREVersion}" 0 ${WriteRegStr2} $TmpVal "$0" "" "${GREVersion}" 0
${WriteRegStr2} $TmpVal "$0" "CurrentVersion" "${AppVersion} (${AB_CD})" 0 ${WriteRegStr2} $TmpVal "$0" "CurrentVersion" "${AppVersion} (${AB_CD})" 0
; XXXrstrong - there are several values that will be overwritten by and ; XXXrstrong - Add registry values for HKLM\Software\Clients\Calendar here.
; overwrite other installs of the same application. ; See Thunderbird's installer.nsi for an example.
; XXXrstrong - the Calendar registry key unlike the one for StartMenuInternet
; can be the full brand name and version but software update could change this
; value and the uninstaller wouldn't find it then. To fix this the uninstaller
; would need to enumerate the keys under Calendar, find any keys that point to
; this install location, and remove that key on uninstall. This is also needed
; to support side by side installs of different versions.
; ${StrFilter} "${FileMainEXE}" "+" "" "" $R9
; StrCpy $0 "Software\Clients\Calendar\$R9"
; ${WriteRegStr2} $TmpVal "$0" "" "${BrandFullName}" 0
; StrCpy $0 "Software\Clients\Calendar\$R9"
; ${WriteRegStr2} $TmpVal "$0" "" "${BrandFullName}" 0
; StrCpy $0 "Software\Clients\Calendar\$R9\Protocols\.ics"
; ${WriteRegStr2} $TmpVal "$0" "" "icsfile" 0
; ${WriteRegStr2} $TmpVal "$0" "Content Type" "text/calendar" 0
; StrCpy $0 "Software\Clients\Calendar\$R9\Protocols\.vcs"
; ${WriteRegStr2} $TmpVal "$0" "" "vcsfile" 0
; XXXrstrong - iCalendar File needs localization?
; StrCpy $0 "Software\Clients\Calendar\$R9\Protocols\icsfile"
; ${WriteRegStr2} $TmpVal "$0" "" "iCalendar File" 0
; ${WriteRegDWORD2} $TmpVal "$0" "EditFlags" 0 0
; XXXrstrong - no default icon for icsfile?
; StrCpy $0 "Software\Clients\Calendar\$R9\Protocols\icsfile\DefaultIcon"
; ${WriteRegStr2} $TmpVal "$0" "" "path to default icon,0" 0
; XXXrstrong - does Sunbird have a command line handler for opening files?
; StrCpy $0 "Software\Clients\Calendar\$R9\Protocols\icsfile\shell\open\command"
; ${WriteRegStr2} $TmpVal "$0" "" "$INSTDIR\${FileMainEXE}" 0
; XXXrstrong - vCalendar File needs localization?
; StrCpy $0 "Software\Clients\Calendar\$R9\Protocols\vcsfile"
; ${WriteRegStr2} $TmpVal "$0" "" "vCalendar File" 0
; ${WriteRegDWORD2} $TmpVal "$0" "EditFlags" 0 0
; XXXrstrong - no default icon for vcsfile?
; StrCpy $0 "Software\Clients\Calendar\$R9\Protocols\vcsfile\DefaultIcon"
; ${WriteRegStr2} $TmpVal "$0" "" "path to default icon,0" 0
; XXXrstrong - does Sunbird have a command line handler for opening files?
; StrCpy $0 "Software\Clients\Calendar\$R9\Protocols\vcsfile\shell\open\command"
; ${WriteRegStr2} $TmpVal "$0" "" "$INSTDIR\${FileMainEXE}" 0
; StrCpy $0 "Software\Clients\Calendar\$R9\shell\open\command"
; ${WriteRegStr2} $TmpVal "$0" "" "$INSTDIR\${FileMainEXE}" 0
; These need special handling on uninstall since they may be overwritten by ; These need special handling on uninstall since they may be overwritten by
; an install into a different location. ; an install into a different location.
@ -607,7 +423,7 @@ Section "-Application" Section1
; Write the uninstall registry keys ; Write the uninstall registry keys
StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} (${AppVersion})" StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} (${AppVersion})"
StrCpy $1 "$\"$INSTDIR\uninstall\uninstaller.exe$\" $\"/ua ${AppVersion} (${AB_CD})$\"" StrCpy $1 "$INSTDIR\uninstall\uninst.exe"
${WriteRegStr2} $TmpVal "$0" "Comments" "${BrandFullNameInternal}" 0 ${WriteRegStr2} $TmpVal "$0" "Comments" "${BrandFullNameInternal}" 0
${WriteRegStr2} $TmpVal "$0" "DisplayIcon" "$INSTDIR\${FileMainEXE},0" 0 ${WriteRegStr2} $TmpVal "$0" "DisplayIcon" "$INSTDIR\${FileMainEXE},0" 0
@ -646,27 +462,27 @@ Section "-Application" Section1
!insertmacro MUI_STARTMENU_WRITE_END !insertmacro MUI_STARTMENU_WRITE_END
; Refresh destop icons ; Refresh desktop icons
System::Call "shell32::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)" System::Call "shell32::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)"
WriteUninstaller "$INSTDIR\uninstall\uninstaller.exe"
SectionEnd SectionEnd
Section /o "Developer Tools" Section2 Section /o "Developer Tools" Section2
Call install_inspector Call installInspector
SectionEnd SectionEnd
Section /o "Quality Feedback Agent" Section3 Section /o "Quality Feedback Agent" Section3
Call install_talkback Call installTalkback
SectionEnd SectionEnd
Function install_inspector ################################################################################
# Helper Functions
Function installInspector
${If} ${FileExists} "$EXEDIR\optional\extensions\inspector@mozilla.org" ${If} ${FileExists} "$EXEDIR\optional\extensions\inspector@mozilla.org"
SetDetailsPrint textonly SetDetailsPrint textonly
DetailPrint $(STATUS_INSTALL_OPTIONAL) DetailPrint $(STATUS_INSTALL_OPTIONAL)
SetDetailsPrint none SetDetailsPrint none
${RemoveDir} "$INSTDIR\extensions\extensions\inspector@mozilla.org" ${RemoveDir} "$INSTDIR\extensions\inspector@mozilla.org"
ClearErrors ClearErrors
${LogHeader} "Installing Developer Tools" ${LogHeader} "Installing Developer Tools"
StrCpy $R0 "$EXEDIR\optional\extensions\inspector@mozilla.org" StrCpy $R0 "$EXEDIR\optional\extensions\inspector@mozilla.org"
@ -675,7 +491,7 @@ Function install_inspector
${EndIf} ${EndIf}
FunctionEnd FunctionEnd
Function install_talkback Function installTalkback
StrCpy $R0 "$EXEDIR\optional\extensions\talkback@mozilla.org" StrCpy $R0 "$EXEDIR\optional\extensions\talkback@mozilla.org"
${If} ${FileExists} "$R0" ${If} ${FileExists} "$R0"
SetDetailsPrint textonly SetDetailsPrint textonly
@ -712,135 +528,61 @@ Function install_talkback
${EndIf} ${EndIf}
FunctionEnd FunctionEnd
Section "Uninstall" ; Adds a section divider to the human readable log.
SetDetailsPrint textonly Function WriteLogSeparator
DetailPrint $(STATUS_UNINSTALL_MAIN) FileWrite $fhInstallLog "$\r$\n-------------------------------------------------------------------------------$\r$\n"
SetDetailsPrint none
; Remove registry entries for non-existent apps and for apps that point to our
; install location in the Software\Mozilla key.
SetShellVarContext current ; Sets SHCTX to HKCU
${un.RegCleanMain} "Software\Mozilla"
SetShellVarContext all ; Sets SHCTX to HKLM
${un.RegCleanMain} "Software\Mozilla"
; Remove uninstall entries that point to our install location
${un.RegCleanUninstall}
SetShellVarContext all ; Set SHCTX to HKLM
${un.GetSecondInstallPath} "Software\Mozilla" $R9
${If} $R9 == "false"
SetShellVarContext current ; Set SHCTX to HKCU
${un.GetSecondInstallPath} "Software\Mozilla" $R9
${EndIf}
; XXXrstrong - the Calendar registry key unlike the one for StartMenuInternet
; can be the full brand name and version but software update could change this
; value and the uninstaller wouldn't find it then. To fix this the uninstaller
; would need to enumerate the keys under Calendar, find any keys that point to
; this install location, and remove that key on uninstall. This is also needed
; to support side by side installs of different versions.
; StrCpy $0 "Software\Clients\Calendar\${FileMainEXE}\shell\open\command"
; ReadRegStr $1 HKLM "$0" ""
; Push $1
; ${GetPathFromRegStr}
; Pop $R0
; Push $R0
; ${GetParentDir}
; Pop $R1
; Only remove the registry key under Clients if it refers to this install
; location. The Clients registry key is independent of the default application
; settings. The XPInstall base un-installer always removes this key if it is
; uninstalling the default app and it will always replace the keys when
; installing even if there is another install of the app that is set as the
; default app. Now the key is always updated on install but it is only
; removed if it refers to this install location.
; ${If} $INSTDIR == $R1
; XXXrstrong - if there is another installation of the same app ideally we
; would just modify these values. The GetSecondInstallPath macro could be
; made to provide enough information to do this.
; DeleteRegKey HKLM "Software\Clients\Calendar\${FileMainEXE}"
; ${EndIf}
StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\App Paths\${FileMainEXE}"
${If} $R9 == "false"
DeleteRegKey HKLM "$0"
DeleteRegKey HKCU "$0"
${Else}
ReadRegStr $1 HKLM "$0" ""
Push $1
${GetPathFromRegStr}
Pop $R0
Push $R0
${GetParentDir}
Pop $R1
${If} $INSTDIR == $R1
WriteRegStr HKLM "$0" "" "$R9"
Push $R9
${GetParentDir}
Pop $R1
WriteRegStr HKLM "$0" "Path" "$R1"
${EndIf}
${EndIf}
; Remove files. If we don't have a log file skip
${If} ${FileExists} "$INSTDIR\uninstall\uninstall.log"
; Copy the uninstall log file to a temporary file
GetTempFileName $TmpVal
CopyFiles "$INSTDIR\uninstall\uninstall.log" "$TmpVal"
; Unregister DLL's
${un.LineFind} "$TmpVal" "/NUL" "1:-1" "un.UnRegDLLsCallback"
; Delete files
${un.LineFind} "$TmpVal" "/NUL" "1:-1" "un.RemoveFilesCallback"
; Remove directories we always control
RmDir /r "$INSTDIR\uninstall"
RmDir /r "$INSTDIR\updates"
RmDir /r "$INSTDIR\defaults\shortcuts"
; Remove empty directories
${un.LineFind} "$TmpVal" "/NUL" "1:-1" "un.RemoveDirsCallback"
; Delete the temporary uninstall log file
${DeleteFile} "$TmpVal"
; Remove the installation directory if it is empty
${RemoveDir} "$INSTDIR"
${EndIf}
; Refresh destop icons otherwise the start menu internet item won't be removed
; and other ugly things will happen like recreation of the registry key by the
; OS under some conditions.
System::Call "shell32::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)"
SectionEnd
; When we add an optional action to the finish page the cancel button is
; enabled. The next two function disable it for install and uninstall and leave
; the finish button as the only choice.
Function disableCancel
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "cancelenabled" "0"
FunctionEnd FunctionEnd
Function un.disableCancel ; Check whether to display the current page (e.g. if we aren't performing a
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "cancelenabled" "0" ; custom install don't display the custom pages).
Function CheckCustom
; Setup the survey controls, functions, etc. except when the application has ${If} $InstallType != 4
; defined NO_UNINSTALL_SURVEY
!ifdef NO_UNINSTALL_SURVEY
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "NumFields" "3"
!endif
FunctionEnd
Function ChangeShortcuts
${MUI_INSTALLOPTIONS_READ} $0 "shortcuts.ini" "Settings" "State"
${If} $0 != 0
Abort Abort
${EndIf} ${EndIf}
${MUI_INSTALLOPTIONS_READ} $AddDesktopSC "shortcuts.ini" "Field 2" "State" FunctionEnd
${MUI_INSTALLOPTIONS_READ} $AddStartMenuSC "shortcuts.ini" "Field 3" "State"
${MUI_INSTALLOPTIONS_READ} $AddQuickLaunchSC "shortcuts.ini" "Field 4" "State" Function onInstallDeleteFile
${TrimNewLines} "$R9" "$R9"
StrCpy $R1 "$R9" 5
${If} $R1 == "File:"
StrCpy $R9 "$R9" "" 6
${If} ${FileExists} "$INSTDIR$R9"
ClearErrors
Delete "$INSTDIR$R9"
${If} ${Errors}
${LogMsg} "** ERROR Deleting File: $INSTDIR$R9 **"
${Else}
${LogMsg} "Deleted File: $INSTDIR$R9"
${EndIf}
${EndIf}
${EndIf}
ClearErrors
Push 0
FunctionEnd
; The previous installer removed directories even when they aren't empty so this
; function does as well.
Function onInstallRemoveDir
${TrimNewLines} "$R9" "$R9"
StrCpy $R1 "$R9" 4
${If} $R1 == "Dir:"
StrCpy $R9 "$R9" "" 5
StrCpy $R1 "$R9" "" -1
${If} $R1 == "\"
StrCpy $R9 "$R9" -1
${EndIf}
${If} ${FileExists} "$INSTDIR$R9"
ClearErrors
RmDir /r "$INSTDIR$R9"
${If} ${Errors}
${LogMsg} "** ERROR Removing Directory: $INSTDIR$R9 **"
${Else}
${LogMsg} "Removed Directory: $INSTDIR$R9"
${EndIf}
${EndIf}
${EndIf}
ClearErrors
Push 0
FunctionEnd FunctionEnd
Function GetDiff Function GetDiff
@ -893,119 +635,13 @@ Function CopyFile
; If the file is installed into the installation directory remove the ; If the file is installed into the installation directory remove the
; installation directory's path from the file path when writing to the ; installation directory's path from the file path when writing to the
; uninstall.log so it will be a relative path. This allows the same ; uninstall.log so it will be a relative path. This allows the same
; uninstaller.exe to be used with zip builds if we supply an uninstall.log. ; uninst.exe to be used with zip builds if we supply an uninstall.log.
${WordReplace} "$R1$R3\$R7" "$INSTDIR" "" "+" $R3 ${WordReplace} "$R1$R3\$R7" "$INSTDIR" "" "+" $R3
${LogUninstall} "File: $R3" ${LogUninstall} "File: $R3"
${EndIf} ${EndIf}
Push 0 Push 0
FunctionEnd FunctionEnd
Function un.RemoveFilesCallback
${un.TrimNewLines} "$R9" "$R9"
StrCpy $R1 "$R9" 5
${If} $R1 == "File:"
StrCpy $R9 "$R9" "" 6
StrCpy $R0 "$R9" 1
; If the path is relative prepend the install directory
${If} $R0 == "\"
StrCpy $R0 "$INSTDIR$R9"
${Else}
StrCpy $R0 "$R9"
${EndIf}
${If} ${FileExists} "$R0"
${DeleteFile} "$R0"
${EndIf}
${EndIf}
ClearErrors
Push 0
FunctionEnd
; Using locate will leave file handles open to some of the directories which
; will prevent the deletion of these directories. This parses the uninstall.log
; and uses the file entries to find / remove empty directories.
Function un.RemoveDirsCallback
${un.TrimNewLines} "$R9" "$R9"
StrCpy $R1 "$R9" 5
${If} $R1 == "File:"
StrCpy $R9 "$R9" "" 6
StrCpy $R1 "$R9" 1
${If} $R1 == "\"
StrCpy $R2 "INSTDIR"
StrCpy $R1 "$INSTDIR$R9"
${Else}
StrCpy $R2 " "
StrCpy $R1 "$R9"
${EndIf}
loop:
Push $R1
Call un.GetParentDir
Pop $R0
GetFullPathName $R1 "$R0"
; We only try to remove empty directories but the Desktop, StartMenu, and
; QuickLaunch directories can be empty so guard against removing them.
SetShellVarContext all
${If} $R1 == "$DESKTOP"
${OrIf} $R1 == "$STARTMENU"
GoTo end
${EndIf}
SetShellVarContext current
${If} $R1 == "$QUICKLAUNCH"
${OrIf} $R1 == "$DESKTOP"
${OrIf} $R1 == "$STARTMENU"
GoTo end
${EndIf}
${If} ${FileExists} "$R1"
RmDir "$R1"
${EndIf}
${If} ${Errors}
${OrIf} $R1 != "$INSTDIR"
GoTo end
${EndIf}
GoTo loop
${EndIf}
end:
ClearErrors
Push 0
FunctionEnd
Function un.UnRegDLLsCallback
${un.TrimNewLines} "$R9" "$R9"
StrCpy $R1 "$R9" 7
${If} $R1 == "DLLReg:"
StrCpy $R9 "$R9" "" 8
StrCpy $R1 "$R9" 1
${If} $R1 == "\"
StrCpy $R1 "$INSTDIR$R9"
${Else}
StrCpy $R1 "$R9"
${EndIf}
UnRegDLL $R1
${EndIf}
ClearErrors
Push 0
FunctionEnd
Function un.GetParentDir
Exch $R0 ; old $R0 is on top of stack
Push $R1
Push $R2
Push $R3
StrLen $R3 $R0
loop:
IntOp $R1 $R1 - 1
IntCmp $R1 -$R3 exit exit
StrCpy $R2 $R0 1 $R1
StrCmp $R2 "\" exit
Goto loop
exit:
StrCpy $R0 $R0 $R1
Pop $R3
Pop $R2
Pop $R1
Exch $R0 ; put $R0 on top of stack, restore $R0 to original value
FunctionEnd
; Clean up the old log files. We only diff the first two found since it is ; Clean up the old log files. We only diff the first two found since it is
; possible for there to be several MB and comparing that many would take a very ; possible for there to be several MB and comparing that many would take a very
; long time to diff. ; long time to diff.
@ -1085,11 +721,13 @@ Function CleanOldLogFilesCallback
Push 0 Push 0
FunctionEnd FunctionEnd
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN Function LaunchApp
!insertmacro MUI_DESCRIPTION_TEXT ${Section1} $(APP_DESC) ${CloseApp} "true" $(WARN_APP_RUNNING_INSTALL)
!insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(DEV_TOOLS_DESC) Exec "$INSTDIR\${FileMainEXE}"
!insertmacro MUI_DESCRIPTION_TEXT ${Section3} $(QFA_DESC) FunctionEnd
!insertmacro MUI_FUNCTION_DESCRIPTION_END
################################################################################
# Language
!insertmacro MOZ_MUI_LANGUAGE 'baseLocale' !insertmacro MOZ_MUI_LANGUAGE 'baseLocale'
!verbose push !verbose push
@ -1102,18 +740,15 @@ FunctionEnd
; using " " for BrandingText will hide the "Nullsoft Install System..." branding ; using " " for BrandingText will hide the "Nullsoft Install System..." branding
BrandingText " " BrandingText " "
Function preShortcuts ################################################################################
Call CheckCustom # Page pre and leave functions
!insertmacro MUI_HEADER_TEXT "$(SHORTCUTS_PAGE_TITLE)" "$(SHORTCUTS_PAGE_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "shortcuts.ini"
FunctionEnd
Function preOptions Function preOptions
!insertmacro MUI_HEADER_TEXT "$(OPTIONS_PAGE_TITLE)" "$(OPTIONS_PAGE_SUBTITLE)" !insertmacro MUI_HEADER_TEXT "$(OPTIONS_PAGE_TITLE)" "$(OPTIONS_PAGE_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "options.ini" !insertmacro MUI_INSTALLOPTIONS_DISPLAY "options.ini"
FunctionEnd FunctionEnd
Function ChangeOptions Function leaveOptions
${MUI_INSTALLOPTIONS_READ} $0 "options.ini" "Settings" "State" ${MUI_INSTALLOPTIONS_READ} $0 "options.ini" "Settings" "State"
${If} $0 != 0 ${If} $0 != 0
Abort Abort
@ -1128,7 +763,7 @@ FunctionEnd
Function preComponents Function preComponents
Call CheckCustom Call CheckCustom
; If DOMi isn't available skip the options page ; If DOMi isn't available skip the components page
${Unless} ${FileExists} "$EXEDIR\optional\extensions\inspector@mozilla.org" ${Unless} ${FileExists} "$EXEDIR\optional\extensions\inspector@mozilla.org"
; If talkback exists always install it enabled. ; If talkback exists always install it enabled.
${If} ${FileExists} "$EXEDIR\optional\extensions\talkback@mozilla.org" ${If} ${FileExists} "$EXEDIR\optional\extensions\talkback@mozilla.org"
@ -1136,17 +771,124 @@ Function preComponents
${EndIf} ${EndIf}
Abort Abort
${EndUnless} ${EndUnless}
!insertmacro MUI_HEADER_TEXT "$(OPTIONAL_COMPONENTS_TITLE)" "$(OPTIONAL_COMPONENTS_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "components.ini"
FunctionEnd FunctionEnd
Function LaunchApp Function leaveComponents
${CloseApp} "true" $(WARN_APP_RUNNING_INSTALL) ; If DOMi exists then it will be Field 2.
Exec "$INSTDIR\${FileMainEXE}" ; If DOMi doesn't exist and talkback exists then TalkBack will be Field 2 but
; if DOMi doesn't exist we won't display this page anyways.
StrCpy $R1 2
${If} ${FileExists} "$EXEDIR\optional\extensions\inspector@mozilla.org"
${MUI_INSTALLOPTIONS_READ} $R0 "components.ini" "Field $R1" "State"
; State will be 1 for checked and 0 for unchecked so we can use that to set
; the section flags for installation.
SectionSetFlags 1 $R0
IntOp $R1 $R1 + 1
${Else}
SectionSetFlags 1 0 ; Disable install for DOMi
${EndIf}
${If} ${FileExists} "$EXEDIR\optional\extensions\talkback@mozilla.org"
${MUI_INSTALLOPTIONS_READ} $R0 "components.ini" "Field $R1" "State"
; State will be 1 for checked and 0 for unchecked so we can use that to set
; the section flags for installation.
SectionSetFlags 2 $R0
${Else}
SectionSetFlags 2 0 ; Disable install for TalkBack
${EndIf}
FunctionEnd FunctionEnd
Function preDirectory
${If} $InstallType != 4
${CheckDiskSpace} $R9
${If} $R9 != "false"
${CanWriteToInstallDir} $R9
${If} $R9 != "false"
Abort
${EndIf}
${EndIf}
${EndIf}
FunctionEnd
Function leaveDirectory
${CheckDiskSpace} $R9
${If} $R9 == "false"
MessageBox MB_OK "$(WARN_DISK_SPACE)"
Abort
${EndIf}
${CanWriteToInstallDir} $R9
${If} $R9 == "false"
MessageBox MB_OK "$(WARN_WRITE_ACCESS)"
Abort
${EndIf}
FunctionEnd
Function preShortcuts
Call CheckCustom
!insertmacro MUI_HEADER_TEXT "$(SHORTCUTS_PAGE_TITLE)" "$(SHORTCUTS_PAGE_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "shortcuts.ini"
FunctionEnd
Function leaveShortcuts
${MUI_INSTALLOPTIONS_READ} $0 "shortcuts.ini" "Settings" "State"
${If} $0 != 0
Abort
${EndIf}
${MUI_INSTALLOPTIONS_READ} $AddDesktopSC "shortcuts.ini" "Field 2" "State"
${MUI_INSTALLOPTIONS_READ} $AddStartMenuSC "shortcuts.ini" "Field 3" "State"
${MUI_INSTALLOPTIONS_READ} $AddQuickLaunchSC "shortcuts.ini" "Field 4" "State"
FunctionEnd
Function preStartMenu
Call CheckCustom
${If} $AddStartMenuSC != 1
Abort
${EndIf}
FunctionEnd
Function leaveInstFiles
FileClose $fhUninstallLog
; Diff and add missing entries from the previous file log if it exists
${If} ${FileExists} "$INSTDIR\uninstall\uninstall.bak"
SetDetailsPrint textonly
DetailPrint $(STATUS_CLEANUP)
SetDetailsPrint none
${LogHeader} "Updating Uninstall Log With Previous Uninstall Log"
StrCpy $R0 "$INSTDIR\uninstall\uninstall.log"
StrCpy $R1 "$INSTDIR\uninstall\uninstall.bak"
GetTempFileName $R2
FileOpen $R3 $R2 w
${TextCompareNoDetails} "$R1" "$R0" "SlowDiff" "GetDiff"
FileClose $R3
${Unless} ${Errors}
${FileJoin} "$INSTDIR\uninstall\uninstall.log" "$R2" "$INSTDIR\uninstall\uninstall.log"
${EndUnless}
${DeleteFile} "$INSTDIR\uninstall\uninstall.bak"
${DeleteFile} "$R2"
${EndIf}
Call WriteLogSeparator
${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6
FileWrite $fhInstallLog "${BrandFullName} Installation Finished: $2-$1-$0 $4:$5:$6$\r$\n"
FileClose $fhInstallLog
FunctionEnd
; When we add an optional action to the finish page the cancel button is
; enabled. This disables it and leaves the finish button as the only choice.
Function preFinish
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "cancelenabled" "0"
FunctionEnd
################################################################################
# Initialization Functions
Function .onInit Function .onInit
${GetParameters} $R0 ${GetParameters} $R0
${If} $R0 != "" ${If} $R0 != ""
; Command line argument found ClearErrors
${GetOptions} "$R0" "-ms" $R1 ${GetOptions} "$R0" "-ms" $R1
${If} ${Errors} ${If} ${Errors}
; Default install type ; Default install type
@ -1251,9 +993,11 @@ Function .onInit
StrCpy $LANGUAGE 0 StrCpy $LANGUAGE 0
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "options.ini" !insertmacro MUI_INSTALLOPTIONS_EXTRACT "options.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "components.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "shortcuts.ini" !insertmacro MUI_INSTALLOPTIONS_EXTRACT "shortcuts.ini"
!insertmacro createShortcutsINI
!insertmacro createBasicCustomOptionsINI !insertmacro createBasicCustomOptionsINI
!insertmacro createComponentsINI
!insertmacro createShortcutsINI
; There must always be nonlocalized and localized directories. ; There must always be nonlocalized and localized directories.
${GetSize} "$EXEDIR\nonlocalized\" "/S=0K" $1 $8 $9 ${GetSize} "$EXEDIR\nonlocalized\" "/S=0K" $1 $8 $9
@ -1279,10 +1023,3 @@ Function .onInit
SectionSetText 2 "" SectionSetText 2 ""
${EndIf} ${EndIf}
FunctionEnd FunctionEnd
Function un.onInit
GetFullPathName $INSTDIR "$INSTDIR\.."
StrCpy $LANGUAGE 0
; XXXrstrong - should we quit when the app exe is not present?
FunctionEnd

Просмотреть файл

@ -0,0 +1,399 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the Mozilla Installer code.
#
# The Initial Developer of the Original Code is Mozilla Foundation
# Portions created by the Initial Developer are Copyright (C) 2006
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Robert Strong <robert.bugzilla@gmail.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
# Also requires:
# ShellLink plugin http://nsis.sourceforge.net/ShellLink_plug-in
; Set verbosity to 3 (e.g. no script) to lessen the noise in the build logs
!verbose 3
; 7-Zip provides better compression than the lzma from NSIS so we add the files
; uncompressed and use 7-Zip to create a SFX archive of it
SetDatablockOptimize on
SetCompress off
CRCCheck on
!addplugindir ./
Var TmpVal
; Other included files may depend upon these includes!
; The following includes are provided by NSIS.
!include FileFunc.nsh
!include LogicLib.nsh
!include TextFunc.nsh
!include WinMessages.nsh
!include WordFunc.nsh
!include MUI.nsh
!insertmacro GetParameters
!insertmacro un.LineFind
!insertmacro un.TrimNewLines
; The following includes are custom.
!include branding.nsi
!include defines.nsi
!include common.nsh
!include locales.nsi
!include version.nsh
!insertmacro un.RegCleanMain
!insertmacro un.RegCleanUninstall
!insertmacro un.CloseApp
!insertmacro un.GetSecondInstallPath
Name "${BrandFullName}"
OutFile "uninst.exe"
InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} (${AppVersion})" "InstallLocation"
InstallDir "$PROGRAMFILES\${BrandFullName}"
ShowUnInstDetails nevershow
################################################################################
# Modern User Interface - MUI
!define MUI_ABORTWARNING
!define MUI_ICON setup.ico
!define MUI_UNICON setup.ico
!define MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_RIGHT
!define MUI_UNWELCOMEFINISHPAGE_BITMAP wizWatermark.bmp
; Use a right to left header image when the language is right to left
!ifdef ${AB_CD}_rtl
!define MUI_HEADERIMAGE_BITMAP_RTL wizHeaderRTL.bmp
!else
!define MUI_HEADERIMAGE_BITMAP wizHeader.bmp
!endif
/**
* Uninstall Pages
*/
; Welcome Page
!insertmacro MUI_UNPAGE_WELCOME
; Uninstall Confirm Page
!insertmacro MUI_UNPAGE_CONFIRM
; Remove Files Page
!define MUI_PAGE_CUSTOMFUNCTION_PRE un.preInstFiles
!insertmacro MUI_UNPAGE_INSTFILES
; Finish Page
!define MUI_PAGE_CUSTOMFUNCTION_PRE un.preFinish
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_FINISHPAGE_SHOWREADME ""
; Setup the survey controls, functions, etc. except when the application has
; defined NO_UNINSTALL_SURVEY
!ifndef NO_UNINSTALL_SURVEY
!define MUI_FINISHPAGE_SHOWREADME_TEXT $(SURVEY_TEXT)
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION un.Survey
!endif
!insertmacro MUI_UNPAGE_FINISH
################################################################################
# Install Sections
; Empty section required for the installer to compile as an uninstaller
Section ""
SectionEnd
################################################################################
# Uninstall Sections
Section "Uninstall"
SetDetailsPrint textonly
DetailPrint $(STATUS_UNINSTALL_MAIN)
SetDetailsPrint none
; Remove registry entries for non-existent apps and for apps that point to our
; install location in the Software\Mozilla key.
SetShellVarContext current ; Sets SHCTX to HKCU
${un.RegCleanMain} "Software\Mozilla"
SetShellVarContext all ; Sets SHCTX to HKLM
${un.RegCleanMain} "Software\Mozilla"
; Remove uninstall entries that point to our install location
${un.RegCleanUninstall}
SetShellVarContext all ; Set SHCTX to HKLM
${un.GetSecondInstallPath} "Software\Mozilla" $R9
${If} $R9 == "false"
SetShellVarContext current ; Set SHCTX to HKCU
${un.GetSecondInstallPath} "Software\Mozilla" $R9
${EndIf}
; XXXrstrong - Remove registry values for HKLM\Software\Clients\Calendar here.
; See Thunderbird's uninstaller.nsi for an example.
StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\App Paths\${FileMainEXE}"
${If} $R9 == "false"
DeleteRegKey HKLM "$0"
DeleteRegKey HKCU "$0"
${Else}
ReadRegStr $1 HKLM "$0" ""
Push $1
${GetPathFromRegStr}
Pop $R0
Push $R0
${GetParentDir}
Pop $R1
${If} $INSTDIR == $R1
WriteRegStr HKLM "$0" "" "$R9"
Push $R9
${GetParentDir}
Pop $R1
WriteRegStr HKLM "$0" "Path" "$R1"
${EndIf}
${EndIf}
; Remove files. If we don't have a log file skip
${If} ${FileExists} "$INSTDIR\uninstall\uninstall.log"
; Copy the uninstall log file to a temporary file
GetTempFileName $TmpVal
CopyFiles "$INSTDIR\uninstall\uninstall.log" "$TmpVal"
; Unregister DLL's
${un.LineFind} "$TmpVal" "/NUL" "1:-1" "un.UnRegDLLsCallback"
; Delete files
${un.LineFind} "$TmpVal" "/NUL" "1:-1" "un.RemoveFilesCallback"
; Remove directories we always control
RmDir /r "$INSTDIR\uninstall"
RmDir /r "$INSTDIR\updates"
RmDir /r "$INSTDIR\defaults\shortcuts"
; Remove empty directories
${un.LineFind} "$TmpVal" "/NUL" "1:-1" "un.RemoveDirsCallback"
; Delete the temporary uninstall log file
${DeleteFile} "$TmpVal"
; Remove the installation directory if it is empty
${RemoveDir} "$INSTDIR"
${EndIf}
; Refresh desktop icons otherwise the start menu internet item won't be
; removed and other ugly things will happen like recreation of the registry
; key by the OS under some conditions.
System::Call "shell32::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)"
SectionEnd
################################################################################
# Helper Functions
Function un.RemoveFilesCallback
${un.TrimNewLines} "$R9" "$R9"
StrCpy $R1 "$R9" 5
${If} $R1 == "File:"
StrCpy $R9 "$R9" "" 6
StrCpy $R0 "$R9" 1
; If the path is relative prepend the install directory
${If} $R0 == "\"
StrCpy $R0 "$INSTDIR$R9"
${Else}
StrCpy $R0 "$R9"
${EndIf}
${If} ${FileExists} "$R0"
${DeleteFile} "$R0"
${EndIf}
${EndIf}
ClearErrors
Push 0
FunctionEnd
; Using locate will leave file handles open to some of the directories which
; will prevent the deletion of these directories. This parses the uninstall.log
; and uses the file entries to find / remove empty directories.
Function un.RemoveDirsCallback
${un.TrimNewLines} "$R9" "$R9"
StrCpy $R1 "$R9" 5
${If} $R1 == "File:"
StrCpy $R9 "$R9" "" 6
StrCpy $R1 "$R9" 1
${If} $R1 == "\"
StrCpy $R2 "$INSTDIR"
StrCpy $R1 "$INSTDIR$R9"
${Else}
StrCpy $R2 ""
StrCpy $R1 "$R9"
${EndIf}
loop:
Push $R1
${GetParentDir}
Pop $R0
GetFullPathName $R1 "$R0"
; We only try to remove empty directories but the Desktop, StartMenu, and
; QuickLaunch directories can be empty so guard against removing them.
${If} "$R2" != "$INSTDIR"
SetShellVarContext all
${If} $R1 == "$DESKTOP"
${OrIf} $R1 == "$STARTMENU"
GoTo end
${EndIf}
SetShellVarContext current
${If} $R1 == "$QUICKLAUNCH"
${OrIf} $R1 == "$DESKTOP"
${OrIf} $R1 == "$STARTMENU"
GoTo end
${EndIf}
${ElseIf} "$R1" == "$INSTDIR"
GoTo end
${EndIf}
${If} ${FileExists} "$R1"
RmDir "$R1"
${EndIf}
${If} ${Errors}
${OrIf} "$R2" != "$INSTDIR"
GoTo end
${EndIf}
GoTo loop
${EndIf}
end:
ClearErrors
Push 0
FunctionEnd
Function un.UnRegDLLsCallback
${un.TrimNewLines} "$R9" "$R9"
StrCpy $R1 "$R9" 7
${If} $R1 == "DLLReg:"
StrCpy $R9 "$R9" "" 8
StrCpy $R1 "$R9" 1
${If} $R1 == "\"
StrCpy $R1 "$INSTDIR$R9"
${Else}
StrCpy $R1 "$R9"
${EndIf}
UnRegDLL $R1
${EndIf}
ClearErrors
Push 0
FunctionEnd
; Setup the survey controls, functions, etc. except when the application has
; defined NO_UNINSTALL_SURVEY
!ifndef NO_UNINSTALL_SURVEY
Function un.Survey
ExecShell "open" "${SurveyURL}"
FunctionEnd
!endif
################################################################################
# Language
!insertmacro MOZ_MUI_LANGUAGE 'baseLocale'
!verbose push
!verbose 3
!include "overrideLocale.nsh"
!include "customLocale.nsh"
!verbose pop
; Set this after the locale files to override it if it is in the locale. Using
; " " for BrandingText will hide the "Nullsoft Install System..." branding.
BrandingText " "
################################################################################
# Page pre and leave functions
; Checks if the app being uninstalled is running.
Function un.preInstFiles
; Try to delete the app executable and if we can't delete it try to close the
; app. This allows running an instance that is located in another directory.
ClearErrors
${If} ${FileExists} "$INSTDIR\${FileMainEXE}"
${DeleteFile} "$INSTDIR\${FileMainEXE}"
${EndIf}
${If} ${Errors}
ClearErrors
${un.CloseApp} "true" $(WARN_APP_RUNNING_UNINSTALL)
; Delete the app exe to prevent launching the app while we are uninstalling.
${DeleteFile} "$INSTDIR\${FileMainEXE}"
ClearErrors
${EndIf}
FunctionEnd
; When we add an optional action to the finish page the cancel button is
; enabled. This disables it and leaves the finish button as the only choice.
Function un.preFinish
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "cancelenabled" "0"
; Setup the survey controls, functions, etc. except when the application has
; defined NO_UNINSTALL_SURVEY
!ifdef NO_UNINSTALL_SURVEY
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "NumFields" "3"
!endif
FunctionEnd
################################################################################
# Initialization Functions
Function .onInit
GetFullPathName $INSTDIR "$EXEDIR\.."
${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}"
Abort
${EndUnless}
${GetParameters} $R0
; XXXrstrong - Add support for setting program access here (e.g. hide and
; display shortcuts). See Thunderbird's uninstaller.nsi for an example.
; If we made it this far then this installer is being used as an uninstaller.
WriteUninstaller "$EXEDIR\uninstaller.exe"
${If} $R0 == "/S"
StrCpy $TmpVal "$\"$EXEDIR\uninstaller.exe$\" /S"
${Else}
StrCpy $TmpVal "$\"$EXEDIR\uninstaller.exe$\""
${EndIf}
; When the uninstaller is launched it copies itself to the temp directory so
; it won't be in use so it can delete itself.
ExecWait $TmpVal
${DeleteFile} "$EXEDIR\uninstaller.exe"
SetErrorLevel 0
Quit
FunctionEnd
Function un.onInit
GetFullPathName $INSTDIR "$INSTDIR\.."
${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}"
Abort
${EndUnless}
StrCpy $LANGUAGE 0
FunctionEnd

Просмотреть файл

@ -20,6 +20,7 @@ bin\chrome\calendar-@AB_CD@.manifest
bin\defaults\pref\sunbird-l10n.js bin\defaults\pref\sunbird-l10n.js
bin\defaults\profile\prefs.js bin\defaults\profile\prefs.js
bin\defaults\profile\chrome\* bin\defaults\profile\chrome\*
bin\uninstall\uninst.exe
bin\updater.ini bin\updater.ini
[xpcom] [xpcom]

Просмотреть файл

@ -128,12 +128,15 @@ repackage-win32-installer: $(WIN32_INSTALLER_IN)
mv $(DIST)/xpi-stage/locale-$(AB_CD) l10n-stage/localized mv $(DIST)/xpi-stage/locale-$(AB_CD) l10n-stage/localized
$(MAKE) -C ../installer/windows CONFIG_DIR=l10ngen l10ngen/setup.exe l10ngen/7zSD.sfx $(MAKE) -C ../installer/windows CONFIG_DIR=l10ngen l10ngen/setup.exe l10ngen/7zSD.sfx
cp ../installer/windows/l10ngen/setup.exe l10n-stage cp ../installer/windows/l10ngen/setup.exe l10n-stage
$(NSINSTALL) -D l10n-stage/localized/uninstall
cp ../installer/windows/l10ngen/uninst.exe l10n-stage/localized/uninstall
rm -f app.7z rm -f app.7z
cd l10n-stage && \ cd l10n-stage && \
$(CYGWIN_WRAPPER) 7z a -r -t7z ../app.7z -mx -m0=BCJ2 -m1=LZMA:d24 -m2=LZMA:d19 -m3=LZMA:d19 -mb0:1 -mb0s1:2 -mb0s2:3 $(CYGWIN_WRAPPER) 7z a -r -t7z ../app.7z -mx -m0=BCJ2 -m1=LZMA:d24 -m2=LZMA:d19 -m3=LZMA:d19 -mb0:1 -mb0s1:2 -mb0s2:3
cat ../installer/windows/l10ngen/7zSD.sfx \ cat ../installer/windows/l10ngen/7zSD.sfx \
$(topsrcdir)/calendar/installer/windows/app.tag \ $(topsrcdir)/calendar/installer/windows/app.tag \
app.7z > $(WIN32_INSTALLER_OUT) app.7z > $(WIN32_INSTALLER_OUT)
chmod 0755 $(WIN32_INSTALLER_OUT)
repackage-win32-installer-%: WIN32_INSTALLER_IN=$(_ABS_DIST)/install/sea/$(PKG_BASENAME).installer.exe repackage-win32-installer-%: WIN32_INSTALLER_IN=$(_ABS_DIST)/install/sea/$(PKG_BASENAME).installer.exe
repackage-win32-installer-%: $(WIN32_INSTALLER_IN) repackage-win32-installer-%: $(WIN32_INSTALLER_IN)
@ -162,6 +165,11 @@ repackage-zip: $(ZIP_IN)
$(STAGEDIST)/chrome/calendar-en-US $(STAGEDIST)/chrome/calendar-en-US
$(RM) -rf $(DIST)/xpi-stage/locale-$(AB_CD) $(RM) -rf $(DIST)/xpi-stage/locale-$(AB_CD)
$(MAKE) libs-$(AB_CD) $(MAKE) libs-$(AB_CD)
ifeq (WINNT,$(OS_ARCH))
$(RM) -r $(STAGEDIST)/uninstall
$(NSINSTALL) -D $(STAGEDIST)/uninstall
cp ../installer/windows/l10ngen/uninst.exe $(STAGEDIST)/uninstall
endif
$(RM) -r $(DIST)/xpi-stage/locale-$(AB_CD)/chrome/$(AB_CD) $(RM) -r $(DIST)/xpi-stage/locale-$(AB_CD)/chrome/$(AB_CD)
cd $(DIST)/xpi-stage/locale-$(AB_CD) && \ cd $(DIST)/xpi-stage/locale-$(AB_CD) && \
tar $(TAR_CREATE_FLAGS) - * | ( cd $(STAGEDIST) && tar -xf - ) tar $(TAR_CREATE_FLAGS) - * | ( cd $(STAGEDIST) && tar -xf - )

Просмотреть файл

@ -53,6 +53,11 @@ ifdef MOZ_BRANDING_DIRECTORY
DEFINES += -DOFFICIAL_BRANDING=1 DEFINES += -DOFFICIAL_BRANDING=1
endif endif
# For Windows build the uninstaller during the application build since the
# uninstaller is included with the application for mar file generation.
libs::
$(MAKE) -C ../installer/windows uninstaller
endif endif
endif endif