Drop mdevd plugin, not needed since notify:s6 support was added

For an example how to set it up, see the finit-skel repository:

https://github.com/troglobit/finit-skel/blob/main/skel/etc/finit.d/available/mdevd.conf

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2022-12-21 11:57:48 +01:00
1 parent 4c90b51d80
commit f6bfbc86e9
6 files changed
+15 -153

No files matched your search

-1
View File
@@ -86,7 +86,6 @@ AC_ARG_ENABLE(all_plugins,
enable_all_plugins=$enableval, enable_all_plugins=auto) enable_all_plugins=$enableval, enable_all_plugins=auto)
AC_PLUGIN([alsa-utils], [no], [Save and restore ALSA sound settings using alsactl]) AC_PLUGIN([alsa-utils], [no], [Save and restore ALSA sound settings using alsactl])
AC_PLUGIN([dbus], [no], [Setup and start system message bus, D-Bus]) AC_PLUGIN([dbus], [no], [Setup and start system message bus, D-Bus])
AC_PLUGIN([mdevd], [no], [Setup and start system hotplug helper mdevd])
AC_PLUGIN([modules-load], [no], [Scans /etc/modules-load.d for modules to load]) AC_PLUGIN([modules-load], [no], [Scans /etc/modules-load.d for modules to load])
AC_PLUGIN([modprobe], [yes], [Coldplug modules using modalias magic]) AC_PLUGIN([modprobe], [yes], [Coldplug modules using modalias magic])
AC_PLUGIN([resolvconf], [no], [Setup necessary files for resolvconf]) AC_PLUGIN([resolvconf], [no], [Setup necessary files for resolvconf])
+11 -1
View File
@@ -551,7 +551,7 @@ option:
(must be >3) on then command line, Finit provides the following (must be >3) on then command line, Finit provides the following
syntax (`%n` is replaced by Finit with then descriptor number): syntax (`%n` is replaced by Finit with then descriptor number):
service notify:s6 mdevd -C -O 4 -D %n service [S12345789] notify:s6 mdevd -O 4 -D %n
[sd_notify()]: https://www.freedesktop.org/software/systemd/man/sd_notify.html [sd_notify()]: https://www.freedesktop.org/software/systemd/man/sd_notify.html
[s6 expect]: https://skarnet.org/software/s6/notifywhenup.html [s6 expect]: https://skarnet.org/software/s6/notifywhenup.html
@@ -563,6 +563,16 @@ then service's ready condition which other services can depend on:
$ initctl -v cond get service/mdevd/ready $ initctl -v cond get service/mdevd/ready
on on
This can be used to synchronize the start of another run/task/service:
task [S] <service/mdevd/ready> @root:root mdevd-coldplug
Finit waits for `mdevd` to notify it, before starting `mdevd-coldplug`.
Notice how both start in runlevel S, and the coldplug task only runs in
S. When the system moves to runlevel 2 (the default), coldplug is no
longer part of the running configuration (`initctl show`), this is to
ensure that coldplug is not called more than once.
> For a detailed description of conditions, and how to debug them, > For a detailed description of conditions, and how to debug them,
> see the [Finit Conditions](conditions.md) document. > see the [Finit Conditions](conditions.md) document.
+3 -3
View File
@@ -52,9 +52,9 @@ For your convenience a set of *optional* plugins are available:
* *hotplug.so*: Setup and start either udev or mdev hotplug daemon, if * *hotplug.so*: Setup and start either udev or mdev hotplug daemon, if
available. Enabled by default. available. Enabled by default.
* *mdevd.so*: Set up and start mdevd (mdev replacement). Enabling this > See the [Services](config.md#services) section in the configuration
also changes how `hotplug.so` plugin operates. _Optional plugin._ > guide for an example how to run `mdevd`, alternative to plain mdev.
* *rtc.so*: Restore and save system clock from/to RTC on boot/halt. * *rtc.so*: Restore and save system clock from/to RTC on boot/halt.
Enabled by default. Enabled by default.
-8
View File
@@ -21,10 +21,6 @@ if BUILD_HOTPLUG_PLUGIN
libplug_la_SOURCES += hotplug.c libplug_la_SOURCES += hotplug.c
endif endif
if BUILD_MDEVD_PLUGIN
libplug_la_SOURCES += mdevd.c
endif
if BUILD_MODULES_LOAD_PLUGIN if BUILD_MODULES_LOAD_PLUGIN
libplug_la_SOURCES += modules-load.c libplug_la_SOURCES += modules-load.c
endif endif
@@ -76,10 +72,6 @@ if BUILD_HOTPLUG_PLUGIN
pkglib_LTLIBRARIES += hotplug.la pkglib_LTLIBRARIES += hotplug.la
endif endif
if BUILD_MDEVD_PLUGIN
pkglib_LTLIBRARIES += mdevd.la
endif
if BUILD_MODULES_LOAD_PLUGIN if BUILD_MODULES_LOAD_PLUGIN
pkglib_LTLIBRARIES += modules-load.la pkglib_LTLIBRARIES += modules-load.la
endif endif
+1 -17
View File
@@ -39,21 +39,6 @@ static void setup(void *arg)
return; return;
} }
/*
* If the mdevd plugin is enabled and loaded we assume this
* system is mdevd based, skipping below udev/mdev checks.
*/
if (plugin_find("mdevd")) {
path = which("mdevd-coldplug");
if (path) {
snprintf(cmd, sizeof(cmd), "cgroup.system [S] <service/mdevd/ready> log %s "
" -- Populating device tree", path);
service_register(SVC_TYPE_RUN, cmd, global_rlimit, NULL);
free(path);
}
return;
}
/* /*
* Populate /dev and prepare for runtime events from kernel. * Populate /dev and prepare for runtime events from kernel.
* Prefer udev if mdev is also available on the system. * Prefer udev if mdev is also available on the system.
@@ -105,13 +90,12 @@ static void setup(void *arg)
} }
} }
/* mdevd optional, if installed & loaded changes behavior of setup() */
static plugin_t plugin = { static plugin_t plugin = {
.name = __FILE__, .name = __FILE__,
.hook[HOOK_BASEFS_UP] = { .hook[HOOK_BASEFS_UP] = {
.cb = setup .cb = setup
}, },
.depends = { "bootmisc", "mdevd", "modprobe" }, .depends = { "bootmisc", "modprobe" },
}; };
PLUGIN_INIT(plugin_init) PLUGIN_INIT(plugin_init)
-123
View File
@@ -1,123 +0,0 @@
/* Setup and start system hotplug helper mdevd
*
* Portions Copyright (c) 2012-2022 Joachim Wiberg <troglobit@gmail.com>
* Portions Copyright (c) 2022 Andy Savage <andy@savage.hk>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <sys/types.h>
#ifdef _LIBITE_LITE
# include <libite/lite.h>
#else
# include <lite/lite.h>
#endif
#include "finit.h"
#include "config.h"
#include "helpers.h"
#include "plugin.h"
#include "service.h"
#include "conf.h"
#define MDEVD_DAEMON "mdevd"
/* Rebroadcast events onto nlgroup 4 */
#define MDEVD_ARGS "-C -O 4 -D %n"
#define MDEVD_DESC "MDEVD Extended Hotplug Daemon"
#ifndef MDEVD_DAEMONUSER
#define MDEVD_DAEMONUSER "root"
#endif
#ifndef MDEVD_DAEMONGROUP
#define MDEVD_DAEMONGROUP "root"
#endif
#ifndef MDEVD_DAEMONPIDFILE
#define MDEVD_DAEMONPIDFILE "/var/run/mdevd.pid"
#endif
static void setup(void *arg)
{
char line[256];
mode_t prev;
char *cmd;
FILE *fp;
if (rescue) {
dbg("Skipping %s plugin in rescue mode.", __FILE__);
return;
}
cmd = which(MDEVD_DAEMON);
if (!cmd) {
dbg("Skipping plugin, %s is not installed.", MDEVD_DAEMON);
return;
}
prev =umask(0);
/* Clean up from any previous pre-bootstrap run */
remove(MDEVD_DAEMONPIDFILE);
/* Set hotplug helper */
fp = fopen("/proc/sys/kernel/hotplug", "w");
if (fp) {
fputc('\n', fp);
fclose(fp);
}
/* Register service with Finit */
if (debug)
snprintf(line, sizeof(line), "[S12345789] cgroup.system notify:s6 pid:!%s @%s:%s %s -v3 %s -- %s",
MDEVD_DAEMONPIDFILE, MDEVD_DAEMONUSER, MDEVD_DAEMONGROUP, cmd, MDEVD_ARGS, MDEVD_DESC);
else
snprintf(line, sizeof(line), "[S12345789] cgroup.system notify:s6 pid:!%s @%s:%s %s %s -- %s",
MDEVD_DAEMONPIDFILE, MDEVD_DAEMONUSER, MDEVD_DAEMONGROUP, cmd, MDEVD_ARGS, MDEVD_DESC);
if (service_register(SVC_TYPE_SERVICE, line, global_rlimit, NULL))
err(1, "Failed registering %s", MDEVD_DAEMON);
free(cmd);
umask(prev);
}
static plugin_t plugin = {
.name = __FILE__,
.hook[HOOK_BASEFS_UP] = {
.cb = setup
},
.depends = { "bootmisc", },
};
PLUGIN_INIT(plugin_init)
{
plugin_register(&plugin);
}
PLUGIN_EXIT(plugin_exit)
{
plugin_unregister(&plugin);
}
/**
* Local Variables:
* indent-tabs-mode: t
* c-file-style: "linux"
* End:
*/