mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
3c702e8210
This introduces a new unit condition check: that matches if a specific kmod module is allowed. This should be generally useful, but there's one usecase in particular: we can optimize modprobe@.service with this and avoid forking out a bunch of modprobe requests during boot for the same kmods. Checking if a kernel module is loaded is more complicated than just checking if /sys/module/$MODULE/ exists, since kernel modules typically take a while to initialize and we must check that this is complete (by checking if the sysfs attr "initstate" is "live").
22 lines
605 B
Desktop File
22 lines
605 B
Desktop File
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
#
|
|
# This file is part of systemd.
|
|
#
|
|
# systemd is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU Lesser General Public License as published by
|
|
# the Free Software Foundation; either version 2.1 of the License, or
|
|
# (at your option) any later version.
|
|
|
|
[Unit]
|
|
Description=Load Kernel Module %i
|
|
DefaultDependencies=no
|
|
Before=sysinit.target
|
|
Documentation=man:modprobe(8)
|
|
ConditionCapability=CAP_SYS_MODULE
|
|
ConditionKernelModuleLoaded=!%i
|
|
StartLimitIntervalSec=0
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
ExecStart=-/sbin/modprobe -abq %i
|