Last active
June 29, 2023 13:22
-
-
Save matheusfillipe/ce8ded0eb1e3b650411a319657d069ff to your computer and use it in GitHub Desktop.
Update AUR packages automatically
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
#!/bin/bash | |
set -e | |
git pull | |
ver=$(git describe --tags --abbrev=0 | sed 's/-/_/g') | |
echo "Version is $ver" | |
update () { | |
sed -i "s/^pkgver.\+\$/pkgver=$ver/g" PKGBUILD | |
git remote set-url origin "$(git remote get-url origin | sed 's#^https://#ssh://aur@#')" | |
git clean -fdx | |
checksums=$(makepkg -g) | |
# split checksums but line breaks | |
checksum_lines=(${checksums//\n/ }) | |
# loop over them and replace the matching lines of PKGBUILD | |
for line in "${checksum_lines[@]}"; do | |
| var_value=(${line//=/ }) | |
| type=${var_value[0]} | |
| # Replace line with $type with $line | |
| sed -i "s/^$type.\+\$/$line/g" PKGBUILD | |
done | |
makepkg --printsrcinfo > .SRCINFO | |
git commit -am "Update to $ver" || true | |
git push origin master || true | |
} | |
dir=$(pwd) | |
# Loop over folders of aur/ | |
for repo in aur/* | |
do | |
cd "$repo" | |
echo "Processing $repo" | |
update | |
cd "$dir" | |
echo $(pwd) | |
echo "------------------------------------------------" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment