initial commit
This commit is contained in:
commit
dfcf3ed487
4 changed files with 99 additions and 0 deletions
43
run.sh
Executable file
43
run.sh
Executable file
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
program_name="<PLACEHOLDER>"
|
||||
|
||||
built_dir=${COMPILED_DIR:-/compiled}/$program_name
|
||||
version=$(cat $built_dir/version)
|
||||
repo_dir=${REPO_DIR:-/repo}
|
||||
|
||||
# skip if already up-to-date
|
||||
# TODO: use the repo instead and check the version with dnf
|
||||
# yeah this is bad; see also the <PLACEHOLDER>-aaaaaa thing below
|
||||
touch $repo_dir/$program_name-tmp
|
||||
if $(ls $repo_dir/$program_name-* | grep -q "$version"); then
|
||||
rm $repo_dir/$program_name-tmp
|
||||
echo "package is already up to date, exiting"
|
||||
exit
|
||||
fi
|
||||
rm $repo_dir/$program_name-tmp
|
||||
|
||||
# prep
|
||||
dnf install fedora-packager rpmdevtools createrepo_c -y
|
||||
rpmdev-setuptree
|
||||
|
||||
sed -i "s/Version:.*/Version: $version/g" $program_name.spec
|
||||
|
||||
# build package and move to the repo
|
||||
rpmbuild -bb $program_name.spec
|
||||
mv ~/rpmbuild/RPMS/x86_64/$program_name-$version-* $repo_dir/
|
||||
|
||||
# remove old versions
|
||||
cd $repo_dir
|
||||
# this is the easiest way to make sure it doesn't just fail because no <PLACEHOLDER>-* exists
|
||||
# (which only happens on first run)
|
||||
touch $program_name-0.rpm
|
||||
rm $(ls $program_name-*.rpm | sort --version-sort | sed '$d')
|
||||
rm $program_name-0.rpm || true
|
||||
|
||||
# update repo
|
||||
createrepo_c .
|
||||
|
||||
cd $repo_dir
|
||||
echo "package is at $repo_dir/$(ls $program_name-*.rpm)"
|
Loading…
Add table
Add a link
Reference in a new issue