mirror of
https://github.com/troglobit/finit.git
synced 2026-10-13 10:14:47 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96f944b816 | ||
|
|
50b9e46e19 | ||
|
|
c01faef99b | ||
|
|
4867b7268b | ||
|
|
662293e194 | ||
|
|
4ce810cc1f | ||
|
|
184c079c08 |
@@ -38,7 +38,7 @@
|
|||||||
static void save(void *arg)
|
static void save(void *arg)
|
||||||
{
|
{
|
||||||
if (rescue) {
|
if (rescue) {
|
||||||
dbg("Skipping %s plugin in rescue mode.", __FILE__);
|
dbg("Skipping %s plugin in rescue mode.", "alsa-utils");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ static void save(void *arg)
|
|||||||
static void restore(void *arg)
|
static void restore(void *arg)
|
||||||
{
|
{
|
||||||
if (rescue) {
|
if (rescue) {
|
||||||
dbg("Skipping %s plugin in rescue mode.", __FILE__);
|
dbg("Skipping %s plugin in rescue mode.", "alsa-utils");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ static void restore(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = "alsa-utils",
|
||||||
.hook[HOOK_BASEFS_UP] = { .cb = restore },
|
.hook[HOOK_BASEFS_UP] = { .cb = restore },
|
||||||
.hook[HOOK_SHUTDOWN] = { .cb = save }
|
.hook[HOOK_SHUTDOWN] = { .cb = save }
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -172,7 +172,7 @@ static void setup(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = "bootmisc",
|
||||||
.hook[HOOK_MOUNT_POST] = { .cb = clean },
|
.hook[HOOK_MOUNT_POST] = { .cb = clean },
|
||||||
.hook[HOOK_BASEFS_UP] = { .cb = setup },
|
.hook[HOOK_BASEFS_UP] = { .cb = setup },
|
||||||
.depends = { "pidfile" },
|
.depends = { "pidfile" },
|
||||||
|
|||||||
+2
-2
@@ -106,7 +106,7 @@ static void setup(void *arg)
|
|||||||
char *cmd;
|
char *cmd;
|
||||||
|
|
||||||
if (rescue) {
|
if (rescue) {
|
||||||
dbg("Skipping %s plugin in rescue mode.", __FILE__);
|
dbg("Skipping %s plugin in rescue mode.", "dbus");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ static void setup(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = "dbus",
|
||||||
.hook[HOOK_SVC_PLUGIN] = { .cb = setup },
|
.hook[HOOK_SVC_PLUGIN] = { .cb = setup },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ static void hscript_shutdown(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = "hook-scripts",
|
||||||
.hook[HOOK_BANNER] = { .cb = hscript_banner },
|
.hook[HOOK_BANNER] = { .cb = hscript_banner },
|
||||||
.hook[HOOK_ROOTFS_UP] = { .cb = hscript_rootfs_up },
|
.hook[HOOK_ROOTFS_UP] = { .cb = hscript_rootfs_up },
|
||||||
.hook[HOOK_MOUNT_ERROR] = { .cb = hscript_mount_error },
|
.hook[HOOK_MOUNT_ERROR] = { .cb = hscript_mount_error },
|
||||||
|
|||||||
+1
-1
@@ -228,7 +228,7 @@ static void coldplug(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = "modprobe",
|
||||||
.hook[HOOK_BASEFS_UP] = { .cb = coldplug },
|
.hook[HOOK_BASEFS_UP] = { .cb = coldplug },
|
||||||
.depends = { "bootmisc", }
|
.depends = { "bootmisc", }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ static void load(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = "modules-load",
|
||||||
.hook[HOOK_SVC_PLUGIN] = { .cb = load },
|
.hook[HOOK_SVC_PLUGIN] = { .cb = load },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -426,7 +426,7 @@ static void nl_enumerate(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = "netlink",
|
||||||
.hook[HOOK_SVC_RECONF] = { .cb = nl_reconf },
|
.hook[HOOK_SVC_RECONF] = { .cb = nl_reconf },
|
||||||
.hook[HOOK_SVC_PLUGIN] = { .cb = nl_enumerate },
|
.hook[HOOK_SVC_PLUGIN] = { .cb = nl_enumerate },
|
||||||
.io = {
|
.io = {
|
||||||
|
|||||||
+1
-1
@@ -335,7 +335,7 @@ static void pidfile_init(void *arg)
|
|||||||
* SIGSTP:ed (in state PAUSED) waiting for <net/iface/lo>.
|
* SIGSTP:ed (in state PAUSED) waiting for <net/iface/lo>.
|
||||||
*/
|
*/
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = "pidfile",
|
||||||
.hook[HOOK_BASEFS_UP] = { .cb = pidfile_init },
|
.hook[HOOK_BASEFS_UP] = { .cb = pidfile_init },
|
||||||
.hook[HOOK_SVC_RECONF] = { .cb = pidfile_reconf },
|
.hook[HOOK_SVC_RECONF] = { .cb = pidfile_reconf },
|
||||||
.depends = { "netlink" }, /* bootmisc depends on us */
|
.depends = { "netlink" }, /* bootmisc depends on us */
|
||||||
|
|||||||
+2
-2
@@ -43,7 +43,7 @@ static void setup(void *arg)
|
|||||||
glob_t gl;
|
glob_t gl;
|
||||||
|
|
||||||
if (rescue) {
|
if (rescue) {
|
||||||
dbg("Skipping %s plugin in rescue mode.", __FILE__);
|
dbg("Skipping %s plugin in rescue mode.", "procps");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ static void setup(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = "procps",
|
||||||
.hook[HOOK_BASEFS_UP] = {
|
.hook[HOOK_BASEFS_UP] = {
|
||||||
.cb = setup
|
.cb = setup
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ static void setup(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = "resolvconf",
|
||||||
.hook[HOOK_BASEFS_UP] = {
|
.hook[HOOK_BASEFS_UP] = {
|
||||||
.cb = setup
|
.cb = setup
|
||||||
},
|
},
|
||||||
|
|||||||
+3
-3
@@ -236,7 +236,7 @@ static void rtc_save(void *arg)
|
|||||||
int fd, rc = 0;
|
int fd, rc = 0;
|
||||||
|
|
||||||
if (rescue) {
|
if (rescue) {
|
||||||
dbg("Skipping %s plugin in rescue mode.", __FILE__);
|
dbg("Skipping %s plugin in rescue mode.", "rtc");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,7 +266,7 @@ static void rtc_restore(void *arg)
|
|||||||
int fd, rc = 0;
|
int fd, rc = 0;
|
||||||
|
|
||||||
if (rescue) {
|
if (rescue) {
|
||||||
dbg("Skipping %s plugin in rescue mode.", __FILE__);
|
dbg("Skipping %s plugin in rescue mode.", "rtc");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,7 +321,7 @@ static void update(uev_t *w, void *arg, int events)
|
|||||||
|
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = "rtc",
|
||||||
.hook[HOOK_BASEFS_UP] = {
|
.hook[HOOK_BASEFS_UP] = {
|
||||||
.cb = rtc_restore
|
.cb = rtc_restore
|
||||||
},
|
},
|
||||||
|
|||||||
+1
-1
@@ -180,7 +180,7 @@ static void sys_init(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = "sys",
|
||||||
.hook[HOOK_BASEFS_UP] = { .cb = sys_init },
|
.hook[HOOK_BASEFS_UP] = { .cb = sys_init },
|
||||||
.depends = { "bootmisc", },
|
.depends = { "bootmisc", },
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -43,6 +43,7 @@
|
|||||||
static void tty_watcher(void *arg, int fd, int events);
|
static void tty_watcher(void *arg, int fd, int events);
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
|
.name = "tty",
|
||||||
.io = {
|
.io = {
|
||||||
.cb = tty_watcher,
|
.cb = tty_watcher,
|
||||||
.flags = PLUGIN_IO_READ,
|
.flags = PLUGIN_IO_READ,
|
||||||
|
|||||||
+3
-3
@@ -87,7 +87,7 @@ static void setup(void *arg)
|
|||||||
int fd, err;
|
int fd, err;
|
||||||
|
|
||||||
if (rescue) {
|
if (rescue) {
|
||||||
dbg("Skipping %s plugin in rescue mode.", __FILE__);
|
dbg("Skipping %s plugin in rescue mode.", "urandom");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ static void save(void *arg)
|
|||||||
mode_t prev;
|
mode_t prev;
|
||||||
|
|
||||||
if (rescue) {
|
if (rescue) {
|
||||||
dbg("Skipping %s plugin in rescue mode.", __FILE__);
|
dbg("Skipping %s plugin in rescue mode.", "urandom");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ static void save(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = "urandom",
|
||||||
.hook[HOOK_BASEFS_UP] = { .cb = setup },
|
.hook[HOOK_BASEFS_UP] = { .cb = setup },
|
||||||
.hook[HOOK_SHUTDOWN] = { .cb = save },
|
.hook[HOOK_SHUTDOWN] = { .cb = save },
|
||||||
.depends = { "bootmisc", }
|
.depends = { "bootmisc", }
|
||||||
|
|||||||
+1
-1
@@ -104,7 +104,7 @@ static void usr_init(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = "usr",
|
||||||
.hook[HOOK_BASEFS_UP] = { .cb = usr_init },
|
.hook[HOOK_BASEFS_UP] = { .cb = usr_init },
|
||||||
.depends = { "bootmisc", },
|
.depends = { "bootmisc", },
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
static void setup(void *arg)
|
static void setup(void *arg)
|
||||||
{
|
{
|
||||||
if (rescue) {
|
if (rescue) {
|
||||||
dbg("Skipping %s plugin in rescue mode.", __FILE__);
|
dbg("Skipping %s plugin in rescue mode.", "x11-common");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ static void setup(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = "x11-common",
|
||||||
.hook[HOOK_SVC_PLUGIN] = { .cb = setup },
|
.hook[HOOK_SVC_PLUGIN] = { .cb = setup },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+2
-11
@@ -121,9 +121,6 @@ static uev_t etcw;
|
|||||||
|
|
||||||
static TAILQ_HEAD(, conf_change) conf_change_list = TAILQ_HEAD_INITIALIZER(conf_change_list);
|
static TAILQ_HEAD(, conf_change) conf_change_list = TAILQ_HEAD_INITIALIZER(conf_change_list);
|
||||||
|
|
||||||
static char *path;
|
|
||||||
static char *shell;
|
|
||||||
|
|
||||||
static int parse_conf(char *file, int is_rcsd);
|
static int parse_conf(char *file, int is_rcsd);
|
||||||
static void drop_changes(void);
|
static void drop_changes(void);
|
||||||
|
|
||||||
@@ -377,8 +374,6 @@ void conf_parse_cmdline(int argc, char *argv[])
|
|||||||
fstab = strdup(ptr);
|
fstab = strdup(ptr);
|
||||||
finit_conf = strdup(FINIT_CONF);
|
finit_conf = strdup(FINIT_CONF);
|
||||||
finit_rcsd = strdup(FINIT_RCSD);
|
finit_rcsd = strdup(FINIT_RCSD);
|
||||||
path = getenv("PATH");
|
|
||||||
shell = getenv("SHELL");
|
|
||||||
|
|
||||||
for (int i = 1; i < argc; i++)
|
for (int i = 1; i < argc; i++)
|
||||||
parse_arg(argv[i]);
|
parse_arg(argv[i]);
|
||||||
@@ -404,13 +399,9 @@ void conf_reset_env(void)
|
|||||||
free(node);
|
free(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path)
|
if (!getenv("PATH"))
|
||||||
setenv("PATH", path, 1);
|
|
||||||
else
|
|
||||||
setenv("PATH", _PATH_STDPATH, 1);
|
setenv("PATH", _PATH_STDPATH, 1);
|
||||||
if (shell)
|
if (!getenv("SHELL"))
|
||||||
setenv("SHELL", shell, 1);
|
|
||||||
else
|
|
||||||
setenv("SHELL", _PATH_BSHELL, 1);
|
setenv("SHELL", _PATH_BSHELL, 1);
|
||||||
setenv("LOGNAME", "root", 1);
|
setenv("LOGNAME", "root", 1);
|
||||||
setenv("USER", "root", 1);
|
setenv("USER", "root", 1);
|
||||||
|
|||||||
+62
-6
@@ -50,6 +50,7 @@
|
|||||||
|
|
||||||
static pstyle_t progress_onoff = PROGRESS_DEFAULT;
|
static pstyle_t progress_onoff = PROGRESS_DEFAULT;
|
||||||
static pstyle_t progress_style = PROGRESS_DEFAULT;
|
static pstyle_t progress_style = PROGRESS_DEFAULT;
|
||||||
|
static char last_desc[512]; /* saved description for re-print after interruption */
|
||||||
|
|
||||||
#ifndef HOSTNAME_PATH
|
#ifndef HOSTNAME_PATH
|
||||||
#define HOSTNAME_PATH "/etc/hostname"
|
#define HOSTNAME_PATH "/etc/hostname"
|
||||||
@@ -336,6 +337,8 @@ void printv(const char *fmt, va_list ap)
|
|||||||
len = print_timestamp(buf, sizeof(buf));
|
len = print_timestamp(buf, sizeof(buf));
|
||||||
vsnprintf(&buf[len], sizeof(buf) - len, fmt, ap);
|
vsnprintf(&buf[len], sizeof(buf) - len, fmt, ap);
|
||||||
|
|
||||||
|
strlcpy(last_desc, &buf[len], sizeof(last_desc)); /* save for re-print */
|
||||||
|
|
||||||
if (progress_style == PROGRESS_CLASSIC)
|
if (progress_style == PROGRESS_CLASSIC)
|
||||||
cprintf("\r%s ", pad(buf, sizeof(buf), ".", sizeof(buf)));
|
cprintf("\r%s ", pad(buf, sizeof(buf), ".", sizeof(buf)));
|
||||||
else
|
else
|
||||||
@@ -344,24 +347,65 @@ void printv(const char *fmt, va_list ap)
|
|||||||
|
|
||||||
void print(int rc, const char *fmt, ...)
|
void print(int rc, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
char buf[ttcols];
|
||||||
|
size_t len;
|
||||||
|
|
||||||
if (progress_style == PROGRESS_SILENT)
|
if (progress_style == PROGRESS_SILENT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
buf[0] = 0;
|
||||||
|
len = print_timestamp(buf, sizeof(buf));
|
||||||
|
|
||||||
if (fmt) {
|
if (fmt) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
printv(fmt, ap);
|
vsnprintf(&buf[len], sizeof(buf) - len, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
strlcpy(last_desc, &buf[len], sizeof(last_desc));
|
||||||
|
} else if (rc >= 0 && last_desc[0]) {
|
||||||
|
/*
|
||||||
|
* No new description, but we have one saved from an earlier
|
||||||
|
* print(-1, ...) call. Re-print it so the final status is not
|
||||||
|
* left stranded if command output or a kernel message scrolled
|
||||||
|
* away the original description line.
|
||||||
|
*/
|
||||||
|
strlcpy(&buf[len], last_desc, sizeof(buf) - len);
|
||||||
|
} else {
|
||||||
|
buf[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rc < 0)
|
if (rc < 0) {
|
||||||
|
/* Pending state: show description with spinner, no final status yet */
|
||||||
|
if (!buf[0])
|
||||||
|
return;
|
||||||
|
delline();
|
||||||
|
if (progress_style == PROGRESS_CLASSIC)
|
||||||
|
cprintf("\r%s ", pad(buf, sizeof(buf), ".", sizeof(buf)));
|
||||||
|
else
|
||||||
|
cprintf("\r\e[K%s%s", status(3), buf);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (progress_style == PROGRESS_CLASSIC)
|
/*
|
||||||
cprintf("%s\n", status(rc));
|
* Final status. Emit description + status in a single cprintf() so
|
||||||
else
|
* both reach the console in one write(), preventing kernel messages or
|
||||||
cprintf("\r%s\n", status(rc));
|
* command output from splitting the description from its [ OK ]/[FAIL].
|
||||||
|
*/
|
||||||
|
last_desc[0] = 0;
|
||||||
|
|
||||||
|
if (buf[0]) {
|
||||||
|
delline();
|
||||||
|
if (progress_style == PROGRESS_CLASSIC)
|
||||||
|
cprintf("\r%s %s\n", pad(buf, sizeof(buf), ".", sizeof(buf)), status(rc));
|
||||||
|
else
|
||||||
|
cprintf("\r\e[K%s%s\r%s\n", status(3), buf, status(rc));
|
||||||
|
} else {
|
||||||
|
if (progress_style == PROGRESS_CLASSIC)
|
||||||
|
cprintf("%s\n", status(rc));
|
||||||
|
else
|
||||||
|
cprintf("\r%s\n", status(rc));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_desc(char *action, char *desc)
|
void print_desc(char *action, char *desc)
|
||||||
@@ -375,6 +419,18 @@ int print_result(int fail)
|
|||||||
return fail;
|
return fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reset console state and drain the output buffer before kernel takeover.
|
||||||
|
* Called just before reboot()/halt() to prevent ANSI escape codes from
|
||||||
|
* leaking into bootloader or early-kernel output.
|
||||||
|
*/
|
||||||
|
void print_exit(void)
|
||||||
|
{
|
||||||
|
tcdrain(STDERR_FILENO);
|
||||||
|
dprint(STDERR_FILENO, "\e[0m\e[?25h", 10); /* reset SGR, show cursor */
|
||||||
|
tcdrain(STDERR_FILENO);
|
||||||
|
}
|
||||||
|
|
||||||
void set_hostname(char **hostname)
|
void set_hostname(char **hostname)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ void printv (const char *fmt, va_list ap);
|
|||||||
void print (int action, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
|
void print (int action, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
|
||||||
void print_desc (char *action, char *desc);
|
void print_desc (char *action, char *desc);
|
||||||
int print_result (int fail);
|
int print_result (int fail);
|
||||||
|
void print_exit (void);
|
||||||
|
|
||||||
void set_hostname (char **hostname);
|
void set_hostname (char **hostname);
|
||||||
void networking (int updown);
|
void networking (int updown);
|
||||||
|
|||||||
+15
-1
@@ -2418,7 +2418,21 @@ void service_update_rdeps(void)
|
|||||||
if (!svc_is_noreload(svc))
|
if (!svc_is_noreload(svc))
|
||||||
continue; /* Yup, no need to stop start rdeps */
|
continue; /* Yup, no need to stop start rdeps */
|
||||||
|
|
||||||
svc_mark_affected(mkcond(svc, cond, sizeof(cond)));
|
/*
|
||||||
|
* Clear the condition immediately, before service_step_all()
|
||||||
|
* runs. cond_clear() calls cond_update() which calls
|
||||||
|
* service_step() on all affected services right now. Those
|
||||||
|
* services see COND_OFF and get service_stop() called,
|
||||||
|
* transitioning to STOPPING_STATE before we ever send SIGTERM
|
||||||
|
* to this service. Without this, the condition is only cleared
|
||||||
|
* after the service dies, by which time reverse-dependencies
|
||||||
|
* may have already crashed due to the lost connection.
|
||||||
|
* See also: api.c do_reload() which does the same for direct
|
||||||
|
* 'initctl reload <svc>' calls.
|
||||||
|
*/
|
||||||
|
mkcond(svc, cond, sizeof(cond));
|
||||||
|
cond_clear(cond);
|
||||||
|
svc_mark_affected(cond);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -424,14 +424,17 @@ void do_shutdown(shutop_t op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
print(0, "Rebooting ...");
|
print(0, "Rebooting ...");
|
||||||
|
print_exit();
|
||||||
reboot(RB_AUTOBOOT);
|
reboot(RB_AUTOBOOT);
|
||||||
} else if (op == SHUT_OFF) {
|
} else if (op == SHUT_OFF) {
|
||||||
print(0, "Powering down ...");
|
print(0, "Powering down ...");
|
||||||
|
print_exit();
|
||||||
reboot(RB_POWER_OFF);
|
reboot(RB_POWER_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Also fallback if any of the other two fails */
|
/* Also fallback if any of the other two fails */
|
||||||
print(0, "Halting ...");
|
print(0, "Halting ...");
|
||||||
|
print_exit();
|
||||||
reboot(RB_HALT_SYSTEM);
|
reboot(RB_HALT_SYSTEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user