mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07:00
run(): add support for logging/redirect
This patch adds support for optional logging of output from all run() commands. For run_interactive() we've opted to log instead of just redirect, meaning output on error is till on console but also in log. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
+1
-1
@@ -198,7 +198,7 @@ static void setup(void *arg)
|
||||
mksubsys("/var/run/sudo", 0711, "root", "root");
|
||||
mksubsys("/var/run/sudo/ts", 0700, "root", "root");
|
||||
if (whichp("restorecon"))
|
||||
run("restorecon /var/run/sudo /var/run/sudo/ts");
|
||||
run("restorecon /var/run/sudo /var/run/sudo/ts", "restorecon");
|
||||
|
||||
umask(prev);
|
||||
}
|
||||
|
||||
+6
-4
@@ -34,9 +34,7 @@
|
||||
|
||||
static void setup(void *arg)
|
||||
{
|
||||
size_t i;
|
||||
glob_t gl;
|
||||
char buf[160];
|
||||
|
||||
if (rescue) {
|
||||
_d("Skipping %s plugin in rescue mode.", __FILE__);
|
||||
@@ -51,9 +49,13 @@ static void setup(void *arg)
|
||||
glob("/mnt/sysctl.d/*.conf", GLOB_APPEND, NULL, &gl);
|
||||
glob("/etc/sysctl.conf", GLOB_APPEND, NULL, &gl);
|
||||
if (gl.gl_pathc > 0) {
|
||||
size_t i;
|
||||
|
||||
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);
|
||||
char cmd[160];
|
||||
|
||||
snprintf(cmd, sizeof(cmd), "/sbin/sysctl -e -p %s >/dev/null", gl.gl_pathv[i]);
|
||||
run(cmd, "sysctl");
|
||||
}
|
||||
globfree(&gl);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ static void setup(void *arg)
|
||||
if ((fd = open("/var/run/console/console.lock", O_CREAT|O_WRONLY|O_TRUNC, 0644)) >= 0) {
|
||||
write(fd, username, strlen(username));
|
||||
close(fd);
|
||||
run("pam_console_apply");
|
||||
run("pam_console_apply", "pam-console");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -66,7 +66,7 @@ static void setup(void *arg)
|
||||
makedir("/tmp/.ICE-unix", 01777);
|
||||
|
||||
if (whichp("restorecon"))
|
||||
run("restorecon /tmp/.ICE-unix /tmp/.X11-unix");
|
||||
run("restorecon /tmp/.ICE-unix /tmp/.X11-unix", "restorecon");
|
||||
|
||||
umask(prev);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user