Difference between revisions of "Google Chrome"

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search
m (Google Chrome Enterprise: update version, correct reg add (/d instead of /v twice))
Line 42: Line 42:
 
         priority="10">
 
         priority="10">
 
   
 
   
         <variable name="version" value="39.0.2171.99" />
+
         <variable name="version" value="54.0.2840.59" />
 
   
 
   
 
         <variable name="PKG_DESTINATION"      value="%PROGRAMFILES%\Google\Chrome\Application" />
 
         <variable name="PKG_DESTINATION"      value="%PROGRAMFILES%\Google\Chrome\Application" />
Line 58: Line 58:
 
         <install cmd='%COMSPEC% /c if exist "%public%\Desktop\Google Chrome.lnk" del "%public%\Desktop\Google Chrome.lnk"' />
 
         <install cmd='%COMSPEC% /c if exist "%public%\Desktop\Google Chrome.lnk" del "%public%\Desktop\Google Chrome.lnk"' />
 
         <!-- turn off AutoUpdate -->
 
         <!-- turn off AutoUpdate -->
         <install cmd='%COMSPEC% /c reg add HKLM\SOFTWARE\Policies\Google\Update /v AutoUpdateCheckPeriodMinutes /t REG_DWORD /v 0 /f' />
+
         <install cmd='REG ADD HKLM\SOFTWARE\Policies\Google\Update /v AutoUpdateCheckPeriodMinutes /d 0 /f /t REG_DWORD' />
 
   
 
   
 
         <upgrade include="install" />
 
         <upgrade include="install" />
 
   
 
   
 
         <!-- kill chrome and all it's buddies -->
 
         <!-- kill chrome and all it's buddies -->
         <remove cmd="taskkill /F /IM chrome.exe">
+
         <remove cmd="taskkill /F /IM chrome.exe"><exit code="any" /></remove>
            <exit code="any" />
+
        </remove>
+
+
 
         <!-- this is sometimes slow, but works, and does not rely on the original installer being available -->
 
         <!-- this is sometimes slow, but works, and does not rely on the original installer being available -->
 
         <remove cmd='wmic product where name="Google Chrome" call uninstall' />
 
         <remove cmd='wmic product where name="Google Chrome" call uninstall' />
         <remove cmd='%COMSPEC% /c reg delete HKLM\SOFTWARE\Policies\Google\Update /v AutoUpdateCheckPeriodMinutes /f' />
+
         <remove cmd='REG DELETE HKLM\SOFTWARE\Policies\Google\Update /v AutoUpdateCheckPeriodMinutes /f' />
 
   
 
   
 
     </package>
 
     </package>
 +
 
</packages:packages>
 
</packages:packages>
 
</source>
 
</source>

Revision as of 20:22, 19 October 2016

Chrome is a web browser from Google.

You can download the current stable version in an MSI installer, Chrome for Business, for whichever operating system you're currently using from http://www.google.com/intl/en/chrome/business/browser/, or use the direct link to download the Windows version in particular from http://www.google.com/chrome/eula.html?msi=true&platform=win.

http://dl.google.com/tag/s/defaultbrowser/edgedl/chrome/install/GoogleChromeStandaloneEnterprise.msi

From Wikipedia: "In December 2010 Google announced that to make it easier for businesses to use Chrome they would provide an official Chrome MSI package. For business use it is helpful to have full-fledged MSI packages that can be customized via transform files (.mst) - but the MSI provided with Chrome is only a very limited MSI wrapper fitted around the normal installer, and many businesses find that this arrangement does not meet their needs. The normal downloaded Chrome installer puts the browser in the user's local app data directory and provides invisible background updates, but the MSI package will allow installation at the system level, providing system administrators control over the update process — it was formerly possible only when Chrome was installed using Google Pack. Google also created group policy objects to fine tune the behavior of Chrome in the business environment, for example setting automatic updates interval, disable auto-updates, a home page and to workaround their basic Windows design flaws and bugs if it comes to roaming profiles support, etc. Until version 24 the software is known not to be ready for enterprise deployments with roaming profiles or Terminal Server/Citrix environments."

Google Chrome is only available as a 32-bit program on Windows, there is no 64-bit version.

Google Chrome Enterprise

The Google Chrome installer (chrome_installer.exe) installs per-user. To install it system-wide (into the %PROGRAMFILES% directory), use Chrome for Business (GoogleChromeStandaloneEnterprise.msi).

Chrome shows an unrelated product version in Uninstall Programs, so the package definition checks only that it is present and then checks the actual version against chrome.exe.

Chrome can be updated while it's running, but the changes won't happen until the running process is closed.

<?xml version="1.0" encoding="UTF-8"?>
 
<!-- 
    we use enterprise Chrome installer, which makes sane choices for most things
    the installer will run successfully whilst Chrome is running, installing to new_chrome.exe
    when the last running instance of Chrome exits, then:
    chrome.exe is renamed to old_chrome.exe
    new_chrome.exe is renamed to chrome.exe
 
    chrome installer log is at
    %temp%\chrome_installer.log
-->
 
<packages:packages xmlns:packages="http://www.wpkg.org/packages"
    xmlns:wpkg="http://www.wpkg.org/wpkg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.wpkg.org/packages xsd/packages.xsd">
 
    <package 
        id="chrome"
        name="Google Chrome"
        revision="%version%"
        reboot="false"
        priority="10">
 
        <variable name="version" value="54.0.2840.59" />
 
         <variable name="PKG_DESTINATION"      value="%PROGRAMFILES%\Google\Chrome\Application" />
         <variable name="PKG_DESTINATION"      value="%PROGRAMFILES(x86)%\Google\Chrome\Application" architecture="x64"/>
 
        <!-- check the version no. to check the package state -->
        <check type="logical" condition="or">
            <check type="file" condition="versiongreaterorequal" path="%PKG_DESTINATION%\chrome.exe"     value="%version%" />
            <check type="file" condition="versiongreaterorequal" path="%PKG_DESTINATION%\new_chrome.exe" value="%version%" />
        </check> 
 
        <!-- install the software, fails if .msi is renamed -->
        <install cmd='msiexec /qn /norestart /i "%SOFTWARE%\chrome\GoogleChromeStandaloneEnterprise.msi"' />
        <!-- remove the desktop icon -->
        <install cmd='%COMSPEC% /c if exist "%public%\Desktop\Google Chrome.lnk" del "%public%\Desktop\Google Chrome.lnk"' />
        <!-- turn off AutoUpdate -->
        <install cmd='REG ADD HKLM\SOFTWARE\Policies\Google\Update /v AutoUpdateCheckPeriodMinutes /d 0 /f /t REG_DWORD' />
 
        <upgrade include="install" />
 
        <!-- kill chrome and all it's buddies -->
        <remove cmd="taskkill /F /IM chrome.exe"><exit code="any" /></remove>
        <!-- this is sometimes slow, but works, and does not rely on the original installer being available -->
        <remove cmd='wmic product where name="Google Chrome" call uninstall' />
        <remove cmd='REG DELETE HKLM\SOFTWARE\Policies\Google\Update /v AutoUpdateCheckPeriodMinutes /f' />
 
    </package>

</packages:packages>

Disable Automatic Updates

See Auto-updates and Google Update for Enterprise.

Windows Registry

Update policy override policy

Prevent updates for specific application(s), using the "Update policy override" policy for that specific application, as defined by its <AppID> (Is there one ID for all versions of Chrome, or one for each version of Chrome?):

HKLM\SOFTWARE\Policies\Google\Update\Update<AppID>=REG_DWORD:0

For example:

HKLM\SOFTWARE\Policies\Google\Update\Update{4DC8B4CA-1BDA-483E-B5FA-D3C12E15B62D}=REG_DWORD:0

Update policy override default policy

Prevent any application that uses Google Update from being automatically updated, using the 'Update policy override default' policy:

HKLM\SOFTWARE\Policies\Google\Update\UpdateDefault=REG_DWORD:0

WPKG

Update policy override policy

    <package id="google-chrome-pol-no.update"
            name="Google Chrome (Policy) - Disable updates"
            revision="1"
            reboot="false"
            priority="1">

        <depends package-id="google-chrome"/>

        <variable name="PKG_KEY"           value="HKLM\SOFTWARE\Policies\Google\Update"/>

        <variable name="PKG_VALUE"         value="Update{4DC8B4CA-1BDA-483E-B5FA-D3C12E15B62D}"/>

        <variable name="PKG_DATA"          value="0"/>

        <check type="registry" condition="equals" path="%PKG_KEY%\%PKG_VALUE%" value="%PKG_DATA%" />

        <install cmd='reg add %PKG_KEY% /v %PKG_VALUE% /d %PKG_DATA% /t REG_DWORD /f'/>

        <upgrade include="install" />

        <remove cmd='reg delete %PKG_KEY% /v %PKG_VALUE% /f'/>
    </package>

Note for Remote Desktop Services

Windows Server 2008 R2 has a new feature called Windows Installer RDS Compatibility. This feature is enabled by default when using Remote Desktop Services and will cause some MSI installers to hang. When run through WPKG the install process will appear to never finish. When run with the same parameters from a command-line you'll see a Windows Installer dialog that asks you to wait and a progress bar that repeatedly completes and restarts. To successfully install Chrome on an RDS server you need to configure it using either:

Windows Registry

Create a key to disable this feature:

HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows NT\Terminal Services\TSAppSrv\TSMSI\Enable=DWORD:0 

The keys TSAppSrv and TSMSI probably won't exist and need to be created.

Windows GUI

Start → control panel → install application on remote desktop → Browse to the MSI file listed above.

Start → Run → MMC.exe addin → Group Policy ObjectEditor \Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Application Compatibility – Turn off Windows Installer RDS Compatibility

Turn back on after you're done.

It is possible for this not to work if you changed the policy while it was installing saying "please wait..."; also, make sure users didn't install Chrome into their Windows profile (you can only see their Chrome in their own Add/Remove Programs).

Automated Updates of Chrome's WPKG Files

This is a VBScript we run on our WPKG server that downloads the current Chrome MSI, renames it according to the Chrome release number, and updates the package XML files accordingly. This greatly simplifies rolling out new versions of Chrome: we watch the Google Chrome Releases RSS feed, and anytime we see a stable channel update, we run our VBScript. It's been working since April, for Chrome releases 18 through 21.

update-chrome.vbs

' update-chrome.vbs -- stored in %SOFTWARE%\google-chrome
Option Explicit
Dim objFSO, objFile, strFileProperties, objShell, strChromePath, strChromeURL
Dim strVersion, objResult, strChromeFilename, objOleFile, arrComments
Dim strTemplateFilename, ForReading, ForWriting, strText
Dim strNewText

strChromePath = "L:\wpkg\software\google-chrome\"
strChromeFilename = "GoogleChromeStandaloneEnterprise.msi"
strTemplateFilename = "google-chrome-template.xml"
strChromeURL = "https://dl.google.com/edgedl/chrome/install/" & _
	strChromeFilename

Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objOleFile = CreateObject("DSOFile.OleDocumentProperties")

objShell.CurrentDirectory = strChromePath
' wget downloaded from http://users.ugent.be/~bpuype/wget/
objResult = objShell.Run("wget --no-check-certificate " & strChromeURL, _
	1, True)
If objFSO.FileExists(strChromePath & strChromeFilename) Then
	' Grab version number. Requires Office installation, or DSOFile.dll
	' from http://support.microsoft.com/kb/224351
	objOleFile.Open(strChromePath & strChromeFilename)
	arrComments = Split(objOleFile.SummaryProperties.Comments, " ", 2)
	strVersion = arrComments(0)
	objOleFile.Close

	' Make a copy of the file
	Set objFile = objFSO.GetFile(strChromePath & strChromeFilename)
	objFile.Copy strChromePath & "GoogleChromeStandaloneEnterprise-" & _
		strVersion & ".msi", True
	' Delete the original file
	objFile.Delete True
	' Update package definitions
	updateXML strTemplateFilename, _
		"..\..\packages\google-chrome.xml" ' legacy tree
	updateXML strTemplateFilename, _
		"..\..\dev\packages\google-chrome.xml" ' dev tree
	updateXML strTemplateFilename, _
		"..\..\stable\packages\google-chrome.xml" ' stable tree
Else
	MsgBox "Selected file does not exist!"
End If

Sub updateXML(strTemplateFilename, strPackageFilename)
	' Update package definition
	ForReading = 1
	ForWriting = 2
	Set objFile = objFSO.OpenTextFile(strTemplateFilename, ForReading)
	strText = objFile.ReadAll
	objFile.Close
	strNewText = Replace(strText, "__VERSION__", strVersion)

	Set objFile = objFSO.OpenTextFile(strPackageFilename, ForWriting)
	objFile.WriteLine strNewText
	objFile.Close
End Sub

google-chrome-template.xml

<!--
Thie file generated from %SOFTWARE%\google-chrome\update-chrome.vbs and google-chrome-template.xml
Manual edits to packages\google-chrome.xml will be overwritten.
-->
<packages>
<package
  id="google-chrome"
  name="Google Chrome"
  revision="%version%"
  reboot="false">
 
  <variable name="version" value="__VERSION__" />
  <variable architecture="x86" name="progfiles" value="%PROGRAMFILES%" />
  <variable architecture="x64" name="progfiles" value="%PROGRAMFILES(X86)%" />
 
  <check
    type="uninstall"
    condition="exists"
    path="Google Chrome" />
  <check
    type="file"
    condition="versionequalto"
    path="%progfiles%\Google\Chrome\Application\chrome.exe"
    value="%version%" />
 
  <install cmd="taskkill /F /IM chrome.exe">
    <exit code="any" />
  </install>
  <install cmd='msiexec /qn /norestart /i "%SOFTWARE%\google-chrome\GoogleChromeStandaloneEnterprise-%version%.msi"' />
 
  <upgrade include='install' />
 
  <remove cmd="taskkill /F /IM chrome.exe">
    <exit code="any" />
  </remove>
  <remove cmd='msiexec /qn /x "%SOFTWARE%\google-chrome\GoogleChromeStandaloneEnterprise-%version%.msi"' />
</package>
</packages>

--Mwr 17:05, 10 August 2012 (CEST)

update-chrome-xml.sh

Just to get an idea how this can be done using bash scripting if your wpkg share is on linux using samba, here is my script which checks if there is a newer version of google chrome. Only then it copies the msi file and creates new xml file from template. It substitutes the __VERSION__ and __MSIKEY__ strings, which are extracted from the msi file. Seems like a quick hack to get the strings out of the MSI file, at least it works at the moment.

#!/bin/bash

# source: http://wpkg.org/Google_Chrome#Automated_Updates_of_Chrome.27s_WPKG_Files
#

MAINPATH=/srv/share/install
TMPPATH=$MAINPATH/temp
DESTPATH=$MAINPATH/packages/GoogleChrome
TEMPLATE=$MAINPATH/packages/Templates/googlechrome.xml
FILENAME=googlechrome.xml
TEMPFILE=$TMPPATH/$FILENAME
DESTFILE=$MAINPATH/packages/$FILENAME

DLFILE=GoogleChromeStandaloneEnterprise
DLSOURCE=https://dl.google.com/edgedl/chrome/install/$DLFILE.msi


cd $TMPPATH
rm $DLFILE.msi
/usr/bin/wget --no-check-certificate $DLSOURCE

RAWSTRINGS=`/usr/bin/strings $DLFILE.msi | /bin/grep -EC3 "^Installer$" | tr "\n" " " `

for k in ${RAWSTRINGS} ; do
    unset SUBSTRING1; unset SUBSTRING2 ;
    SUBSTRING1=`expr match "$k" '\([[:digit:].]\{12,16\}\)' `
    if [ -n "${SUBSTRING1}" ] ; then
       GCVERSION="$SUBSTRING1";
       break
    fi
done
for k in ${RAWSTRINGS} ; do
    SUBSTRING2=`expr match "$k" '{\([[:alnum:]-]\{36\}\)}' `
    if [ -n "$SUBSTRING2" ] ; then
       GCMSIKEY=$SUBSTRING2;
       break
    fi
done

echo Version: $GCVERSION
echo Key: $GCMSIKEY

    if [ -z "$GCVERSION" ] ; then
       echo no version found
       exit 2
    fi
# create xml file from template

sed -e "s/__VERSION__/${GCVERSION}/" <$TEMPLATE  | sed -e "s/__MSIKEY__/${GCMSIKEY}/"  >$TEMPFILE

diff -wB $TEMPLATE  $TEMPFILE >/dev/null

if [ $? -eq 0 ] ; then
    # version  not changed
    echo string error
    exit 1
fi

diff -wB $TEMPFILE $DESTFILE >/dev/null

if [ $? -eq 0 ] ; then
    # no difference
    echo not newer
    rm $DLFILE.msi
    exit 0
fi

   echo copying files

mv $DLFILE.msi $DESTPATH/$DLFILE-$GCVERSION.msi
cp $TEMPFILE $DESTFILE

--Ftrojahn 12:09, 08 October 2013 (CEST)

External Links