mirror of
https://github.com/troglobit/finit.git
synced 2026-10-24 11:54:36 +00:00
Fix #47: Relocate sysctl.conf setup to procps plugin
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
5b12d17b56
commit
892ac2edb2
3 files changed
+78
-23
No files matched your search
@@ -25,7 +25,6 @@
|
|||||||
#include "config.h" /* Generated by configure script */
|
#include "config.h" /* Generated by configure script */
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <glob.h>
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#ifdef HAVE_FSTAB_H
|
#ifdef HAVE_FSTAB_H
|
||||||
#include <fstab.h>
|
#include <fstab.h>
|
||||||
@@ -121,26 +120,7 @@ static int fsck(int pass)
|
|||||||
|
|
||||||
static void networking(void)
|
static void networking(void)
|
||||||
{
|
{
|
||||||
size_t i;
|
|
||||||
glob_t gl;
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buf[160];
|
|
||||||
|
|
||||||
/* Setup kernel specific settings, e.g. allow broadcast ping, etc. */
|
|
||||||
glob("/run/sysctl.d/*.conf", 0, NULL, &gl);
|
|
||||||
glob("/etc/sysctl.d/*.conf", GLOB_APPEND, NULL, &gl);
|
|
||||||
glob("/usr/local/lib/sysctl.d/*.conf", GLOB_APPEND, NULL, &gl);
|
|
||||||
glob("/usr/lib/sysctl.d/*.conf", GLOB_APPEND, NULL, &gl);
|
|
||||||
glob("/lib/sysctl.d/*.conf", GLOB_APPEND, NULL, &gl);
|
|
||||||
glob("/mnt/sysctl.d/*.conf", GLOB_APPEND, NULL, &gl);
|
|
||||||
glob("/etc/sysctl.conf", GLOB_APPEND, NULL, &gl);
|
|
||||||
if (gl.gl_pathc > 0) {
|
|
||||||
for (i = 0; i < gl.gl_pathc; i++) {
|
|
||||||
snprintf(buf, sizeof(buf), "/sbin/sysctl -e -p %s >/dev/null", gl.gl_pathv[i]);
|
|
||||||
run(buf);
|
|
||||||
}
|
|
||||||
globfree(&gl);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Run user network start script if enabled */
|
/* Run user network start script if enabled */
|
||||||
if (network) {
|
if (network) {
|
||||||
@@ -151,7 +131,8 @@ static void networking(void)
|
|||||||
/* Debian/Ubuntu/Busybox interfaces file */
|
/* Debian/Ubuntu/Busybox interfaces file */
|
||||||
fp = fopen("/etc/network/interfaces", "r");
|
fp = fopen("/etc/network/interfaces", "r");
|
||||||
if (fp) {
|
if (fp) {
|
||||||
i = 0;
|
int i = 0;
|
||||||
|
char buf[160];
|
||||||
|
|
||||||
/* Bring up all 'auto' interfaces */
|
/* Bring up all 'auto' interfaces */
|
||||||
while (fgets(buf, sizeof(buf), fp)) {
|
while (fgets(buf, sizeof(buf), fp)) {
|
||||||
|
|||||||
+2
-2
@@ -6,7 +6,7 @@ AM_CPPFLAGS += $(lite_CFLAGS)
|
|||||||
|
|
||||||
if STATIC
|
if STATIC
|
||||||
noinst_LTLIBRARIES = libplug.la
|
noinst_LTLIBRARIES = libplug.la
|
||||||
libplug_la_SOURCES = bootmisc.c hwclock.c initctl.c pidfile.c tty.c urandom.c
|
libplug_la_SOURCES = bootmisc.c hwclock.c initctl.c pidfile.c procps.c tty.c urandom.c
|
||||||
|
|
||||||
if BUILD_ALSA_UTILS_PLUGIN
|
if BUILD_ALSA_UTILS_PLUGIN
|
||||||
libplug_la_SOURCES += alsa-utils.c
|
libplug_la_SOURCES += alsa-utils.c
|
||||||
@@ -51,7 +51,7 @@ libplug_la_SOURCES += resolvconf.c
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
else
|
else
|
||||||
pkglib_LTLIBRARIES = bootmisc.la hwclock.la initctl.la pidfile.la tty.la urandom.la
|
pkglib_LTLIBRARIES = bootmisc.la hwclock.la initctl.la pidfile.la procps.la tty.la urandom.la
|
||||||
|
|
||||||
if BUILD_ALSA_UTILS_PLUGIN
|
if BUILD_ALSA_UTILS_PLUGIN
|
||||||
pkglib_LTLIBRARIES += alsa-utils.la
|
pkglib_LTLIBRARIES += alsa-utils.la
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
/* Set kernel variables from /etc/sysctl.conf et al
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016 Joachim Nilsson <troglobit@gmail.com>
|
||||||
|
*
|
||||||
|
* 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 <glob.h>
|
||||||
|
#include <lite/lite.h>
|
||||||
|
#include "../plugin.h"
|
||||||
|
|
||||||
|
static void setup(void *UNUSED(arg))
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
glob_t gl;
|
||||||
|
char buf[160];
|
||||||
|
|
||||||
|
glob("/run/sysctl.d/*.conf", 0, NULL, &gl);
|
||||||
|
glob("/etc/sysctl.d/*.conf", GLOB_APPEND, NULL, &gl);
|
||||||
|
glob("/usr/local/lib/sysctl.d/*.conf", GLOB_APPEND, NULL, &gl);
|
||||||
|
glob("/usr/lib/sysctl.d/*.conf", GLOB_APPEND, NULL, &gl);
|
||||||
|
glob("/lib/sysctl.d/*.conf", GLOB_APPEND, NULL, &gl);
|
||||||
|
glob("/mnt/sysctl.d/*.conf", GLOB_APPEND, NULL, &gl);
|
||||||
|
glob("/etc/sysctl.conf", GLOB_APPEND, NULL, &gl);
|
||||||
|
if (gl.gl_pathc > 0) {
|
||||||
|
for (i = 0; i < gl.gl_pathc; i++) {
|
||||||
|
snprintf(buf, sizeof(buf), "/sbin/sysctl -e -p %s >/dev/null", gl.gl_pathv[i]);
|
||||||
|
run(buf);
|
||||||
|
}
|
||||||
|
globfree(&gl);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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:
|
||||||
|
*/
|
||||||
Reference in new issue
Block a user