Last active
August 13, 2024 16:10
-
-
Save zrhoffman/14dc1ec210fe08c70b5c90986011655f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
set +o errexit +o nounset; | |
cd ~/.cache/yay; | |
format=%Y-%m-%d | |
date="$(date +"${format}")"; | |
declare -A package_dir_names; | |
package_dir_names[firefox-nightly]=firefox-nightly-bin; | |
for package in "${package_dir_names[@]}"; do | |
install_date="$(</var/log/pacman.log grep " \(installed\|reinstalled\|upgraded\) ${package} " | tail -n1 | sed 's/^\[\([^]]*\).*/\1/g')" | |
if [[ -z "$install_date" ]]; then | |
install_date="$(date +"${format}" -d '-1 day')" | |
else | |
install_date="$(date +"${format}" --date="$install_date")" | |
fi | |
if [[ "$install_date" != "$date" ]]; then | |
( | |
cd "$package"; | |
git checkout . | |
git pull | |
rm -f -- *.bz2{,.asc} *.gz *.xz *.zst *.part | |
yay -S --noconfirm "$package" || makepkg --install --noconfirm "$package" | |
) | |
fi; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment