fix path, put rpm in repo, and skip if already updated

This commit is contained in:
askiiart 2025-02-26 00:13:42 -06:00
parent d32a943e47
commit 8b3eba1d81
Signed by untrusted user who does not match committer: askiiart
GPG key ID: 6A32977DAF31746A
2 changed files with 14 additions and 4 deletions

16
run.sh
View file

@ -1,12 +1,19 @@
#!/usr/bin/env bash
set -euo pipefail
built_dir=${COMPILED_DIR:-/compiled}/polycat
version=$(cat $built_dir/version)
repo_dir=${REPO_DIR:-/repo}
# skip if already up-to-date
if $(ls polycat-* | grep -q "$version"); then
echo "package is already up to date, exiting"
exit
fi
# prep
dnf install fedora-packager rpmdevtools createrepo_c -y
rpmdev-setuptree
built_dir=${COMPILED_DIR:-/compiled}/polycat
version=$(cat $built_dir/version)
repo_dir=${REPO_DIR:-/repo}
# update spec file
sed -i "s/Version:.*/Version: $version/g" polycat.spec
@ -15,8 +22,9 @@ sed -i "s/CHANGELOG_MESSAGE_HERE/Update to $version/g" polycat.spec
sed -i "s/RPM_PACKAGER_NAME/$RPM_PACKAGER_NAME/g" polycat.spec
sed -i "s/RPM_PACKAGER_EMAIL/$RPM_PACKAGER_EMAIL/g" polycat.spec
# build package
# build package and move to the repo
rpmbuild -bb polycat.spec
mv ~/rpmbuild/RPMS/x86_64/polycat-$version-* $repo_dir/
# remove old versions
cd $repo_dir