How to update Chrome automatically

LewisLebentz
New Contributor II

I have just written a blog post on how to automatically update Google Chrome using Jamf if anyone is interested. You can find my blog post here:

https://lew.im/2017/03/auto-update-chrome/

I have seen a few different methods posted here, but most require some admin intervention (uploading new packages, changing version numbers etc.) but this method is fully automated. Create the Extension Attribute, Smart Group and Policy and you're good to go! Every time Google release a new version of Chrome, this script will automatically grab it and install it on your Macs.

132 REPLIES 132

ryan_ball
Valued Contributor

@msw-sa and @ekrizon I have a PR in with hjuutilainen that will fix it.

See my fork here:
https://github.com/ryangball/adminscripts/blob/master/chrome-enable-autoupdates.py

I would only use mine temporarily, as he might merge my changes into his.

ryan_ball
Valued Contributor

Okay my changes are merged into the original and I've deleted my fork, so the updated script that will work for versions above and below Chrome 75 is here:
https://github.com/hjuutilainen/adminscripts/blob/master/chrome-enable-autoupdates.py

msw
Contributor

huge thanks @ryan.ball — much appreciated! i've confirmed this script works in my environment.

CorpIT_eB
Contributor II

Hello Jamf Nation,

I am getting the following Error when Google try's to update:

Script result: /Library/Application Support/JAMF/tmp/Update Google Chrome: line 15: /Applications/Google Chrome.app/Contents/Versions/75.0.3770.80/Google Chrome Framework.framework/Frameworks/KeystoneRegistration.framework/Resources/ksinstall: No such file or directory

Does anyone know if Google has changed anything on there end?

#!/bin/sh
#specify a custom path in parameter $4 or just take the default
appPath="${4:-/Applications/Google Chrome.app}"

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

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

"${appPath}/Contents/Versions/${appVersion}/Google Chrome Framework.framework/Versions/A/Resources/keystone_promote_preflight.sh" 2>/dev/null 1>&2
"${appPath}/Contents/Versions/${appVersion}/Google Chrome Framework.framework/Frameworks/KeystoneRegistration.framework/Resources/ksinstall" --install "${appPath}/Contents/Versions/${appVersion}/Google Chrome Framework.framework/Frameworks/KeystoneRegistration.framework/Resources/Keystone.tbz" --force
/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"
"${appPath}/Contents/Versions/${appVersion}/Google Chrome Framework.framework/Versions/A/Resources/keystone_promote_postflight.sh" "${appPath}" 2>/dev/null 1>&2

This was working and updating Google flawlessly till today.

sdagley
Esteemed Contributor II

@CorpIT_eB It does appear Google has borked something with version 75.0.3770.80. The script is using the version number in the path to call ksinstall, but on my Mac if I look in /Applications/Google Chrome/Contents/Versions/ there is no directory named 75.0.3770.80, just one named 74.0.3729.169.

CorpIT_eB
Contributor II

@sdagley Lovely!

Let't see how else I can fix this now, with Catalina around the corner I don't want to start adding Python scripts in the mix.

Keep in mind I install using another policy with this:

dmgfile="googlechrome.dmg"
volname="Google Chrome"
logfile="/Library/Logs/GoogleChromeInstallScript.log"

url='https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg'

# Are we running on Intel?
if [ '`/usr/bin/uname -p`'="i386" -o '`/usr/bin/uname -p`'="x86_64" ]; then
        /bin/echo "--" >> ${logfile}
        /bin/echo "`date`: Downloading latest version." >> ${logfile}
        /usr/bin/curl -s -o /tmp/${dmgfile} ${url}
        /bin/echo "`date`: Mounting installer disk image." >> ${logfile}
        /usr/bin/hdiutil attach /tmp/${dmgfile} -nobrowse -quiet
        /bin/echo "`date`: Installing..." >> ${logfile}
        ditto -rsrc "/Volumes/${volname}/Google Chrome.app" "/Applications/Google Chrome.app"
        /bin/sleep 10
        /bin/echo "`date`: Unmounting installer disk image." >> ${logfile}
        /usr/bin/hdiutil detach $(/bin/df | /usr/bin/grep "${volname}" | awk '{print $1}') -quiet
        /bin/sleep 10
        /bin/echo "`date`: Deleting disk image." >> ${logfile}
        /bin/rm /tmp/"${dmgfile}"
else
    /bin/echo "`date`: ERROR: This script is for Intel Macs only." >> ${logfile}
fi

exit 0

msw
Contributor

@CorpIT_eB all of the items that were in Google Chrome.app/Contents/Versions have been moved and the Versions folder is gone starting with version 75.

Let this section of the python script be your guide

def keystone_registration_framework_path():
    """Returns KeystoneRegistration.framework path"""
    if LooseVersion(chrome_version()) >= LooseVersion("75"):
        keystone_registration = os.path.join(chrome_path, 'Contents/Frameworks/')
        keystone_registration = os.path.join(keystone_registration, 'Google Chrome Framework.framework/Versions')
        keystone_registration = os.path.join(keystone_registration, chrome_version())
        keystone_registration = os.path.join(keystone_registration, 'Frameworks/KeystoneRegistration.framework')
    else:
        keystone_registration = os.path.join(chrome_path, 'Contents/Versions')
        keystone_registration = os.path.join(keystone_registration, chrome_version())
        keystone_registration = os.path.join(keystone_registration, 'Google Chrome Framework.framework')
        keystone_registration = os.path.join(keystone_registration, 'Frameworks/KeystoneRegistration.framework')
    return keystone_registration

The python version is nice, because it has loose version comparison, but you can easily compare versions with bash too. Do a defaults read to get the chrome major version from info.plist, and if 75+, use the path with the /Versions folder, if 74 or below, use the /Frameworks path.

It's Friday afternoon so don't feel like bashing this out myself, but I might do next week. Also, if you don't care about the script to enable auto-updates working on older versions of Chrome than the current one, you don't even need to add version logic, you can just use the Frameworks path instead of the Versions path.

CorpIT_eB
Contributor II

@msw-sa Just read your post, from yesterday. I might bother you again next week then. I want it to auto update for sure the first time so I don't have to relive updating it again, and trying to really move away from Python in light of Catalina. (Trying to future proof)

So if you wouldn't mind next week I can totally use the Assist. And I appreciate you in advance!

Thanks

sdagley
Esteemed Contributor II

@CorpIT_eB I took @msw-sa's explanation of the changes and updated @brunerd's script to accommodate Chrome 75 (here's hoping they don't change back):

#!/bin/bash
#Joel Bruner
#Updated by @sdagley for Chrome 75 changes based on comments by @msw-sa

appPath="${4:-/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"
else
    # Framework will be in ../Contents/Versions
    frameWorkPath="${appPath}/Contents/Versions/${appVersion}/Google Chrome Framework.framework/Frameworks/KeystoneRegistration.framework"
fi

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

"${frameWorkPath}/Versions/A/Resources/keystone_promote_preflight.sh" 2>/dev/null 1>&2
"${frameWorkPath}/Resources/ksinstall" --install "${frameWorkPath}/Resources/Keystone.tbz" --force
/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"
"${frameWorkPath}/Versions/A/Resources/keystone_promote_postflight.sh" "${appPath}" 2>/dev/null 1>&2

CorpIT_eB
Contributor II

@sdagley You're awesome!

I will give this a try and see how it works.

Thanks Again.

CorpIT_eB
Contributor II

@sdagley I got a 127.

Script exit code: 127
Script result: 2019-06-10 08:58:49.469 ksinstall[39014/0x11c7685c0] [lvl=3] -[KeystoneInstallBackend runImpersonatedLaunchControlWithCommand:asUser:inProcess:] Error impersonating 327506609/96 and running command stop com.google.keystone.user.agent: return code 3 (3: No such process).
    Standard output:


    Standard error:

2019-06-10 08:58:49.477 ksinstall[39014/0x11c7685c0] [lvl=3] -[KeystoneInstallBackend runImpersonatedLaunchControlWithCommand:asUser:inProcess:] Error impersonating 327506609/96 and running command stop com.google.keystone.user.xpcservice: return code 3 (3: No such process).
    Standard output:


    Standard error:


Error running script: return code was 127.

ryan_ball
Valued Contributor

This would find the largest framework.

frameWorkPath=$(find "$appPath" -name "KeystoneRegistration.framework" | sort | head -1)

CorpIT_eB
Contributor II

@ryan.ball What Variable would this code replace in the script?

    # Framework will be in ../Content/Frameworks
    frameWorkPath="${appPath}/Contents/Frameworks/Google Chrome Framework.framework/Versions/${appVersion}/Frameworks/KeystoneRegistration.framework"
else
    # Framework will be in ../Contents/Versions
    frameWorkPath="${appPath}/Contents/Versions/${appVersion}/Google Chrome Framework.framework/Frameworks/KeystoneRegistration.framework"

ryan_ball
Valued Contributor

Instead of this:

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"
else
    # Framework will be in ../Contents/Versions
    frameWorkPath="${appPath}/Contents/Versions/${appVersion}/Google Chrome Framework.framework/Frameworks/KeystoneRegistration.framework"
fi

You could do this:

frameWorkPath=$(find "$appPath" -name "KeystoneRegistration.framework" | sort | head -1)

CorpIT_eB
Contributor II

@ryan.ball

#!/bin/sh
appPath="${4:-/Applications/Google Chrome.app}"

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

appVersion=$(defaults read "${appPath}/Contents/Info.plist" CFBundleShortVersionString)
frameWorkPath=$(find "$appPath" -name "KeystoneRegistration.framework" | sort | head -1)

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

"${frameWorkPath}/Versions/A/Resources/keystone_promote_preflight.sh" 2>/dev/null 1>&2
"${frameWorkPath}/Resources/ksinstall" --install "${frameWorkPath}/Resources/Keystone.tbz" --force
/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"
"${frameWorkPath}/Versions/A/Resources/keystone_promote_postflight.sh" "${appPath}" 2>/dev/null 1>&2

That look about right?

ryan_ball
Valued Contributor

Yes. I don't know about the rest of the script's functionality, but that part should work.

CorpIT_eB
Contributor II

@ryan.ball Same 127 Error.
Script exit code: 127
Script result: 2019-06-10 09:46:11.924 ksinstall[42792/0x11881e5c0] [lvl=3] -[KeystoneInstallBackend runImpersonatedLaunchControlWithCommand:asUser:inProcess:] Error impersonating 327506609/96 and running command stop com.google.keystone.user.agent: return code 3 (3: No such process). Standard output:

Standard error:

2019-06-10 09:46:11.931 ksinstall[42792/0x11881e5c0] [lvl=3] -[KeystoneInstallBackend runImpersonatedLaunchControlWithCommand:asUser:inProcess:] Error impersonating 327506609/96 and running command stop com.google.keystone.user.xpcservice: return code 3 (3: No such process). Standard output:

Standard error:

Error running script: return code was 127.

@msw-sa Any ideas?

ryan_ball
Valued Contributor

Running it as root?

CorpIT_eB
Contributor II

@ryan.ball Should there be a sudo? or su somewhere I don't know about?

ryan_ball
Valued Contributor

"${frameWorkPath}/Versions/A/Resources/keystone_promote_preflight.sh" that does not seem to exist. Do you see that in the framework file?

ryan_ball
Valued Contributor

It has to run as root.
sudo bash script.sh

ryan_ball
Valued Contributor

It is here:
/Applications/Google Chrome.app/Contents/Frameworks/Google Chrome Framework.framework/Versions/75.0.3770.80/Resources/keystone_promote_preflight.sh

So instead of A, you need to put the version of the app.

CorpIT_eB
Contributor II

@ryan.ball I am a tool, can't believe I didn't see that let me fix that syntax and give it shot again.

Thank You,

CorpIT_eB
Contributor II

@ryan.ball

Script result: 2019-06-10 10:12:42.558 ksinstall[44903/0x1142db5c0] [lvl=3] -[KeystoneInstallBackend runImpersonatedLaunchControlWithCommand:asUser:inProcess:] Error impersonating 327506609/96 and running command stop com.google.keystone.user.agent: return code 3 (3: No such process). Standard output: Standard error:
2019-06-10 10:12:42.888 ksinstall[44903/0x1142db5c0] [lvl=3] -[KeystoneInstallBackend runImpersonatedLaunchControlWithCommand:asUser:inProcess:] Error impersonating 327506609/96 and running command stop com.google.keystone.user.xpcservice: return code 3 (3: No such process). Standard output: Standard error:

Same 127 Error mate.

sdagley
Esteemed Contributor II

@ryan.ball Nice trick with the find command but won't the variability with the # of digits in each node of the version number cause problems? Matching the path to the version number of the app bundle is less risky IMO.

kwiggins
New Contributor

I am very new to JAMF Pro and a lot of what you guys are discussing here is above my head, but I want to try it out. Unfortunately, because of the changes Google made in the product in the middle of the thread, I'm not sure after reading over this what will work and what doesn't. Would anyone be willing to summarize at this point what the approach should be today, post Chrome v. 75?

CorpIT_eB
Contributor II

@sdagley && @ryan.ball

Even though, I think "find" is much cleaner in terms of coding I am going to stick with @sdagley 's method the problem still lies that it wont Install because It can't seem to find a processes.

So no matter where it's pointing to it never executes. I am guessing Keystones.tbz as its the first --Install request.

ryan_ball
Valued Contributor

This worked for me. However, I did get a return code 3 twice, but it did enable auto updates.

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

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

appVersion=$(defaults read "${appPath}/Contents/Info.plist" CFBundleShortVersionString)
frameWorkPath=$(find "$appPath" -name "KeystoneRegistration.framework" | sort | head -1)
preflightPath=$(find "$appPath" -name keystone_promote_preflight.sh | sort | head -1)
postflightPath=$(find "$appPath" -name keystone_promote_postflight.sh | sort | head -1)

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

"$preflightPath" 2>/dev/null 1>&2
"${frameWorkPath}/Resources/ksinstall" --install "${frameWorkPath}/Resources/Keystone.tbz" --force
/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"
"$postflightPath" "${appPath}" 2>/dev/null 1>&2

kwiggins
New Contributor

@ryan.ball Are you creating the above as a Script and then running it based on your EA? Just trying to grasp what's going on here.

ryan_ball
Valued Contributor

Without the finds you'll also need to restructure the path where the preflight/postflight scripts are like so:

#!/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/Frameworks/KeystoneRegistration.framework"
    scriptsPath="${appPath}/Contents/Versions/${appVersion}/Google Chrome Framework.framework/Version/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
/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

CorpIT_eB
Contributor II

@ryan.ball If we can just figure out what that Code 3 error it's basically stoping the installation of the new version. And showing as "Failed" in JAMF.

Executing Policy Computer Check-in
Running script Update Google Chrome...
Script result: 2019-06-10 10:12:42.558 ksinstall[44903/0x1142db5c0] [lvl=3] -[KeystoneInstallBackend runImpersonatedLaunchControlWithCommand:asUser:inProcess:] Error impersonating 327506609/96 and running command stop com.google.keystone.user.agent: return code 3 (3: No such process). Standard output: Standard error:
2019-06-10 10:12:42.888 ksinstall[44903/0x1142db5c0] [lvl=3] -[KeystoneInstallBackend runImpersonatedLaunchControlWithCommand:asUser:inProcess:] Error impersonating 327506609/96 and running command stop com.google.keystone.user.xpcservice: return code 3 (3: No such process). Standard output: Standard error:
Script exit code: 127
Script result: 
Error running script: return code was 127.

ryan_ball
Valued Contributor

I've modified this a bit for easier reading. When I run this (even without suppressing errors on the ksinstall line) I did receive output, but the exit code on the ksinstall line was still 0, not 127. I've suppressed the error here, as that seems to be a false positive related to the --force command, as I receive no output if I leave off the --force from ksinstall.

#!/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/Frameworks/KeystoneRegistration.framework"
    scriptsPath="${appPath}/Contents/Versions/${appVersion}/Google Chrome Framework.framework/Version/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

CorpIT_eB
Contributor II

@ryan.ball

Thank You for this very clean, I am still getting 127 on some of my machines when I flush all the errors.

But did get a 0 when I ran it locally on my tester with JAMF Policy command.

Interesting situation we have here with Google Now.

ryan_ball
Valued Contributor

Can you check on your devices where it has failed the version of Chrome installed? Above or below 75?

CorpIT_eB
Contributor II

@ryan.ball These machines are one version below 75 same as my tester version 74.0.3729.169

The way it was before it would install Chrome, then later at Check-In it would run this script to check if it had an older version of chrome uninstall the older version and then install and the new one with automatic updates enabled.

I am wondering if the 127 may be due to the clients being open and in an actively working state on at the time of execution. I was not on my test machine.

CorpIT_eB
Contributor II

@ryan.ball I just double checked my tester machine and I was wrong it is currently on build 75.0.3370.80 hence why it gave code 0.

So code 127 is coming from the machines on the build prior: 74.0.3729.169 if that helps.

ryan_ball
Valued Contributor

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

kwiggins
New Contributor

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

CorpIT_eB
Contributor II

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

ryan_ball
Valued Contributor

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"