Google Chrome and Automatic Updates - How to configure automatically/disable?

502 views
Skip to first unread message

Heimdall

unread,
Mar 7, 2016, 5:26:05 PM3/7/16
to munki-dev
Hello,

I thought I would just start a new email listing/thread, away from the old one that last was updated 4 years ago. 

I am trying to push Google Chrome to our users, and I want to either enable or disable the "Set Up Automatic Updates for All Users" option.

I want to automate this via a command line script that is run either before or after software install. 

I found a python script which can be found here, however, I can't get that to work properly (as in I see no expected result), and I tried several other scripts listed here, with aklso no expected result. Chrome still attempts to search for updates, and offers the end-user the change to update. While my expected result is to either not search for updates, or go ahead and automatically update the software.

So I was wondering if there was a way to automate that, so I don't have to (or any other system admin) on every machine, or completely disable the auto-update check and manually push updates through Munki.

Thanks!


Gregory Neagle

unread,
Mar 7, 2016, 6:42:15 PM3/7/16
to munk...@googlegroups.com
Don’t do it manually! Use AutoPkg!


You can automate the import of lots and lots of software into your Munki repo and make it extremely easy to always have the latest version of Chrome available from (and installed by) Munki.


Thanks!

Gerd Niemetz

unread,
Mar 8, 2016, 8:41:53 AM3/8/16
to munki-dev
Hi!

What i do is that the download is done via AutoPKG and the packaging via Composer. There i use a postinstall/postupgrade script which does (maybe this could also be done through munki as a install script)
- disable the Google Update checker
- nuke the Google Updater in Applications
- create a First Run in the user templates
- nuke the Google Updater for existing users
- create a First Run for existing users
- create a Google Chrome Master Preference with the adequate values (you should modify them for your needs)

So when you look at the Chrome help the updater shows an error 10 and cannot update anymore, also some first run dialogs doesn't come up

HTH, 
best regards
Gerd 

######### Start of script ######### 
#!/usr/bin/env bash
## postinstall

pathToScript=$0
pathToPackage=$1
targetLocation=$2
targetVolume=$3
# adjust Chrome Version
ChromeVersion="49.0.2623.75"
LibraryDir="Library"
GoogleDir="Google"
ChromeDir="Chrome"
FirstRunFile="First Run"
ApplicationSupportDir="Application Support"
UserTemplateBasePath="/System/${LibraryDir}/User Template"
GoogleChromeMasterPreferencesFile="Google Chrome Master Preferences"
UserBasePath="/Users"
UserDirs=( $( (cd "${UserBasePath}" && find * -type d -maxdepth 0 \( -iname guest* -o -iname shared \) -prune -o -type d -print) ) )
Nul=/dev/null

# disable Google Updater check interval
defaults write com.google.Keystone.Agent checkInterval 0 >${Nul} 2>&1

# delete Google Updater
ksinstallCmdFQFN="/Applications/Google\ Chrome.app/Contents/Versions/${ChromeVersion}/Google\ Chrome\ Framework.framework/Frameworks/KeystoneRegistration.framework/Resources/ksinstall"
if [[ -x "${ksinstallCmdFQFN}" ]]; then
  RClog="$(${ksinstallCmdFQFN} --nuke 2>&1)"
  RC=${?}
  if [[ ${RC} -ne 0 ]]; then
    echo "ERROR: System ksinstall failed, RC=${RC}, Log=${RClog}"
    exit 1
  fi
fi

# create First Run for new users
for UserTemplate in "${UserTemplateBasePath}"/*; do
  ChromeUserTemplateDir="${UserTemplate}/${ApplicationSupportDir}/${GoogleDir}/${ChromeDir}"
  RClog="$(mkdir -p "${ChromeUserTemplateDir}" 2>&1)"
  RC=${?}
  if [[ ${RC} -eq 0 ]]; then
    FirstRunFQFN="${ChromeUserTemplateDir}/${FirstRunFile}"
    RClog="$(touch "${FirstRunFQFN}" 2>&1)"
    RC=${?}
    if [[ ${RC} -ne 0 ]]; then
      echo "ERROR: System touch ${FirstRunFQFN} failed, RC=${RC}, Log=${RClog}"
      exit 1
    fi
  else
    echo "ERROR: System mkdir ${ChromeUserTemplateDir} failed, RC=${RC}, Log=${RClog}"
    exit 1
  fi
done

# delete Google Updater and create First Run for existing users
for UserDir in "${UserDirs[@]}"; do
  eval $(dscl . read "${UserBasePath}/${UserDir}" UniqueID PrimaryGroupID 2>${Nul} | awk 'BEGIN { FS=": " } /^UniqueID:/ { printf("User%s=%s; ", $1, $2) } /^PrimaryGroupID:/ { printf("User%s=%s; ", $1, $2) }')
  if [[ ! -z "${UserUniqueID}" && ! -z "${UserPrimaryGroupID}" ]]; then
    UserLibraryDir="${UserBasePath}/${UserDir}/${LibraryDir}"
    GoogleBasePath="${UserLibraryDir}/${GoogleDir}"
    GoogleSoftwareUpdateDir="${GoogleBasePath}/GoogleSoftwareUpdate"
    if [[ -e "${GoogleSoftwareUpdateDir}" ]]; then
      ksinstallCmdFQFN="${GoogleSoftwareUpdateDir}/GoogleSoftwareUpdate.bundle/Contents/Resources/ksinstall"
      if [[ -f "${ksinstallCmdFQFN}" ]]; then
        RClog="$(${ksinstallCmdFQFN} --nuke 2>&1)"
        RC=${?}
        if [[ ${RC} -ne 0 ]]; then
          echo "ERROR: User ksinstall failed, RC=${RC}, Log=${RClog}"
          exit 1
        fi
      fi
    fi
    if [[ ! -d "${GoogleBasePath}" ]]; then
      RClog="$(mkdir -p "${GoogleBasePath}" 2>&1)"
      RC=${?}
      if [[ ${RC} -ne 0 ]]; then
        echo "ERROR: User mkdir ${GoogleBasePath} failed, RC=${RC}, Log=${RClog}"
        exit 1
      fi
    fi
    rm -rf "${GoogleSoftwareUpdateDir}" 2>${Nul}
    RClog="$(touch "${GoogleSoftwareUpdateDir}" 2>&1)"
    RC=${?}
    if [[ ${RC} -eq 0 ]]; then
      RClog="$(chown ${UserUniqueID}:${UserPrimaryGroupID} "${GoogleSoftwareUpdateDir}")"
      RC=${?}
      if [[ ${RC} -ne 0 ]]; then
        echo "ERROR: User chown ${GoogleSoftwareUpdateDir} failed, RC=${RC}, Log=${RClog}"
        exit 1
      fi
    else
      echo "ERROR: User touch ${GoogleSoftwareUpdateDir} failed, RC=${RC}, Log=${RClog}"
      exit 1
    fi
    
    FirstRunBaseDir="${UserLibraryDir}/${ApplicationSupportDir}/${GoogleDir}"
    FirstRunDir="${FirstRunBaseDir}/${ChromeDir}"
    FirstRunFQFN="${FirstRunDir}/${FirstRunFile}"
    if [[ ! -d "${FirstRunDir}" ]]; then
      RClog="$(mkdir -p "${FirstRunDir}" 2>&1)"
      RC=${?}
      if [[ ${RC} -ne 0 ]]; then
        echo "ERROR: User mkdir ${FirstRunDir} failed, RC=${RC}, Log=${RClog}"
        exit 1
      fi
    fi
    RClog="$(touch "${FirstRunFQFN}" 2>&1)"
    RC=${?}
    if [[ ${RC} -eq 0 ]]; then
      RClog="$(chown -R ${UserUniqueID}:${UserPrimaryGroupID} "${FirstRunBaseDir}")"
      RC=${?}
      if [[ ${RC} -eq 0 ]]; then
        RClog="$(chmod 600 ${FirstRunFQFN})"
        RC=${?}
        if [[ ${RC} -ne 0 ]]; then
          echo "ERROR: User chown -R ${FirstRunBaseDir} failed, RC=${RC}, Log=${RClog}"
          exit 1
        fi
      else
        echo "ERROR: User chown ${FirstRunFQFN} failed, RC=${RC}, Log=${RClog}"
        exit 1
      fi
    else
      echo "ERROR: User touch ${FirstRunFQFN} failed, RC=${RC}, Log=${RClog}"
      exit 1
    fi
  fi
done

# create the Google Chrome Master Preferences
GoogleBasePath="/${LibraryDir}/${GoogleDir}"
GoogleChromeMasterPreferencesFQFN="${GoogleBasePath}/${GoogleChromeMasterPreferencesFile}"
if [[ ! -d ${GoogleBasePath} ]]; then
  RClog="$(mkdir ${GoogleBasePath} 2>&1)"
  RC=${?}
  if [[ ${RC} -ne 0 ]]; then
    echo "ERROR: mkdir ${GoogleBasePath} failed, RC=${RC}, Log=${RClog}"
    exit 1
  fi
fi

cat >"${GoogleChromeMasterPreferencesFQFN}" 2>${Nul} <<EOF
{
"enable_do_not_track": true,
"bookmark_bar": {
"show_on_all_tabs": true
},
"browser": {
"check_default_browser": false,
"show_home_button": true
},
"distribution": {
"auto_launch_chrome": false,
"chrome": true,
"do_not_launch_chrome": true,
"do_not_register_for_update_launch": true,
"make_chrome_default": false,
"make_chrome_default_for_user": false,
"multi_install": true,
"import_bookmarks": false,
"import_bookmarks_from_file": "",
"import_home_page": false,
"import_search_engine": false,
"oem_bubble": false,
"require_eula": false,
"show_welcome_page": false,
"skip_first_run_ui": true,
"suppress_first_run_bubble": true,
"suppress_first_run_default_browser_prompt": true,
"system_level": true,
"verbose_logging": false
},
"first_run_tabs": [
],
"homepage_is_newtabpage": false,
"session": {
"restore_on_startup": 4,
"urls_to_restore_on_startup": [ "https://www.google.com/ig" ]
},
"sync_promo": {
"show_on_first_run_allowed": false,
"user_skipped": true
}
}
EOF
RC=${?}
if [[ ${RC} -eq 0 ]]; then
  RClog="$(chown -R root:wheel "${GoogleBasePath}" 2>&1)"
  RC=${?}
  if [[ ${RC} -eq 0 ]]; then
    RClog="$(chmod -R 755 "${GoogleBasePath}" 2>&1)"
    RC=${?}
    if [[ ${RC} -ne 0 ]]; then
      echo "ERROR: chmod ${GoogleBasePath} failed, RC=${RC}, Log=${RClog}"
      exit 1
    fi
  else
    echo "ERROR: chown ${GoogleBasePath} failed, RC=${RC}, Log=${RClog}"
    exit 1
  fi
else
  echo "ERROR: Could not write ${GoogleChromeMasterPreferencesFQFN}, RC=${RC}"
  exit 1
fi

exit 0 ## Success
exit 1 ## Failure
######### End of script ######### 

Joaquín

unread,
Mar 8, 2016, 1:14:30 PM3/8/16
to munk...@googlegroups.com
You can override the recipe: https://github.com/autopkg/autopkg/wiki/Recipe-Overrides

There is a an Autopkg JSS importer: https://github.com/sheagcraig/JSSImporter

--
Find related discussion groups here:
https://github.com/munki/munki/wiki/Discussion-Group
---
You received this message because you are subscribed to the Google Groups "munki-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to munki-dev+...@googlegroups.com.
To post to this group, send email to munk...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages