From bacfc6719c417028356a0408785d2b81807f244a Mon Sep 17 00:00:00 2001 From: askiiart Date: Tue, 25 Mar 2025 12:18:45 -0500 Subject: [PATCH] initial commit --- .drone.yml | 22 ++++++++++++++++++++++ README.md | 1 + run.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ wluma.spec | 44 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 110 insertions(+) create mode 100644 .drone.yml create mode 100644 README.md create mode 100755 run.sh create mode 100644 wluma.spec diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..70e6deb --- /dev/null +++ b/.drone.yml @@ -0,0 +1,22 @@ +kind: pipeline +type: docker +name: default + +steps: + - name: Build wluma 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/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..9103803 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# [wluma](https://github.com/maximbaz/wluma) (fedora) diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..b4d6659 --- /dev/null +++ b/run.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +set -euo pipefail + +program_name="wluma" + +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 wluma-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 wluma-* 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)" diff --git a/wluma.spec b/wluma.spec new file mode 100644 index 0000000..f568c99 --- /dev/null +++ b/wluma.spec @@ -0,0 +1,44 @@ +Name: wluma +Version: __PLACEHOLDER__ +Release: %autorelease +Summary: runcat module for polybar (or waybar) + +License: ISC +URL: https://github.com/maximbaz/wluma + +BuildRequires: tar zstd +Requires: glibc v4l-utils systemd-libs vulkan-loader +Recommends: dbus + +%description +Automatic brightness adjustment based on screen contents and ALS + +%prep +tar --zstd -xf ${COMPILED_DIR:-/compiled}/wluma/wluma.tar.zst --one-top-level + +%install +cd ./wluma/ +mkdir -p %{buildroot}%{_bindir} +cp ./wluma %{buildroot}%{_bindir}/ +mkdir -p %{buildroot}/usr/lib/systemd/user/ +cp ./wluma.service %{buildroot}/usr/lib/systemd/user/ +mkdir -p %{buildroot}/usr/lib/udev/rules.d/ +cp ./90-wluma-backlight.rules %{buildroot}/usr/lib/udev/rules.d/ +mkdir -p %{buildroot}%{_datadir}/wluma/examples/ +cp ./config.toml %{buildroot}/wluma/examples/ +mkdir -p %{buildroot}%{_docdir}/wluma +cp ./README.md %{buildroot}%{_docdir}/wluma/ +mkdir -p %{buildroot}%{_mandir}/man7 +cp ./wluma.7.gz %{buildroot}%{_mandir}/man7/ + +%files +%{_bindir}/wluma +/usr/lib/systemd/user/wluma.service +/usr/lib/udev/rules.d/90-wluma-backlight.rules +%{_datadir}/wluma/examples/config.toml +%{_docdir}/wluma/README.md +%{_mandir}/man7/wluma.7.gz + +%changelog +* Tue Mar 25 2025 askiiart +- Initial version \ No newline at end of file