Skip to content

Commit

Permalink
add runit service
Browse files Browse the repository at this point in the history
  • Loading branch information
bitterhalt committed Nov 3, 2024
1 parent c531885 commit aa01588
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
27 changes: 14 additions & 13 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand All @@ -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 [email protected]: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
Expand All @@ -81,5 +84,3 @@ cp dist/pacman/PKGBUILD ./PKGBUILD
makechrootpkg -c -r $HOME/$CHROOT
sudo pacman -U --asdeps amdfan-*-any.pkg.tar.zst
```


2 changes: 2 additions & 0 deletions dist/runit/log/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
exec vlogger -t amdfan -p daemon
3 changes: 3 additions & 0 deletions dist/runit/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
exec 2>&1
exec /usr/bin/amdfan daemon

0 comments on commit aa01588

Please sign in to comment.