1
0
Fork 0
mirror of https://github.com/SinTan1729/random.git synced 2024-12-26 05:08:36 -06:00
random/update-aur-lure.sh

62 lines
1.5 KiB
Bash
Raw Normal View History

2023-05-29 20:04:37 -05:00
#!/bin/env bash
# This is a script to update packages on AUR and LURE
# after I publish them.
# Syntax: update-aur-lure.sh <package-name> <new-version>
# Exit the whole script when ctrl+c is pressed
set -e
2023-05-29 20:04:37 -05:00
if [ "$#" -ne 2 ]; then
echo "Invalid syntax!"
echo "Use the following syntax: update-aur-lure.sh <package-name> <new-version>"
2023-07-23 18:13:10 -05:00
exit -1
2023-05-29 20:04:37 -05:00
fi
2024-06-30 21:11:11 -05:00
# GITDIR env variable should be set for this to work
[ -z $GITDIR ] && exit -1
2023-05-29 20:04:37 -05:00
VERS="$2"
# Do the updates for AUR
echo "Updating AUR..."
2024-06-30 21:11:11 -05:00
cd "$GITDIR/AUR"
2023-05-29 20:04:37 -05:00
[ -d "$1" ] && PKG="$1" || PKG="$1-bin"
2024-10-22 18:43:52 -05:00
if [ -d "$1" ]; then # Skip if the directory is missing
cd "$PKG"
sed -i -E "s/pkgver=[0-9\.]+/pkgver=$VERS/" PKGBUILD
updpkgsums
makepkg --printsrcinfo >.SRCINFO
# Remove downloaded files
ls | grep -v PKGBUILD | xargs -r -I {} rm "{}"
git add .
git commit -m "Bumped $PKG version to $VERS"
git push
else
echo "AUR directory is missing. Skipping this step."
fi
2023-05-29 20:04:37 -05:00
# Update the GitHub backup repo as well
echo "Updating AUR backup repo..."
2024-06-30 21:11:11 -05:00
cd "$GITDIR/AUR Mirror GitHub/$PKG"
2023-07-25 01:51:56 -05:00
sed -i -E "s/pkgver=[0-9\.]+/pkgver=$VERS/" PKGBUILD
2023-05-29 20:04:37 -05:00
git add .
git commit -m "Bumped $PKG version to $VERS"
git push
# Do the updates for LURE
echo "Updating LURE repo..."
2024-06-30 21:11:11 -05:00
cd "$GITDIR/lure-repo"
2023-05-29 20:04:37 -05:00
[ -d "$1" ] && PKG="$1" || PKG="$1-bin"
2023-07-23 18:22:35 -05:00
cd "$PKG"
2023-07-25 01:51:56 -05:00
sed -i -E "s/version=[0-9\.]+/version=$VERS/" lure.sh
2023-05-29 20:04:37 -05:00
update-lure-checksums.py
# Remove downloaded files
2023-07-23 18:22:35 -05:00
ls | grep -v lure.sh | xargs -r -I {} rm "{}"
2023-05-29 20:04:37 -05:00
git add .
git commit -m "Bumped $PKG version to $VERS"
git push
echo "Done!"