initial commit

This commit is contained in:
askiiart 2025-04-15 00:23:40 -05:00
commit dfcf3ed487
Signed by untrusted user who does not match committer: askiiart
GPG key ID: 6A32977DAF31746A
4 changed files with 99 additions and 0 deletions

22
.drone.yml Normal file
View file

@ -0,0 +1,22 @@
kind: pipeline
type: docker
name: default
steps:
- name: Build <PLACEHOLDER> fedora package
image: fedora
commands:
- '/drone/src/run.sh'
volumes:
- name: program-archives
path: /compiled
- name: fedora-repo
path: /repo
volumes:
- name: program-archives
host:
path: /mnt/user/files/repos/archives/
- name: fedora-repo
host:
path: /mnt/user/files/repos/fedora/x86_64/

33
PLACEHOLDER.spec Normal file
View file

@ -0,0 +1,33 @@
Name: <PLACEHOLDER>
Version: 1.1.1
Release: %autorelease
Summary: <PLACEHOLDER>
License: <PLACEHOLDER>
URL: <PLACEHOLDER>
BuildRequires: tar zstd
Requires: glibc
Recommends: dbus
%description
<PLACEHOLDER>
%prep
program_name="<PLACEHOLDER>"
mkdir ./$program_name
cd ./$program_name/
tar --zstd -xf ${COMPILED_DIR:-/compiled}/$program_name/$program_name.tar.zst
%install
program_name="<PLACEHOLDER>"
cd ./$program_name/
mkdir -p %{buildroot}%{_bindir}
cp ./<PLACEHOLDER> %{buildroot}%{_bindir}/
%files
%{_bindir}/<PLACEHOLDER>
%changelog
* Tue Apr 15 2025 askiiart <rpm@askiiart.net>
- Initial version

1
README.md Normal file
View file

@ -0,0 +1 @@
# [Placeholder](https://github.com/PLACEHOLDER_AUTHOR/PLACEHOLDER_REPO) (fedora)

43
run.sh Executable file
View 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)"