Compare commits
No commits in common. "build" and "fedora" have entirely different histories.
5 changed files with 99 additions and 66 deletions
13
.drone.yml
13
.drone.yml
|
@ -3,15 +3,20 @@ type: docker
|
||||||
name: default
|
name: default
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Build <PLACEHOLDER>
|
- name: Build wluma fedora package
|
||||||
image: debian
|
image: fedora
|
||||||
commands:
|
commands:
|
||||||
- '/drone/src/compilation.sh'
|
- '/drone/src/run.sh'
|
||||||
volumes:
|
volumes:
|
||||||
- name: program-archives
|
- name: program-archives
|
||||||
path: /compiled
|
path: /compiled
|
||||||
|
- name: fedora-repo
|
||||||
|
path: /repo
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: program-archives
|
- name: program-archives
|
||||||
host:
|
host:
|
||||||
path: /mnt/user/files/repos/archives
|
path: /mnt/user/files/repos/archives/
|
||||||
|
- name: fedora-repo
|
||||||
|
host:
|
||||||
|
path: /mnt/user/files/repos/fedora/x86_64/
|
||||||
|
|
18
README.md
18
README.md
|
@ -1,17 +1 @@
|
||||||
# [Placeholder](https://github.com/PLACEHOLDER_AUTHOR/PLACEHOLDER_REPO) (build)
|
# [wluma](https://github.com/maximbaz/wluma) (fedora)
|
||||||
|
|
||||||
```
|
|
||||||
.
|
|
||||||
├── 99-filename (/etc/udev/rules.d/)
|
|
||||||
└── filename.service (/usr/lib/systemd/user/)
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
Install deps:
|
|
||||||
|
|
||||||
- libc
|
|
||||||
|
|
||||||
Build deps:
|
|
||||||
|
|
||||||
- gcc
|
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
program_name="<PLACEHOLDER>"
|
|
||||||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
|
||||||
|
|
||||||
### prep
|
|
||||||
workdir=$(mktemp -d)
|
|
||||||
built_dir=${COMPILED_DIR:-/compiled}/$program_name
|
|
||||||
mkdir -p $built_dir
|
|
||||||
apt update && apt install curl jq -y
|
|
||||||
|
|
||||||
### check whether it's up-to-date
|
|
||||||
version_file=$built_dir/version
|
|
||||||
touch $version_file
|
|
||||||
version=$(curl 'https://api.github.com/repos/<PLACEHOLDER_AUTHOR>/<PLACEHOLDER_REPO>/releases/latest' | jq '.tag_name' -r)
|
|
||||||
if grep -q $version $version_file; then
|
|
||||||
echo "already up to date, exiting"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
### get source and build
|
|
||||||
# get build deps
|
|
||||||
apt install <PLACEHOLDER >-y # zstd is for archive creation
|
|
||||||
|
|
||||||
cd $workdir
|
|
||||||
curl -L $(curl 'https://api.github.com/repos/<PLACEHOLDER_AUTHOR>/<PLACEHOLDER_REPO>/releases/latest' | jq '.tarball_url' -r) -o $program_name-$version.tar.gz
|
|
||||||
tar -xzf $program_name-$version.tar.gz
|
|
||||||
src_dir=$(find $(pwd) -name "maximbaz-wluma*")
|
|
||||||
cd $src_dir
|
|
||||||
cargo install --path .
|
|
||||||
|
|
||||||
### create .tar.zst archive
|
|
||||||
# prep
|
|
||||||
cd $src_dir
|
|
||||||
$archive_dir=$(mktemp -d)
|
|
||||||
cp $(which wluma) $archive_dir
|
|
||||||
cp <PLACEHOLDER >$archive_dir
|
|
||||||
|
|
||||||
# actually create it and finish up
|
|
||||||
cd $archive_dir
|
|
||||||
tar --zstd -cf $built_dir/$program_name.tar.zst .
|
|
||||||
echo $version >$version_file
|
|
||||||
|
|
||||||
echo "$program_name updated to $version"
|
|
43
run.sh
Executable file
43
run.sh
Executable file
|
@ -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)"
|
46
wluma.spec
Normal file
46
wluma.spec
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
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
|
||||||
|
mkdir ./wluma
|
||||||
|
cd ./wluma/
|
||||||
|
tar --zstd -xf ${COMPILED_DIR:-/compiled}/wluma/wluma.tar.zst
|
||||||
|
|
||||||
|
%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}%{_datadir}/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 <rpm@askiiart.net>
|
||||||
|
- Initial version
|
Loading…
Add table
Add a link
Reference in a new issue