Skip to content

Instantly share code, notes, and snippets.

@vgrsec
Forked from andrepearce/chromium_update.sh
Last active July 10, 2023 03:37
Show Gist options
  • Save vgrsec/c14bd151fab9ecfeda5b3192d32c9026 to your computer and use it in GitHub Desktop.
Save vgrsec/c14bd151fab9ecfeda5b3192d32c9026 to your computer and use it in GitHub Desktop.
Auto Update Chromium on OSX
#!/bin/sh -ex
# Chromium update script
# - forked from Superbil/chromium_update.sh
# - forked from andrepearce/chromium_update.sh
# - Updated by vgrsec
# - Updated to use curl from wget due to built in curl support in 13.4
# - Updated to download ARM build
OS=mac_arm
DL_URL=https://download-chromium.appspot.com/dl/${OS}?type=snapshots
INSTALL_DIR=/Applications
TMP_DIR="/tmp/update-chrome-$RANDOM"
TMP_File=chromium.zip
(
mkdir $TMP_DIR ; cd $TMP_DIR
echo Download...
curl -L ${DL_URL} > ${TMP_File}
if [ $? -ne 0 ] ; then
echo Cannot update.
exit 1
fi
echo Unzip...
unzip -qq ${TMP_File}
echo Copying...
rm -rf "${INSTALL_DIR}/Chromium.app"
mv chrome-mac/Chromium.app "$INSTALL_DIR"
)
rm -rf $TMP_DIR
echo Done...
echo Writing API Keys...
mv ${INSTALL_DIR}/Chromium.app/Contents/MacOS/Chromium ${INSTALL_DIR}/Chromium.app/Contents/MacOS/Chromium_bin
cat > ${INSTALL_DIR}/Chromium.app/Contents/MacOS/Chromium << EOF
#!/bin/bash
export GOOGLE_API_KEY="" # Enter Google API Key
export GOOGLE_DEFAULT_CLIENT_ID="" # Enter Google Client ID
export GOOGLE_DEFAULT_CLIENT_SECRET="" # Enter Google Client Secret
${INSTALL_DIR}/Chromium.app/Contents/MacOS/Chromium_bin
EOF
chmod +x ${INSTALL_DIR}/Chromium.app/Contents/MacOS/Chromium
echo API Keys Written...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.user.chromiumupdater</string>
<key>Program</key>
<string>/usr/local/bin/chromium_update.sh</string>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>12</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/var/log/chromium_update.err</string>
<key>StandardOutPath</key>
<string>/var/log/chromium_update.out</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment