Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
get latest version of installed ungoogled chromium extensions
#!/usr/bin/env bash
# dependencies:
# https://www.npmjs.com/package/chrome-web-store-item-property-cli
# https://stedolan.github.io/jq/
# curl
# configure these:
EXTENSIONS_DIR="/path/to/Chromium/Profile/Extensions" ## e.g. on macos ~/Library/Application Support/Chromium/Profile 1/Extensions
DOWNLOAD_DIR="/path/to/where/you/want/latest/extensions"
######################################################################################
CURDIR=`pwd`
cd $DOWNLOAD_DIR
for f in "$EXTENSIONS_DIR"/*; do
ID=${f##*/}
JSON=$(chrome-web-store-item-property $ID)
NAME=$(echo $JSON | jq -r '.name')
VERSION=$(echo $JSON | jq -r '.version')
URL="https://clients2.google.com/service/update2/crx?response=redirect&prodversion=48.0&x=id%3D$ID%26installsource%3Dondemand%26uc"
curl -s -L "$URL" > "$NAME-$VERSION.crx"
done
cd "$CURDIR"
@Birch-san

This comment has been minimized.

Copy link

Birch-san commented May 30, 2018

Here's how to fill in prodversion:

CHROMVER=$(/usr/libexec/PlistBuddy -c 'print CFBundleShortVersionString' /Applications/Chromium.app/Contents/Info.plist)
MAJVER=$(awk -F. '{printf "%d.%d",$1,$2}' <<< "$CHROMVER")
@Birch-san

This comment has been minimized.

Copy link

Birch-san commented May 30, 2018

Here's a new version which automatically compares your installed versions with remote versions, and downloads only newer extensions.

https://gist.github.com/Birch-san/a0d64dd9fd04ea2252eb362fcd3fc0e2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.