mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 13:33:09 +07:00
Fix #318: only show "[ OK ] Calling foo" progress for runparts ...
For all other run_parts() use-cases we just give the script control over stdout/stderr to prevent clobbering ANSI color escape codes. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -45,7 +45,7 @@ static void setup(void *arg)
|
||||
|
||||
touch("/etc/resolvconf/run/enable-updates");
|
||||
chdir("/etc/resolvconf/run/interface");
|
||||
run_parts("/etc/resolvconf/update.d", "-i");
|
||||
run_parts("/etc/resolvconf/update.d", "-i", 0);
|
||||
chdir("/");
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -441,7 +441,7 @@ pid_t run_sh(char *tty, int noclear, int nowait, struct rlimit rlimit[])
|
||||
return rc;
|
||||
}
|
||||
|
||||
int run_parts(char *dir, char *cmd)
|
||||
int run_parts(char *dir, char *cmd, int progress)
|
||||
{
|
||||
struct dirent **e;
|
||||
int i, num;
|
||||
@@ -490,7 +490,8 @@ int run_parts(char *dir, char *cmd)
|
||||
strlcat(path, cmd, sizeof(path));
|
||||
}
|
||||
|
||||
print_desc("Calling ", path);
|
||||
if (progress)
|
||||
print_desc("Calling ", path);
|
||||
pid = fork();
|
||||
if (!pid) {
|
||||
sig_unblock();
|
||||
@@ -503,7 +504,8 @@ int run_parts(char *dir, char *cmd)
|
||||
warnx("%s exited with status %d", path, exit_status);
|
||||
else if (WIFSIGNALED(status))
|
||||
warnx("%s terminated by signad %d", path, WTERMSIG(status));
|
||||
print_result(status);
|
||||
if (progress)
|
||||
print_result(status);
|
||||
}
|
||||
|
||||
while (num--)
|
||||
|
||||
+1
-1
@@ -602,7 +602,7 @@ static void bootstrap_worker(void *work)
|
||||
* Run startup scripts in the runparts directory, if any.
|
||||
*/
|
||||
if (runparts && fisdir(runparts) && !rescue)
|
||||
run_parts(runparts, NULL);
|
||||
run_parts(runparts, NULL, 1);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ int run_interactive (char *cmd, char *fmt, ...) __attribute__ ((format (prin
|
||||
int exec_runtask (char *cmd, char *args[]);
|
||||
pid_t run_getty (char *tty, char *cmd, char *args[], int noclear, int nowait, struct rlimit rlimit[]);
|
||||
pid_t run_sh (char *tty, int noclear, int nowait, struct rlimit rlimit[]);
|
||||
int run_parts (char *dir, char *cmd);
|
||||
int run_parts (char *dir, char *cmd, int progress);
|
||||
|
||||
static inline int create(char *path, mode_t mode, uid_t uid, gid_t gid)
|
||||
{
|
||||
|
||||
+1
-1
@@ -208,7 +208,7 @@ void plugin_script_run(hook_point_t no)
|
||||
strlcat(path, PLUGIN_HOOK_SCRIPTS_PATH, sizeof(path));
|
||||
strlcat(path, hscript_paths[no] + 4, sizeof(path));
|
||||
|
||||
run_parts(path, NULL);
|
||||
run_parts(path, NULL, 0);
|
||||
}
|
||||
#else
|
||||
void plugin_script_run(hook_point_t no)
|
||||
|
||||
Reference in New Issue
Block a user