Skip to main content
Question

How to update Chrome automatically


Show first post

132 replies

Forum|alt.badge.img+18
  • Contributor
  • 475 replies
  • June 10, 2019

Okay, there seemed to have been an oversight in the below 74 path settings. Try this:

#!/bin/bash
appPath="/Applications/Google Chrome.app"

#no exist? exit.
[[ ! -e "${appPath}/Contents/Info.plist" ]] && exit

appVersion=$(defaults read "${appPath}/Contents/Info.plist" CFBundleShortVersionString)
majorVersion=$(echo "$appVersion" | awk -F '.' '{print $1}')
if [[ $majorVersion -ge 75 ]] ; then
    # Framework will be in ../Content/Frameworks
    frameWorkPath="${appPath}/Contents/Frameworks/Google Chrome Framework.framework/Versions/${appVersion}/Frameworks/KeystoneRegistration.framework"
    scriptsPath="${appPath}/Contents/Frameworks/Google Chrome Framework.framework/Versions/${appVersion}/Resources"
else
    # Framework will be in ../Contents/Versions
    frameWorkPath="${appPath}/Contents/Versions/${appVersion}/Google Chrome Framework.framework/Versions/A/Frameworks/KeystoneRegistration.framework"
    scriptsPath="${appPath}/Contents/Versions/${appVersion}/Google Chrome Framework.framework/Versions/A/Resources"
fi

updateURL=$(defaults read "${appPath}/Contents/Info.plist" KSUpdateURL)
productID=$(defaults read "${appPath}/Contents/Info.plist" KSProductID)

"${scriptsPath}/keystone_promote_preflight.sh" 2>/dev/null 1>&2
"${frameWorkPath}/Resources/ksinstall" --install "${frameWorkPath}/Resources/Keystone.tbz" --force 2>/dev/null
/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/MacOS/ksadmin 
    --register 
    --productid "${productID}" 
    --version "${appVersion}" 
    --xcpath "${appPath}" 
    --url "${updateURL}" 
    --tag-path "${appPath}/Contents/Info.plist" 
    --tag-key "KSChannelID" 
    --brand-path "/Library/Google/Google Chrome Brand.plist" 
    --brand-key "KSBrandID" 
    --version-path "${appPath}/Contents/Info.plist" 
    --version-key "KSVersion"
"${scriptsPath}/keystone_promote_postflight.sh" "${appPath}" 2>/dev/null 1>&2

Forum|alt.badge.img+1
  • New Contributor
  • 4 replies
  • June 10, 2019

I'm getting code 127 errors too. @ryan.ball


Forum|alt.badge.img+8
  • Valued Contributor
  • 120 replies
  • June 10, 2019

@ryan.ball I don't notice the changes in your script here from the one prior?


Forum|alt.badge.img+18
  • Contributor
  • 475 replies
  • June 10, 2019

Was:

frameWorkPath="${appPath}/Contents/Versions/${appVersion}/Google Chrome Framework.framework/Frameworks/KeystoneRegistration.framework"
scriptsPath="${appPath}/Contents/Versions/${appVersion}/Google Chrome Framework.framework/Version/A/Resources"

Now:

frameWorkPath="${appPath}/Contents/Versions/${appVersion}/Google Chrome Framework.framework/Versions/A/Frameworks/KeystoneRegistration.framework"
scriptsPath="${appPath}/Contents/Versions/${appVersion}/Google Chrome Framework.framework/Versions/A/Resources"

Forum|alt.badge.img+8
  • Valued Contributor
  • 120 replies
  • June 10, 2019

@ryan.ball That gave me a Code 0

I will let you know if this updates the current version of Chrome and toggles on auto updates after a recon push.

Thanks again for all your hard work @ryan.ball


rqomsiya
Forum|alt.badge.img+12
  • Honored Contributor
  • 225 replies
  • June 14, 2019

I'm getting this error with @ryan.ball 's script:

