Skip to content

Instantly share code, notes, and snippets.

@wirtaw
Last active November 2, 2023 16:36
Show Gist options
  • Save wirtaw/6a6b4645843d6a9fdcaf610d213af10a to your computer and use it in GitHub Desktop.
Save wirtaw/6a6b4645843d6a9fdcaf610d213af10a to your computer and use it in GitHub Desktop.
Steps to write update Ungoogled Chrome browser one-command line
#!/bin/bash
# Get latest from releases https://github.com/ungoogled-software/ungoogled-chromium-portablelinux/releases/latest
api_endpoint="https://api.github.com/repos/ungoogled-software/ungoogled-chromium-portablelinux/releases/latest"
# Go to the temp folder
cd /tmp
# Send a GET request to the API endpoint and extract the download URL of the tar.xz archive
archive_url=$(curl -s $api_endpoint | jq -r ".assets[] | select(.content_type | test(\"application/x-xz\")) | .browser_download_url")
folder_name=$(curl -s $api_endpoint | jq -r ".assets[] | select(.content_type | test(\"application/x-xz\")) | .name")
filename_no_extension="${folder_name%.tar.xz}"
echo "$archive_url"
echo "$filename_no_extension"
# Download the latest Chromium source archive
wget "$archive_url" -P /tmp/ -O chromium.tar.xz
# Extract the Chromium source archive to created Chromium folder
tar -xJvf chromium.tar.xz -C /tmp
# Replace the existing Chromium app with the new one from tmp
cp -r "/tmp/${filename_no_extension}/*" /opt/chromium/
# Remove the old Chromium source archive
rm /tmp/chromium.tar.xz && rm -rf "/tmp/${filename_no_extension}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment