Closed Bug 396356 Opened 17 years ago Closed 5 years ago

Package in an installer

Categories

(Other Applications Graveyard :: McCoy, enhancement)

x86
Windows 2000
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: mossop, Unassigned)

Details

Attachments

(3 files, 2 obsolete files)

There is a need to install the MSVC redistributable in order to run McCoy. The best way to do this seems to be to make a proper installer.
Severity: normal → enhancement
Rob, any chance you have some spare time to review this?

These are the main nsis scripts which I took from Firefox and cut out things that I don't believe are necessary (default browser, file type registrations etc) and adjusted a few others as appropriate. This patch is against the Firefox scripts which hopefully will make the review a bit easier.

My nsis isn't great so I may have done something bad but it certainly installs and uninstalls ok. I'm just not sure if it really needs to set all those registry keys but left them in for now.

Makefile changes to follow
Assignee: nobody → dtownsend
Status: NEW → ASSIGNED
Attachment #321661 - Flags: review?(robert.bugzilla)
Attached patch makefile changesSplinter Review
These are the makefile changes and packages-static. I haven't bothered including the images and 7zstub as they are fairly simple.
Attachment #321662 - Flags: review?(robert.bugzilla)
Comment on attachment 321661 [details] [diff] [review]
nsis scripts (patch against firefox examples)

Overall this looks fine but I'm holding off until I look at the files in their entirety which should be by tomorrow.
Attachment #321661 - Flags: review?(robert.bugzilla) → review+
Comment on attachment 321662 [details] [diff] [review]
makefile changes

You'll need an updater_append.ini if you want to update the registry after a software update.
Attachment #321662 - Flags: review?(robert.bugzilla) → review+
Sorry it took so long... I'm undecided whether it would be better to have an app specific version of UninstallOnInitCommon for the case where setting as a default app is not applicable. If you attach all the files I will do a more thorough review of the McCoy installer / uninstaller.
Attached patch full patch (obsolete) — Splinter Review
Thanks Rob. This is the full patch, it has two minor changes over the last, the inclusion of updater_append.ini and adds channel-prefs.js to packages-static. I've verified that an installed McCoy then auto-updated correctly modifies the registry and the uninstall entry.
Attachment #323246 - Flags: review?(robert.bugzilla)
Comment on attachment 323246 [details] [diff] [review]
full patch

This is not right, it is accidentally using the locale files from Firefox, need to copy those across
Attachment #323246 - Attachment is obsolete: true
Attachment #323246 - Flags: review?(robert.bugzilla)
Attached patch fuller patch (obsolete) — Splinter Review
This is a full patch, essentially the same as the previous ones with added locale strings, copied from Firefox then adjusted where necessary. Also supports packaging mozcrt19.dll since xulrunner is now jemalloc enabled.
Attachment #324829 - Flags: review?(robert.bugzilla)
Attached patch full patch rev 2Splinter Review
This removes the checkbox in the uninstaller that offers to delete all profiles.
Attachment #324829 - Attachment is obsolete: true
Attachment #328865 - Flags: review?(robert.bugzilla)
Attachment #324829 - Flags: review?(robert.bugzilla)
Comment on attachment 328865 [details] [diff] [review]
full patch rev 2

>diff --git a/installer/windows/nsis/defines.nsi.in b/installer/windows/nsis/defines.nsi.in
>new file mode 100644
>--- /dev/null
>+++ b/installer/windows/nsis/defines.nsi.in
>@@ -0,0 +1,12 @@
>+#filter substitution
>+!define AppVersion            "@MOZ_APP_VERSION@"
>+!define GREVersion            @MOZILLA_VERSION@
>+!define AB_CD                 "@AB_CD@"
>+!define FileInstallerEXE      "@PKG_BASENAME@.installer.exe"
>+!define FileInstallerMSI      "@PKG_BASENAME@.installer.msi"
>+!define FileInstallerNETRoot  "@PKG_BASENAME@.net-installer"
FileInstallerEXE, FileInstallerMSI, and FileInstallerNETRoot are not used

>+!define FileMainEXE           "@MOZ_APP_NAME@.exe"
>+!define WindowClass           "McCoyMessageWindow"
>+!define AppRegName            "McCoy"
Remove... not used

>diff --git a/installer/windows/nsis/installer.nsi b/installer/windows/nsis/installer.nsi
>new file mode 100644
>--- /dev/null
>+++ b/installer/windows/nsis/installer.nsi
>...
>+; USE_UAC_PLUGIN is temporary until Thunderbird has been updated to use the UAC plugin
Change this to
; USE_UAC_PLUGIN is temporary until other apps have been updated to use the UAC plugin

>+!define USE_UAC_PLUGIN
>+
>+Var TmpVal
>+Var StartMenuDir
>+Var InstallType
>+Var AddStartMenuSC
>+Var AddQuickLaunchSC
>+Var AddDesktopSC
>+
>+; 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
Add
!include WinVer.nsh

>+; WinVer.nsh was added in the same release that RequestExecutionLevel so check
>+; if ___WINVER__NSH___ is defined to determine if RequestExecutionLevel is
>+; available.
>+!include /NONFATAL WinVer.nsh
>+!ifdef ___WINVER__NSH___
>+  RequestExecutionLevel user
>+!else
>+  !warning "Installer will be created without Vista compatibility.$\n            \
>+            Upgrade your NSIS installation to at least version 2.22 to resolve."
>+!endif
Change all of above to the following since everyone should be using an updated NSIS now that supports this
RequestExecutionLevel user

>+!insertmacro GetOptions
>+!insertmacro GetParameters
>+!insertmacro GetSize
>+!insertmacro StrFilter
Remove StrFilter... LaunchAppFromElevatedProcess doesn't need this

>+!insertmacro WordReplace
Not used so remove

>+; The following includes are custom.
>+!include branding.nsi
>+!include defines.nsi
>+!include common.nsh
>+!include locales.nsi
>+!include version.nsh
>+
>+VIAddVersionKey "FileDescription" "${BrandShortName} Installer"
Change to the following
VIAddVersionKey "FileDescription"  "${BrandShortName} Installer"
VIAddVersionKey "OriginalFilename" "setup.exe"

see bug 445276 for the reason to add OriginalFilename

>+Section "-Application" APP_IDX
>+  ${StartUninstallLog}
>+
>+  SetDetailsPrint both
>+  DetailPrint $(STATUS_INSTALL_APP)
>+  SetDetailsPrint none
>+
>+  ${LogHeader} "Installing Main Files"
>+  ${CopyFilesFromDir} "$EXEDIR\nonlocalized" "$INSTDIR" \
>+                      "$(ERROR_CREATE_DIRECTORY_PREFIX)" \
>+                      "$(ERROR_CREATE_DIRECTORY_SUFFIX)"
>+
>+  ; Register DLLs
>+  ; XXXrstrong - AccessibleMarshal.dll can be used by multiple applications but
>+  ; is only registered for the last application installed. When the last
>+  ; application installed is uninstalled AccessibleMarshal.dll will no longer be
>+  ; registered. bug 338878
>+  ${LogHeader} "DLL Registration"
>+  ClearErrors
>+  RegDLL "$INSTDIR\xulrunner\AccessibleMarshal.dll"
I'm a tad hesitant for this to be added since it will be removed on uninstall which is more likely to occur with McCoy vs. another app. Perhaps check if there is already one registered and if not register it. This is due to Bug 338878.

>+  SetDetailsPrint both
>+  DetailPrint $(STATUS_INSTALL_LANG)
>+  SetDetailsPrint none
>+
>+  ${LogHeader} "Installing Localized Files"
>+  ${CopyFilesFromDir} "$EXEDIR\localized" "$INSTDIR" \
>+                      "$(ERROR_CREATE_DIRECTORY_PREFIX)" \
>+                      "$(ERROR_CREATE_DIRECTORY_SUFFIX)"
>+
>+  ${LogHeader} "Adding Additional Files"
This LogHeader can be removed

>+  ClearErrors
>+  WriteRegStr HKLM "Software\Mozilla\InstallerTest" "InstallerTest" "Test"
>+  ${If} ${Errors}
>+    StrCpy $TmpVal "HKCU" ; used primarily for logging
>+  ${Else}
>+    SetShellVarContext all  ; Set SHCTX to HKLM
>+    DeleteRegKey HKLM "Software\Mozilla\InstallerTest"
>+    StrCpy $TmpVal "HKLM" ; used primarily for logging
>+    ${RegCleanMain} "Software\Mozilla"
>+    ${RegCleanUninstall}
>+  ${EndIf}
Change to
WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test"
${If} ${Errors}
  StrCpy $TmpVal "HKCU" ; used primarily for logging
${Else}
  SetShellVarContext all  ; Set SHCTX to HKLM
  DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest"
  StrCpy $TmpVal "HKLM" ; used primarily for logging
  ${RegCleanMain} "Software\Mozilla"
  ${RegCleanUninstall}
${EndIf}

>+Function LaunchAppFromElevatedProcess
>+  ${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_LAUNCH)"
>+
>+  ; Find the installation directory when launching using GetFunctionAddress
>+  ; from an elevated installer since $INSTDIR will not be set in this installer
>+  ${StrFilter} "${FileMainEXE}" "+" "" "" $R9
>+  ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" ""
>+  ${GetPathFromString} "$0" $0
>+  ${GetParent} "$0" $1
>+  ; Set our current working directory to the application's install directory
>+  ; otherwise the 7-Zip temp directory will be in use and won't be deleted.
>+  SetOutPath "$1"
>+  Exec "$0"
>+FunctionEnd
This is bogus since McCoy doesn't have an entry in that registry key... I'll come up with a solution after I finish the review.
Comment on attachment 328865 [details] [diff] [review]
full patch rev 2

>diff --git a/installer/windows/nsis/uninstaller.nsi b/installer/windows/nsis/uninstaller.nsi
>new file mode 100644
>--- /dev/null
>+++ b/installer/windows/nsis/uninstaller.nsi
>...
>+# Required Plugins:
>+# AppAssocReg http://nsis.sourceforge.net/Application_Association_Registration_plug-in
Not using AppAssocReg so remove

>+; USE_UAC_PLUGIN is temporary until Thunderbird has been updated to use the UAC plugin
Change this to
; USE_UAC_PLUGIN is temporary until other apps have been updated to use the UAC plugin

>+; Other included files may depend upon these includes!
>+; The following includes are provided by NSIS.
>+!include FileFunc.nsh
>+!include LogicLib.nsh
>+!include MUI.nsh
>+!include TextFunc.nsh
>+!include WinMessages.nsh
Add
!include WinVer.nsh

>+; WinVer.nsh was added in the same release that RequestExecutionLevel so check
>+; if ___WINVER__NSH___ is defined to determine if RequestExecutionLevel is
>+; available.
>+!include /NONFATAL WinVer.nsh
>+!ifdef ___WINVER__NSH___
>+  RequestExecutionLevel user
>+!else
>+  !warning "Installer will be created without Vista compatibility.$\n            \
>+            Upgrade your NSIS installation to at least version 2.22 to resolve."
>+!endif
Change all of above to the following since everyone should be using an updated NSIS now that supports this
RequestExecutionLevel user

>+!insertmacro StrFilter
>+!insertmacro WordReplace
remove StrFilter and WordReplace... they are not used

>+!insertmacro un.LineFind
>+!insertmacro un.TrimNewLines
un.LineFind and un.TrimNewLines are added / used by common.nsh and are not used directly in the uninstaller so they can be removed

>+; The following includes are custom.
>+!include branding.nsi
>+!include defines.nsi
>+!include common.nsh
>+!include locales.nsi
>+!include version.nsh
>+
>+; This is named BrandShortName helper because we use this for software update
>+; post update cleanup.
>+VIAddVersionKey "FileDescription" "${BrandShortName} Helper"
Change to the following
VIAddVersionKey "FileDescription"  "${BrandShortName} Helper"
VIAddVersionKey "OriginalFilename" "helper.exe"

see bug 445276 for the reason to add OriginalFilename

>+!insertmacro un.ChangeMUIHeaderImage
>+!insertmacro un.CheckForFilesInUse
>+!insertmacro un.CleanUpdatesDir
>+!insertmacro un.CleanVirtualStore
>+!insertmacro un.DeleteRelativeProfiles
Remove un.DeleteRelativeProfiles... not used

>+  ${MUI_INSTALLOPTIONS_READ} $0 "unconfirm.ini" "Field 3" "State"
>+  ${If} "$0" == "1"
>+    ${un.DeleteRelativeProfiles} "Mozilla\McCoy"
>+    RmDir "$APPDATA\Mozilla\Extensions\mccoy@developer.mozilla.org"
>+    RmDir "$APPDATA\Mozilla\Extensions"
>+    RmDir "$APPDATA\Mozilla"
>+  ${EndIf}
remove... not used

>+  WriteRegStr HKLM "Software\Mozilla\InstallerTest" "InstallerTest" "Test"
>+  ${If} ${Errors}
>+    StrCpy $TmpVal "HKCU" ; used primarily for logging
>+  ${Else}
>+    SetShellVarContext all  ; Set SHCTX to HKLM
>+    DeleteRegKey HKLM "Software\Mozilla\InstallerTest"
>+    StrCpy $TmpVal "HKLM" ; used primarily for logging
>+    ${un.RegCleanMain} "Software\Mozilla"
>+    ${un.RegCleanUninstall}
>+  ${EndIf}
Change to
WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write
Test"
${If} ${Errors}
  StrCpy $TmpVal "HKCU" ; used primarily for logging
${Else}
  SetShellVarContext all  ; Set SHCTX to HKLM
  DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest"
  StrCpy $TmpVal "HKLM" ; used primarily for logging
  ${RegCleanMain} "Software\Mozilla"
  ${RegCleanUninstall}
${EndIf}

>+################################################################################
>+# Helper Functions
>+
Possible remove... no functions in this section but it might be nice to keep it as a placeholder

>+Function un.leaveConfirm
>+  ${MUI_INSTALLOPTIONS_READ} $0 "unconfirm.ini" "Settings" "State"
>+  StrCmp $0 "3" +1 continue
>+  ${MUI_INSTALLOPTIONS_READ} $0 "unconfirm.ini" "Field 3" "State"
>+  ${MUI_INSTALLOPTIONS_READ} $1 "unconfirm.ini" "Field 4" "HWND"
>+  StrCmp $0 1 +1 +3
>+  ShowWindow $1 ${SW_SHOW}
>+  Abort
>+
>+  ShowWindow $1 ${SW_HIDE}
>+  Abort
>+
>+  continue:
remove... only used when providing the option to delete profiles.
>diff --git a/installer/windows/nsis/installer.nsi b/installer/windows/nsis/installer.nsi
>new file mode 100644
>--- /dev/null
>+++ b/installer/windows/nsis/installer.nsi
>...
>+Function preSummary
>+  !insertmacro createSummaryINI
Remove SUMMARY_MAKE_DEFAULT from custom.properties and copy over the parts of createSummaryINI that you need as you did for un.createUnConfirmINI

>+  !insertmacro MUI_HEADER_TEXT "$(SUMMARY_PAGE_TITLE)" "$(SUMMARY_PAGE_SUBTITLE)"
>+
>+  ; The Summary custom page has a textbox that will automatically receive
>+  ; focus. This sets the focus to the Install button instead.
>+  !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "summary.ini"
>+  GetDlgItem $0 $HWNDPARENT 1
>+  System::Call "user32::SetFocus(i r0, i 0x0007, i,i)i"
>+  ${MUI_INSTALLOPTIONS_READ} $1 "summary.ini" "Field 2" "HWND"
>+  SendMessage $1 ${WM_SETTEXT} 0 "STR:$INSTDIR"
>+  !insertmacro MUI_INSTALLOPTIONS_SHOW
>+FunctionEnd
Comment on attachment 328865 [details] [diff] [review]
full patch rev 2

>diff --git a/chrome/locales/en-US/installer/custom.properties b/chrome/locales/en-US/installer/custom.properties
>new file mode 100644
>--- /dev/null
>+++ b/chrome/locales/en-US/installer/custom.properties
>@@ -0,0 +1,102 @@
>...
>+SUMMARY_PAGE_TITLE=Summary
>+SUMMARY_PAGE_SUBTITLE=Ready to start installing $BrandShortName
>+SUMMARY_INSTALLED_TO=$BrandShortName will be installed to the following location:
>+SUMMARY_REBOOT_REQUIRED_INSTALL=A restart of your computer may be required to complete the installation.
>+SUMMARY_REBOOT_REQUIRED_UNINSTALL=A restart of your computer may be required to complete the uninstall.
>+SUMMARY_MAKE_DEFAULT=
Remove as noted above



>diff --git a/installer/windows/nsis/shared.nsh b/installer/windows/nsis/shared.nsh
>new file mode 100644
>--- /dev/null
>+++ b/installer/windows/nsis/shared.nsh
>@@ -0,0 +1,233 @@
>...
>+  WriteRegStr HKLM "Software\Mozilla\InstallerTest" "InstallerTest" "Test"
>+  ${If} ${Errors}
>+    StrCpy $TmpVal "HKCU" ; used primarily for logging
>+  ${Else}
>+    SetShellVarContext all    ; Set SHCTX to all users (e.g. HKLM)
>+    DeleteRegKey HKLM "Software\Mozilla\InstallerTest"
>+    StrCpy $TmpVal "HKLM" ; used primarily for logging
>+    ${RegCleanMain} "Software\Mozilla"
>+    ${RegCleanUninstall}
>+    ${SetUninstallKeys}
>+  ${EndIf}
Change to
WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test"
${If} ${Errors}
  StrCpy $TmpVal "HKCU" ; used primarily for logging
${Else}
  SetShellVarContext all  ; Set SHCTX to HKLM
  DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest"
  StrCpy $TmpVal "HKLM" ; used primarily for logging
  ${RegCleanMain} "Software\Mozilla"
  ${RegCleanUninstall}
  ${SetUninstallKeys}
${EndIf}

The changes below are to try to make string equality checks consistent
>+!macro HideShortcuts
>+  SetShellVarContext all  ; Set $DESKTOP to All Users
>+  ${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
>+    SetShellVarContext current  ; Set $DESKTOP to the current user's desktop
>+  ${EndUnless}
>+
>+  ${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
>+    ShellLink::GetShortCutArgs "$DESKTOP\${BrandFullName}.lnk"
>+    Pop $0
>+    ${If} $0 == ""
Change to
${If} "$0" == ""

>+      ShellLink::GetShortCutTarget "$DESKTOP\${BrandFullName}.lnk"
>+      Pop $0
>+      ; Needs to handle short paths
>+      ${If} $0 == "$INSTDIR\${FileMainEXE}"
Change to
${If} "$0" == "$INSTDIR\${FileMainEXE}"

>+        Delete "$DESKTOP\${BrandFullName}.lnk"
>+      ${EndIf}
>+    ${EndIf}
>+  ${EndIf}
>+
>+  ${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk"
>+    ShellLink::GetShortCutArgs "$QUICKLAUNCH\${BrandFullName}.lnk"
>+    Pop $0
>+    ${If} $0 == ""
Change to
${If} "$0" == ""

>+      ShellLink::GetShortCutTarget "$QUICKLAUNCH\${BrandFullName}.lnk"
>+      Pop $0
>+      ; Needs to handle short paths
>+      ${If} $0 == "$INSTDIR\${FileMainEXE}"
Change to
${If} "$0" == "$INSTDIR\${FileMainEXE}"

>+!macro SetAppKeys
>+  ${GetLongPath} "$INSTDIR" $8
>+  StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion} (${AB_CD})\Main"
>+  ${WriteRegStr2} $TmpVal "$0" "Install Directory" "$8" 0
>+  ${WriteRegStr2} $TmpVal "$0" "PathToExe" "$8\${FileMainEXE}" 0
>+  ${WriteRegStr2} $TmpVal "$0" "Program Folder Path" "$SMPROGRAMS\$StartMenuDir" 0
>+
>+  SetShellVarContext all  ; Set $DESKTOP to All Users
>+  ${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
>+    SetShellVarContext current  ; Set $DESKTOP to the current user's desktop
>+  ${EndUnless}
>+
>+  ${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
>+    ShellLink::GetShortCutArgs "$DESKTOP\${BrandFullName}.lnk"
>+    Pop $1
>+    ${If} $1 == ""
Change to
${If} "$1" == ""

>+      ShellLink::GetShortCutTarget "$DESKTOP\${BrandFullName}.lnk"
>+      Pop $1
>+      ${GetLongPath} "$1" $1
>+      ${If} "$1" == "$8\${FileMainEXE}"
>+        ${WriteRegDWORD2} $TmpVal "$0" "Create Desktop Shortcut" 1 0
>+      ${Else}
>+        ${WriteRegDWORD2} $TmpVal "$0" "Create Desktop Shortcut" 0 0
>+      ${EndIf}
>+    ${EndIf}
>+  ${EndIf}
>+
>+  ; XXXrstrong - need a cleaner way to prevent unsetting SHCTX from HKLM when
>+  ; trying to find the desktop shortcut.
>+  ${If} $TmpVal == "HKCU"
Change to
${If} "$TmpVal" == "HKCU"

>+    SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU)
>+  ${Else}
>+    SetShellVarContext all     ; Set SHCTX to all users (e.g. HKLM)
>+  ${EndIf}
>+
>+  ${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk"
>+    ShellLink::GetShortCutArgs "$QUICKLAUNCH\${BrandFullName}.lnk"
>+    Pop $1
>+    ${If} $1 == ""
Change to
${If} "$1" == ""

>+      ShellLink::GetShortCutTarget "$QUICKLAUNCH\${BrandFullName}.lnk"
>+      Pop $1
>+      ${GetLongPath} "$1" $1
>+      ${If} $1 == "$8\${FileMainEXE}"
Change to 
${If} "$1" == "$8\${FileMainEXE}"
Comment on attachment 328865 [details] [diff] [review]
full patch rev 2

That's it! Sorry it took so long
Attachment #328865 - Flags: review?(robert.bugzilla) → review-
The following should handle LaunchAppFromElevatedProcess

Function LaunchAppFromElevatedProcess
  ${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_LAUNCH)"

  ; Find the installation directory when launching using GetFunctionAddress
  ; from an elevated installer since $INSTDIR will not be set in this installer
  ReadRegStr $0 HKLM "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}\bin" "PathToExe"
  ${GetParent} "$0" $1
  ; Set our current working directory to the application's install directory
  ; otherwise the 7-Zip temp directory will be in use and won't be deleted.
  SetOutPath "$1"
  Exec "$0"
FunctionEnd
I can no longer work on this project
Assignee: dtownsend → nobody
Status: ASSIGNED → NEW
McCoy is no longer maintained, closing.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX
Product: Other Applications → Other Applications Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: