Skip to content

Instantly share code, notes, and snippets.

@charlmert
Last active April 13, 2024 07:05
Show Gist options
  • Save charlmert/0152174a26b6e9cb5b66161a172419fa to your computer and use it in GitHub Desktop.
Save charlmert/0152174a26b6e9cb5b66161a172419fa to your computer and use it in GitHub Desktop.
Script to download and install older versions of google chrome. -l to list numbers and then -d number example -d8 to download 89.0.4389.114-1
#~/bin/bash
usage() { echo "Usage: $0 [-d <number>] [-l]" 1>&2; exit 1; }
while getopts ":d:" o; do
case "${o}" in
d)
d=${OPTARG}
;;
esac
done
#shift $((OPTIND-1))
if [[ " $@ " =~ "-l " ]]; then
rm -f /tmp/chrome_versions.txt
rm -f /tmp/chrome_versions_actionable.txt
wget -O "/tmp/chrome_versions.txt" "https://snapshot.debian.org/package/chromium/"
cat /tmp/chrome_versions.txt | grep '<li><a href=' | awk -F '"' '{print $2}' | tr -d '/' | perl -ne 'print $.,"\: ", $_' >> /tmp/chrome_versions_actionable.txt
cat /tmp/chrome_versions_actionable.txt
elif [ ! -z "${d}" ]; then
rm -f /tmp/chrome_versions.txt
rm -f /tmp/chrome_versions_actionable.txt
wget -O "/tmp/chrome_versions.txt" "https://snapshot.debian.org/package/chromium/"
cat /tmp/chrome_versions.txt | grep '<li><a href=' | awk -F '"' '{print $2}' | tr -d '/' | perl -ne 'print $.,"\: ", $_' >> /tmp/chrome_versions_actionable.txt
version=`cat /tmp/chrome_versions_actionable.txt | grep -E "^${d}:" | sed 's/.*: //' | tr -d '\n'`
echo "wget https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_"$version"_amd64.deb"
wget "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_"$version"_amd64.deb"
sudo dpkg -i "google-chrome-stable_"$version"_amd64.deb"
else
usage
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment