|
| 1 | +# Network UPS Tools (NUT) systemd integration |
| 2 | +# Copyright (C) 2025- by NUT contributors |
| 3 | +# Distributed under the terms of GPLv2+ |
| 4 | +# See https://networkupstools.org/ |
| 5 | +# and https://github.com/networkupstools/nut/ |
| 6 | +# |
| 7 | +# This file was adapted from systemd-udev-settle.service provided as part of |
| 8 | +# systemd. The original service is no longer recommended for general use in |
| 9 | +# recent distributions (does not guarantee reliable detection, and delays |
| 10 | +# system readiness for log-in), but waiting for udev to settle its currently |
| 11 | +# running operations has proven useful in some cases for NUT practice. |
| 12 | +# |
| 13 | +# Original file's terms: |
| 14 | +# |
| 15 | +# SPDX-License-Identifier: LGPL-2.1-or-later |
| 16 | +# |
| 17 | +# This file is part of systemd. |
| 18 | +# |
| 19 | +# systemd is free software; you can redistribute it and/or modify it |
| 20 | +# under the terms of the GNU Lesser General Public License as published by |
| 21 | +# the Free Software Foundation; either version 2.1 of the License, or |
| 22 | +# (at your option) any later version. |
| 23 | + |
| 24 | +# This service can dynamically be pulled-in by legacy services which |
| 25 | +# cannot reliably cope with dynamic device configurations, and wrongfully |
| 26 | +# expect a populated /dev during bootup. |
| 27 | + |
| 28 | +[Unit] |
| 29 | +Description=Wait for udev To Complete Device Initialization before USB-capable NUT drivers start |
| 30 | +Documentation=man:systemd-udev-settle.service(8) |
| 31 | +DefaultDependencies=no |
| 32 | +Wants=systemd-udevd.service |
| 33 | +After=systemd-udev-trigger.service |
| 34 | +ConditionPathIsReadWrite=/sys |
| 35 | + |
| 36 | +# Used when/if requested by specific nut-driver@.service instances. |
| 37 | +# No auto-start or dependency otherwise. |
| 38 | + |
| 39 | +[Service] |
| 40 | +Type=oneshot |
| 41 | +TimeoutSec=180 |
| 42 | +# We want to re-trigger this service during NUT driver restarts |
| 43 | +# (maybe several at once) as we reconnect after e.g. USB bus reset, |
| 44 | +# for changes in USB/Serial/... devices that may need permissions |
| 45 | +# for NUT to be applied. So we do not want it to remain "active". |
| 46 | +#RemainAfterExit=yes |
| 47 | +ExecStart=udevadm settle |
0 commit comments