Created
June 5, 2024 18:13
-
-
Save slhck/2e12f8f132ea54de423b36a272857876 to your computer and use it in GitHub Desktop.
Download latest chrome installer for Linux and rename
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Download latest chrome installer for Linux and rename | |
set -e | |
cd "$(dirname "$0")" || exit 1 | |
if ! command -v dpkg-deb &> /dev/null; then | |
echo "ERROR: dpkg-deb is not installed" | |
echo "Please install dpkg-deb and try again" | |
exit 1 | |
fi | |
rm -f google-chrome-stable_current_amd64.deb | |
# download latest chrome installer | |
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb | |
# check the version from inside the file | |
chromeVersion=$(dpkg-deb -I google-chrome-stable_current_amd64.deb | grep Version | cut -d ' ' -f 3) | |
if [ -z "$chromeVersion" ]; then | |
echo "ERROR: Could not determine the version of the downloaded file" | |
exit 1 | |
fi | |
# rename | |
mv -- google-chrome-stable_current_amd64.deb "google-chrome-stable_${chromeVersion}_amd64.deb" | |
echo "Downloaded and renamed to google-chrome-stable_${chromeVersion}_amd64.deb" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment