Commit Graph

4 Commits (be1042cda794ed9833a7a523f3e9b0a086144e6e)

Author SHA1 Message Date
Dustin 74508faf27 nut: Apply udev rules on the host
NUT needs some udev rules in order to set the proper permissions on USB
etc. devices so it can run as an otherwise unprivileged user.  Since
udev rules can only be processed on the host, these rules need to be
copied out of the container and evaluated before the NUT server starts.
To enable this, the *nut-server* container image copies the rules it
contains to `/etc/udev/rules.d` if that directory is a mount point.  By
bind mounting a directory on the host at that path, we can get a copy of
the rules files outside the container.  Then, using a systemd path unit,
we can tell the udev daemon to reload and reevaluate its rules.

SELinux prevents processes in containers from writing to
`/etc/udev/rules.d` directly, so we have to use an intermediate location
and then copy the rules files to their final destination.
2024-01-14 19:24:55 -06:00
Dustin 0e046d062e nut: Reload systemd after updating container unit
Need to run `systemctl daemon-reload` after creating or modifying the
`nut-server.container` unit file, so that the corresponding service unit
will be generated.
2024-01-14 19:24:55 -06:00
Dustin d44e7df8cf nut: Pass explicit path to systemd-sysusers
When `tmpl` substitutes the path of the generated file for `%s` in hook
commands, it uses the full path including the `destdir` prefix.  Since
we're running `tmpl` inside a container, but `systemd-sysusers` outside
it (via `nsenter -t 1`), that path is not correct.  Thus, we need to
explicitly pass the path as `systemd-sysusers` will see it.
2024-01-14 19:24:55 -06:00
Dustin 778c6d440d Initial commit 2024-01-14 19:24:55 -06:00