From 76baa6a68e366430ab6cffc036612af903898b1b Mon Sep 17 00:00:00 2001 From: askiiart Date: Mon, 24 Mar 2025 13:12:26 -0500 Subject: [PATCH 01/17] initial commit --- .drone.yml | 17 +++++++++++++++++ README.md | 20 ++++++++++++++++++++ compilation.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 .drone.yml create mode 100644 README.md create mode 100644 compilation.sh diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..88acba7 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,17 @@ +kind: pipeline +type: docker +name: default + +steps: + - name: Build wluma + image: debian + commands: + - '/drone/src/compilation.sh' + volumes: + - name: program-archives + path: /compiled + +volumes: + - name: program-archives + host: + path: /mnt/user/files/repos/archives diff --git a/README.md b/README.md new file mode 100644 index 0000000..2a52521 --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +# [Wluma](https://github.com/maximbaz/wluma) (build) + +``` +. +├── wluma +└── wluma.service +``` + +--- + +Install deps: + +- v4l-utils + +Build deps: + +- libv4l-dev +- libudev-dev +- libvulkan-dev +- libdbus-1-dev diff --git a/compilation.sh b/compilation.sh new file mode 100644 index 0000000..5ecf053 --- /dev/null +++ b/compilation.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +set -euo pipefail + +program_name="librewolf-allow-dark" +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 +# also available via gitlab.com/librewolf-community/browser/source/-/raw/main/{version,release} +version=$(curl 'https://api.github.com/repos/maximbaz/wluma/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 +sudo apt-get -y install v4l-utils libv4l-dev libudev-dev libvulkan-dev libdbus-1-dev +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +. ~/.cargo/env + +cd $workdir +curl -L $(curl 'https://api.github.com/repos/maximbaz/wluma/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 +wluma_archive=$(mktemp -d) +cp $(which wluma) $wluma_archive +sed -i 's/\/usr\/bin\/wluma/\/usr\/bin\/env wluma/g' $src_dir/wluma.service +cp $src_dir/wluma.service $wluma_archive + From 0d247598ef30fe19de6b6dfdf7a7036b945cd091 Mon Sep 17 00:00:00 2001 From: askiiart Date: Mon, 24 Mar 2025 13:14:09 -0500 Subject: [PATCH 02/17] fix perms ofc --- compilation.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 compilation.sh diff --git a/compilation.sh b/compilation.sh old mode 100644 new mode 100755 From a0093468a88e7105cf115987d9abfea1bbf46918 Mon Sep 17 00:00:00 2001 From: askiiart Date: Mon, 24 Mar 2025 13:15:28 -0500 Subject: [PATCH 03/17] no sudo --- compilation.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compilation.sh b/compilation.sh index 5ecf053..b91e743 100755 --- a/compilation.sh +++ b/compilation.sh @@ -22,7 +22,7 @@ fi ## get source and build # get build deps -sudo apt-get -y install v4l-utils libv4l-dev libudev-dev libvulkan-dev libdbus-1-dev +apt install v4l-utils libv4l-dev libudev-dev libvulkan-dev libdbus-1-dev -y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y . ~/.cargo/env From cfe2b1c616b3c15bc9cebd89e04e80b846b3a8b3 Mon Sep 17 00:00:00 2001 From: askiiart Date: Mon, 24 Mar 2025 13:17:35 -0500 Subject: [PATCH 04/17] add gcc --- README.md | 1 + compilation.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a52521..9656008 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ Install deps: Build deps: +- gcc - libv4l-dev - libudev-dev - libvulkan-dev diff --git a/compilation.sh b/compilation.sh index b91e743..e0d44a9 100755 --- a/compilation.sh +++ b/compilation.sh @@ -22,7 +22,7 @@ fi ## get source and build # get build deps -apt install v4l-utils libv4l-dev libudev-dev libvulkan-dev libdbus-1-dev -y +apt install gcc v4l-utils libv4l-dev libudev-dev libvulkan-dev libdbus-1-dev -y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y . ~/.cargo/env From 3a9c0d91b0d348b88b94890a5db91c3da52fd646 Mon Sep 17 00:00:00 2001 From: askiiart Date: Mon, 24 Mar 2025 13:20:19 -0500 Subject: [PATCH 05/17] add libclang --- README.md | 1 + compilation.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9656008..bdc9c6e 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Install deps: Build deps: - gcc +- libclang-dev - libv4l-dev - libudev-dev - libvulkan-dev diff --git a/compilation.sh b/compilation.sh index e0d44a9..1fad1da 100755 --- a/compilation.sh +++ b/compilation.sh @@ -22,7 +22,7 @@ fi ## get source and build # get build deps -apt install gcc v4l-utils libv4l-dev libudev-dev libvulkan-dev libdbus-1-dev -y +apt install gcc libclang-dev v4l-utils libv4l-dev libudev-dev libvulkan-dev libdbus-1-dev -y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y . ~/.cargo/env From 666a971a03be893b913bd651f0ad4e157e07d4a3 Mon Sep 17 00:00:00 2001 From: askiiart Date: Mon, 24 Mar 2025 13:24:54 -0500 Subject: [PATCH 06/17] forgor to do the archive --- compilation.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/compilation.sh b/compilation.sh index 1fad1da..3f52521 100755 --- a/compilation.sh +++ b/compilation.sh @@ -33,9 +33,16 @@ src_dir=$(find $(pwd) -name "maximbaz-wluma*") cd $src_dir cargo install --path . -# create .tar.zst archive +## create .tar.zst archive +# prep wluma_archive=$(mktemp -d) cp $(which wluma) $wluma_archive sed -i 's/\/usr\/bin\/wluma/\/usr\/bin\/env wluma/g' $src_dir/wluma.service cp $src_dir/wluma.service $wluma_archive +# actually create it and finish up +cd $wluma_archive +tar --zstd -cf $built_dir/$program_name.tar.zst . +echo $version >$version_file + +echo "$program_name updated to $version" \ No newline at end of file From ad8e8b44924d6366cd72fa29a5b5262b25f95655 Mon Sep 17 00:00:00 2001 From: askiiart Date: Mon, 24 Mar 2025 13:28:26 -0500 Subject: [PATCH 07/17] forgor zstd --- compilation.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compilation.sh b/compilation.sh index 3f52521..0c2b1fe 100755 --- a/compilation.sh +++ b/compilation.sh @@ -22,7 +22,7 @@ fi ## get source and build # get build deps -apt install gcc libclang-dev v4l-utils libv4l-dev libudev-dev libvulkan-dev libdbus-1-dev -y +apt install gcc libclang-dev v4l-utils libv4l-dev libudev-dev libvulkan-dev libdbus-1-dev zstd -y # zstd is for archive creation curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y . ~/.cargo/env @@ -45,4 +45,4 @@ cd $wluma_archive tar --zstd -cf $built_dir/$program_name.tar.zst . echo $version >$version_file -echo "$program_name updated to $version" \ No newline at end of file +echo "$program_name updated to $version" From 9dc7cbbf0d683500861d7a487ec466c354539b67 Mon Sep 17 00:00:00 2001 From: askiiart Date: Tue, 25 Mar 2025 10:20:22 -0500 Subject: [PATCH 08/17] add other files * README.md * config.toml * wluma.7.gz * wluma.service --- compilation.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compilation.sh b/compilation.sh index 0c2b1fe..7d2aebc 100755 --- a/compilation.sh +++ b/compilation.sh @@ -22,6 +22,7 @@ fi ## get source and build # get build deps +# note: npm/npx is also required, but this just assumes it's already installed since i'll be running it in docker with the node image - and doing that's faster than installing it manually apt install gcc libclang-dev v4l-utils libv4l-dev libudev-dev libvulkan-dev libdbus-1-dev zstd -y # zstd is for archive creation curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y . ~/.cargo/env @@ -35,10 +36,14 @@ cargo install --path . ## create .tar.zst archive # prep +cd $src_dir wluma_archive=$(mktemp -d) cp $(which wluma) $wluma_archive -sed -i 's/\/usr\/bin\/wluma/\/usr\/bin\/env wluma/g' $src_dir/wluma.service -cp $src_dir/wluma.service $wluma_archive +sed -i 's/\/usr\/bin\/wluma/\/usr\/bin\/env wluma/g' ./wluma.service +npx -y marked-man README.md | gzip > $wluma_archive/wluma.7.gz +cp README.md $wluma_archive +cp config.toml $wluma_archive +cp wluma.service $wluma_archive # actually create it and finish up cd $wluma_archive From 5addcb5563dbfc50af66d2f45a10714f8197a8ef Mon Sep 17 00:00:00 2001 From: askiiart Date: Tue, 25 Mar 2025 10:22:05 -0500 Subject: [PATCH 09/17] oh god i didn't change the program name --- compilation.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compilation.sh b/compilation.sh index 7d2aebc..a67272d 100755 --- a/compilation.sh +++ b/compilation.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -euo pipefail -program_name="librewolf-allow-dark" +program_name="wluma" SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) # prep From 5ff34b02d677465a83363ba1a7cb5ff3ae55f410 Mon Sep 17 00:00:00 2001 From: askiiart Date: Tue, 25 Mar 2025 10:39:24 -0500 Subject: [PATCH 10/17] forgot to update the image --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 88acba7..74bfa11 100644 --- a/.drone.yml +++ b/.drone.yml @@ -4,7 +4,7 @@ name: default steps: - name: Build wluma - image: debian + image: node commands: - '/drone/src/compilation.sh' volumes: From bd752b089e2af9e1fc4426912fb8de244026f28f Mon Sep 17 00:00:00 2001 From: askiiart Date: Tue, 25 Mar 2025 10:47:03 -0500 Subject: [PATCH 11/17] aaaaaaaand i forgot the udev rule --- compilation.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/compilation.sh b/compilation.sh index a67272d..564f22b 100755 --- a/compilation.sh +++ b/compilation.sh @@ -44,6 +44,7 @@ npx -y marked-man README.md | gzip > $wluma_archive/wluma.7.gz cp README.md $wluma_archive cp config.toml $wluma_archive cp wluma.service $wluma_archive +cp 90-wluma-backlight.rules $wluma_archive # actually create it and finish up cd $wluma_archive From 1ef0aabd42233469179a4cae86d7983f91219731 Mon Sep 17 00:00:00 2001 From: askiiart Date: Tue, 25 Mar 2025 12:06:32 -0500 Subject: [PATCH 12/17] update readme --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bdc9c6e..0a2fdd7 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,12 @@ ``` . -├── wluma -└── wluma.service +├── 90-wluma-backlight.rules (/etc/udev/rules.d/) +├── config.toml (/usr/share/wluma/examples/) +├── README.md (/usr/share/doc/wluma/) +├── wluma (/usr/bin/) +├── wluma.7.gz (/usr/share/man/man7/) +└── wluma.service (/usr/lib/systemd/user/) ``` --- @@ -11,6 +15,7 @@ Install deps: - v4l-utils +- dbus (recommended) Build deps: From bacfc6719c417028356a0408785d2b81807f244a Mon Sep 17 00:00:00 2001 From: askiiart Date: Tue, 25 Mar 2025 12:18:45 -0500 Subject: [PATCH 13/17] 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 From 9ac1914430d41a8661e1144ccb185289a40caab6 Mon Sep 17 00:00:00 2001 From: askiiart Date: Tue, 25 Mar 2025 12:22:15 -0500 Subject: [PATCH 14/17] i thought i fixed that already lol --- wluma.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wluma.spec b/wluma.spec index f568c99..d40d457 100644 --- a/wluma.spec +++ b/wluma.spec @@ -14,7 +14,9 @@ Recommends: dbus Automatic brightness adjustment based on screen contents and ALS %prep -tar --zstd -xf ${COMPILED_DIR:-/compiled}/wluma/wluma.tar.zst --one-top-level +mkdir ./wluma +cd ./wluma/ +tar --zstd -xf ${COMPILED_DIR:-/compiled}/wluma/wluma.tar.zst %install cd ./wluma/ From b7a4bb5cf5c60e3d002d45067a45b6fc00ca04d2 Mon Sep 17 00:00:00 2001 From: askiiart Date: Tue, 25 Mar 2025 12:34:18 -0500 Subject: [PATCH 15/17] forgor part of the path --- wluma.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wluma.spec b/wluma.spec index d40d457..d4d4569 100644 --- a/wluma.spec +++ b/wluma.spec @@ -27,7 +27,7 @@ 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/ +cp ./config.toml %{buildroot}%{_docdir}/wluma/examples/ mkdir -p %{buildroot}%{_docdir}/wluma cp ./README.md %{buildroot}%{_docdir}/wluma/ mkdir -p %{buildroot}%{_mandir}/man7 From faa5b3cfb796786fa0912b69499f876054bd695d Mon Sep 17 00:00:00 2001 From: askiiart Date: Tue, 25 Mar 2025 12:37:54 -0500 Subject: [PATCH 16/17] I CAN'T READDDDDDDDDDD --- wluma.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wluma.spec b/wluma.spec index d4d4569..13f11c5 100644 --- a/wluma.spec +++ b/wluma.spec @@ -27,7 +27,7 @@ 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}%{_docdir}/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 From 55f8604c475127445e460dc00c8bdf49bae5e84c Mon Sep 17 00:00:00 2001 From: askiiart Date: Tue, 15 Apr 2025 00:08:04 -0500 Subject: [PATCH 17/17] Initial commit --- .drone.yml | 4 ++-- README.md | 18 ++++-------------- compilation.sh | 33 ++++++++++++--------------------- 3 files changed, 18 insertions(+), 37 deletions(-) diff --git a/.drone.yml b/.drone.yml index 74bfa11..8ce6da2 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,8 +3,8 @@ type: docker name: default steps: - - name: Build wluma - image: node + - name: Build + image: debian commands: - '/drone/src/compilation.sh' volumes: diff --git a/README.md b/README.md index 0a2fdd7..7640f54 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,17 @@ -# [Wluma](https://github.com/maximbaz/wluma) (build) +# [Placeholder](https://github.com/PLACEHOLDER_AUTHOR/PLACEHOLDER_REPO) (build) ``` . -├── 90-wluma-backlight.rules (/etc/udev/rules.d/) -├── config.toml (/usr/share/wluma/examples/) -├── README.md (/usr/share/doc/wluma/) -├── wluma (/usr/bin/) -├── wluma.7.gz (/usr/share/man/man7/) -└── wluma.service (/usr/lib/systemd/user/) +├── 99-filename (/etc/udev/rules.d/) +└── filename.service (/usr/lib/systemd/user/) ``` --- Install deps: -- v4l-utils -- dbus (recommended) +- libc Build deps: - gcc -- libclang-dev -- libv4l-dev -- libudev-dev -- libvulkan-dev -- libdbus-1-dev diff --git a/compilation.sh b/compilation.sh index 564f22b..0aa6463 100755 --- a/compilation.sh +++ b/compilation.sh @@ -1,53 +1,44 @@ #!/usr/bin/env bash set -euo pipefail -program_name="wluma" +program_name="" SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) -# prep +### 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 +### check whether it's up-to-date version_file=$built_dir/version touch $version_file -# also available via gitlab.com/librewolf-community/browser/source/-/raw/main/{version,release} -version=$(curl 'https://api.github.com/repos/maximbaz/wluma/releases/latest' | jq '.tag_name' -r) +version=$(curl 'https://api.github.com/repos///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 source and build # get build deps -# note: npm/npx is also required, but this just assumes it's already installed since i'll be running it in docker with the node image - and doing that's faster than installing it manually -apt install gcc libclang-dev v4l-utils libv4l-dev libudev-dev libvulkan-dev libdbus-1-dev zstd -y # zstd is for archive creation -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -. ~/.cargo/env +apt install -y # zstd is for archive creation cd $workdir -curl -L $(curl 'https://api.github.com/repos/maximbaz/wluma/releases/latest' | jq '.tarball_url' -r) -o $program_name-$version.tar.gz +curl -L $(curl 'https://api.github.com/repos///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 +### create .tar.zst archive # prep cd $src_dir -wluma_archive=$(mktemp -d) -cp $(which wluma) $wluma_archive -sed -i 's/\/usr\/bin\/wluma/\/usr\/bin\/env wluma/g' ./wluma.service -npx -y marked-man README.md | gzip > $wluma_archive/wluma.7.gz -cp README.md $wluma_archive -cp config.toml $wluma_archive -cp wluma.service $wluma_archive -cp 90-wluma-backlight.rules $wluma_archive +$archive_dir=$(mktemp -d) +cp $(which wluma) $archive_dir +cp $archive_dir # actually create it and finish up -cd $wluma_archive +cd $archive_dir tar --zstd -cf $built_dir/$program_name.tar.zst . echo $version >$version_file