Skip to content

Commit

Permalink
added chromeupdate function
Browse files Browse the repository at this point in the history
added a new shell function:
it checks if chrome is updated or not; if updated, it notifies that
chrome is up to date, else it asks for confirmation, if replied with Yy,
it goes to chrome aur repo, does a git pull, builds the chrome, and
finally installs it.
  • Loading branch information
Muhammad Abdullah Khabir committed Sep 19, 2023
1 parent cd54b9c commit 8471562
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions zsh/.zsh/functions
Original file line number Diff line number Diff line change
Expand Up @@ -1141,3 +1141,30 @@ apply () {
ffmpeg -i "$input_file" -r 20 -s 352x288 -vb 400k -acodec aac -strict experimental -ac 1 -ar 8000 -ab 24k "$output_file"

}

chromeupdate () {
# checks if google chrome is updated or not, if its not updated, it will ask
# me to update it
chrome_repo_path="$HOME/git/chrome"
current_chrome_version_installed="$(google-chrome-stable --version | awk '{print $3}')"
latest_chrome_version="$(curl -sSf https://dl.google.com/linux/chrome/deb/dists/stable/main/binary-amd64/Packages | grep -A1 "Package: google-chrome-stable" | awk '/Version/{print $2}' | cut -d '-' -f1)"

if [[ "$current_chrome_version_installed" = "$latest_chrome_version" ]]; then
echo "Your Chrome is up to date (Version $current_chrome_version_installed)"
else
echo "Your Chrome is outdated (Installed version: $current_chrome_version_installed, Latest version: $latest_chrome_version)"

read -p "Do you want to update Chrome? (y/n): " choice

case "$choice" in
[Yy]*)
echo "Updating Chrome..."
cd "$chrome_repo_path"
git pull && makepkg -sirc --noconfirm && notify-send "Chrome is updated successfully!"
;;
*)
echo "No update performed!"
;;
esac
fi
}

0 comments on commit 8471562

Please sign in to comment.