mirror of
https://github.com/troglobit/finit.git
synced 2026-11-12 16:51:25 +00: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:
1 parent
c84ababbd4
commit
0498326962
5 files changed
+9
-7
No files matched your search
@@ -45,7 +45,7 @@ static void setup(void *arg)
|
|||||||
|
|
||||||
touch("/etc/resolvconf/run/enable-updates");
|
touch("/etc/resolvconf/run/enable-updates");
|
||||||
chdir("/etc/resolvconf/run/interface");
|
chdir("/etc/resolvconf/run/interface");
|
||||||
run_parts("/etc/resolvconf/update.d", "-i");
|
run_parts("/etc/resolvconf/update.d", "-i", 0);
|
||||||
chdir("/");
|
chdir("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-3
@@ -441,7 +441,7 @@ pid_t run_sh(char *tty, int noclear, int nowait, struct rlimit rlimit[])
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int run_parts(char *dir, char *cmd)
|
int run_parts(char *dir, char *cmd, int progress)
|
||||||
{
|
{
|
||||||
struct dirent **e;
|
struct dirent **e;
|
||||||
int i, num;
|
int i, num;
|
||||||
@@ -490,7 +490,8 @@ int run_parts(char *dir, char *cmd)
|
|||||||
strlcat(path, cmd, sizeof(path));
|
strlcat(path, cmd, sizeof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
print_desc("Calling ", path);
|
if (progress)
|
||||||
|
print_desc("Calling ", path);
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (!pid) {
|
if (!pid) {
|
||||||
sig_unblock();
|
sig_unblock();
|
||||||
@@ -503,7 +504,8 @@ int run_parts(char *dir, char *cmd)
|
|||||||
warnx("%s exited with status %d", path, exit_status);
|
warnx("%s exited with status %d", path, exit_status);
|
||||||
else if (WIFSIGNALED(status))
|
else if (WIFSIGNALED(status))
|
||||||
warnx("%s terminated by signad %d", path, WTERMSIG(status));
|
warnx("%s terminated by signad %d", path, WTERMSIG(status));
|
||||||
print_result(status);
|
if (progress)
|
||||||
|
print_result(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (num--)
|
while (num--)
|
||||||
|
|||||||
+1
-1
@@ -602,7 +602,7 @@ static void bootstrap_worker(void *work)
|
|||||||
* Run startup scripts in the runparts directory, if any.
|
* Run startup scripts in the runparts directory, if any.
|
||||||
*/
|
*/
|
||||||
if (runparts && fisdir(runparts) && !rescue)
|
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[]);
|
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_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[]);
|
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)
|
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, PLUGIN_HOOK_SCRIPTS_PATH, sizeof(path));
|
||||||
strlcat(path, hscript_paths[no] + 4, sizeof(path));
|
strlcat(path, hscript_paths[no] + 4, sizeof(path));
|
||||||
|
|
||||||
run_parts(path, NULL);
|
run_parts(path, NULL, 0);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void plugin_script_run(hook_point_t no)
|
void plugin_script_run(hook_point_t no)
|
||||||
|
|||||||
Reference in new issue
Block a user