KSInstallAction install script failure. Exit code: 12. Standard error output: "goobspatch: old hash mismatch: ee3b7cc8d6e24be4a5cd4bf41330bc783aac1411 != 08a53d4ffe4dd04384ff193b609c604b99af24f0 dirpatcher.sh: couldn't create /Applications/Google Chrome.app/Contents/Frameworks/Google Chrome Framework.framework/Versions/75.0.3770.90/Google Chrome Framework by applying /tmp/KSInstallAction.5kcwe9seHm/m/.patch/framework_75.0.3770.80_75.0.3770.90.dirpatch/Google Chrome Framework$gbs to /Applications/Google Chrome.app/Contents/Frameworks/Google Chrome Framework.framework/Versions/75.0.3770.80/Google Chrome Framework .keystone_install: dirpatcher of versioned directory failed, status 13 ".

Anyone seen this?


sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • 3540 replies
  • June 14, 2019

@rqomsiya Notice the mix of version numbers in that output


rqomsiya
Forum|alt.badge.img+12
  • Honored Contributor
  • 225 replies
  • June 14, 2019

@sdagley I only have one version installed, why do you think it might be pulling different versions?

Thanks!


sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • 3540 replies
  • June 15, 2019

@rqomsiya Take a look inside the Google Chrome.app package (right-click on the Google Chrome.app icon select Show Package Contents from the popup menu that will be displayed). Dig down into Contents/Frameworks/Google Chrome Framework.framework/Versions and you'll see there are actually multiple versions present.

I suspect either @ryan.ball's script has a problem running when there is more than 1 version present, the v75 Chrome updater mechanism has a problem when more than 1 version is present, or your install of Chrome was corrupted.


Forum|alt.badge.img+18
  • Contributor
  • 475 replies
  • June 17, 2019

Somehow this became my script, so I took it upon myself to add error checking and some output that might help people. I'm afraid that adding multiple versions to the thread has probably caused some confusion for folks, so I've posted a version on my github for the community to try.


Forum|alt.badge.img+5
  • Contributor
  • 38 replies
  • June 20, 2019
Written by Ryan Ball after somehow becoming responsible for it

@ryan.ball Hah I know the feeling — thanks for your work on this. I'm sure it will be used by many 👍


Forum|alt.badge.img+11
  • Contributor
  • 19 replies
  • June 20, 2019

This method has worked perfectly for me over the past year

  1. https://grahamgilbert.com/blog/2018/03/14/google-chrome-update-notifications-with-yo/
  2. https://github.com/grahamgilbert/chrome_update_notifier

Forum|alt.badge.img+8
  • Valued Contributor
  • 120 replies
  • June 20, 2019

@Dr_Jones You mean in terms of Notifications correct not a script for updating and keeping It's self updated.


mostlymac
Forum|alt.badge.img+5
  • New Contributor
  • 2 replies
  • July 16, 2019

@rqomsiya I'm getting that same error. Did you ever find a solution?


rqomsiya
Forum|alt.badge.img+12
  • Honored Contributor
  • 225 replies
  • July 16, 2019

@millssa4 I just completely uninstalled Chrome and re-installed then applied the script as a post flight script.


Forum|alt.badge.img+8
  • Valued Contributor
  • 120 replies
  • July 18, 2019

@ryan.ball Sorry to bother with this again but I have a question. I been using your script and it was working very well however today I noticed that even though I am getting:

Script exit code: 0
Script result: Keystone installed
Registered Chrome with Keystone

It will not update the latest version now that is 75.0.3770.142 if I try to manually do it I get the following:

KSInstallAction install script failure. Exit code: 12. Standard error output: "goobspatch: old hash mismatch: 393008d2729f964aab6934b31481b8a2e253ab7b != 5c333879450103300e0ca50c73676b2dd9acac13
dirpatcher.sh: couldn't create /Applications/Google Chrome.app/Contents/Frameworks/Google Chrome Framework.framework/Versions/75.0.3770.142/Google Chrome Framework by applying /tmp/KSInstallAction.K76DdNHJfN/m/.patch/framework_75.0.3770.100_75.0.3770.142.dirpatch/Google Chrome Framework$gbs to /Applications/Google Chrome.app/Contents/Frameworks/Google Chrome Framework.framework/Versions/75.0.3770.100/Google Chrome Framework
.keystone_install: dirpatcher of versioned directory failed, status 13
".

Same situation as @rqomsiya

Did Google change something yet again or is it just a script adjustment?


Forum|alt.badge.img+18
  • Contributor
  • 475 replies
  • July 18, 2019

Are you using the version from my github?


Forum|alt.badge.img+18
  • Contributor
  • 475 replies
  • July 18, 2019

Also, are you going to the Chrome > About menu and trying to see if it is able to be updated?


Forum|alt.badge.img+8
  • Valued Contributor
  • 120 replies
  • July 18, 2019

@ryan.ball

Are you using the version from my github?

Yes sir the one and the same, been working amazing until now.

So that error is directly from the about page when "Manually" trying to update Chrome.

KSInstallAction install script failure. Exit code: 12. Standard error output: "goobspatch: old hash mismatch: 393008d2729f964aab6934b31481b8a2e253ab7b != 5c333879450103300e0ca50c73676b2dd9acac13 dirpatcher.sh: couldn't create /Applications/Google Chrome.app/Contents/Frameworks/Google Chrome Framework.framework/Versions/75.0.3770.142/Google Chrome Framework by applying /tmp/KSInstallAction.K76DdNHJfN/m/.patch/framework_75.0.3770.100_75.0.3770.142.dirpatch/Google Chrome Framework$gbs to /Applications/Google Chrome.app/Contents/Frameworks/Google Chrome Framework.framework/Versions/75.0.3770.100/Google Chrome Framework .keystone_install: dirpatcher of versioned directory failed, status 13 ".

@ryan.ball could it be that your variable $chromeMajorVersion -ge 75 now needs a bit of tweaking as I feel since the major release has not been made and the only thing changed was was decimal value from .100 to .142 the script is still grabbing .100 even though your operator clearly states "greater than or equal" again not really sure if that's what is happening just a theory. Much like, @sdagley stated earlier. What do you think @ryan.ball?


Forum|alt.badge.img+18
  • Contributor
  • 475 replies
  • July 22, 2019

I think it was due to the running of the preflight/postflights in the script on my Github. I've removed them and it seems to update normally now. You might have to remove/re-install Chrome to test this for functionality.


Forum|alt.badge.img+8
  • Valued Contributor
  • 120 replies
  • July 22, 2019

@ryan.ball I hate to ask man, but do you happen to have a uninstaller script that I might be able to use I been reading several articles on how to script it but it seems like there are various locations I might have to script in


sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • 3540 replies
  • July 22, 2019

@CorpIT_eB To remove Chrome just do this via an Execute Command line in a Files and Processes payload:
rm -rf "/Applications/Google Chrome.app"


Forum|alt.badge.img+8
  • Valued Contributor
  • 120 replies
  • July 22, 2019

@sdagley Thanks, i had tried that and it was not working on my earlier testing but I didn't add the -rf switch to it nor was I adding it to the Files and Processes I'll give this a try.

Thanks Again.


sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • 3540 replies
  • July 22, 2019

@CorpIT_eB Application bundles are just directories. You can't simply do an rm on a directory if it isn't empty. The -rf means recursively delete anything in the path /Applications/Google Chrome.app without prompting, so anything in the directory is first removed then the directory itself.


Forum|alt.badge.img+3
  • New Contributor
  • 4 replies
  • July 22, 2019

Hi, I saw this KSInstallAction error as well this morning when testing out our deployment, the Chrome package was minor version 100 going to 142. I had a non-imaged computer with minor 100 on it, but the python script was not executed on it (it was not DEP deployed and still prompted to set up auto updates). When I manually entered the admin password and enabled the updates, tried to manually update Chrome and got the exact same error. There is a chance this is a Chrome / Google issue. I will investigate more about this...


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings