From aa01588d4559bc69c7cda454cf70b2532b047174 Mon Sep 17 00:00:00 2001 From: bitterhalt Date: Sun, 3 Nov 2024 14:43:12 +0200 Subject: [PATCH] add runit service --- INSTALL.md | 27 ++++++++++++++------------- dist/runit/log/run | 2 ++ dist/runit/run | 3 +++ 3 files changed, 19 insertions(+), 13 deletions(-) create mode 100755 dist/runit/log/run create mode 100755 dist/runit/run diff --git a/INSTALL.md b/INSTALL.md index 1c4b933..f7c6703 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,14 +1,15 @@ - # Dependencies + At build time: `autoconf` At runtime: `python`, `numpy`, `click`, `rich` and `pyyaml` Our standard builds use pyproject, mainly with poetry. # Preparing the sources + The dist files are template files, which means you must first `autoconf` them. You could also just `sed` all the `.in` files if you don't want to use `autotools`. -``` sh +```sh git clone https://github.com/mcgillij/amdfan.git cd amdfan @@ -17,24 +18,25 @@ autoconf ``` # Service files + There are two ways to obtain the systemd service file. One is available during runtime, through the `amdfan --service` command, but takes some assumptions of your system. May not work. -``` sh +```sh amdfan print-default --service | sudo tee /usr/lib/systemd/system/amdfan.service ``` -If you ran `./configure` successfully, you'll also find the service files for OpenRC and systemd under `dist/${init}/`. - +If you ran `./configure` successfully, you'll also find the service files for OpenRC, Runit and systemd under `dist/${init}/`. # Configuration files + Similarly as above, you can obtain the sources from the runtime. This is not necessary, as this file is generated automatically after the daemon runs for the first time. -``` bash +```bash amdfan print-default --configuration | sudo tee /etc/amdfan.yml ``` - # Executable files + The executable files are contained within amdfan. This directory is a python module, and can either be loaded as `python -m amdfan`. If you want to import the module, you may be interested in checking out `amdfan.commands`, which contains most of the subcommands. Otherwise, just use python-exec with something like @@ -47,27 +49,28 @@ if __name__ == '__main__': sys.exit(main()) ``` - - # Installing from PyPi + You can also install amdfan from PyPi using something like poetry. -``` bash +```bash poetry init poetry add amdfan poetry run amdfan --help ``` # Building Python package + Requires [poetry](https://python-poetry.org/) to be installed. -``` bash +```bash git clone git@github.com:mcgillij/amdfan.git cd amdfan/ poetry build ``` ## Building Arch AUR package + Building the Arch package assumes you already have a chroot env setup to build packages. ```bash @@ -81,5 +84,3 @@ cp dist/pacman/PKGBUILD ./PKGBUILD makechrootpkg -c -r $HOME/$CHROOT sudo pacman -U --asdeps amdfan-*-any.pkg.tar.zst ``` - - diff --git a/dist/runit/log/run b/dist/runit/log/run new file mode 100755 index 0000000..76e1263 --- /dev/null +++ b/dist/runit/log/run @@ -0,0 +1,2 @@ +#!/bin/sh +exec vlogger -t amdfan -p daemon diff --git a/dist/runit/run b/dist/runit/run new file mode 100755 index 0000000..1273fb8 --- /dev/null +++ b/dist/runit/run @@ -0,0 +1,3 @@ +#!/bin/sh +exec 2>&1 +exec /usr/bin/amdfan daemon