am a7bf5bd1: am 3c049bbe: Merge "init: add \'enable <service>\' to negate "service <service>... disabled""
* commit 'a7bf5bd104276f9c593a7e97116f08044ad176a8': init: add 'enable <service>' to negate "service <service>... disabled"
This commit is contained in:
commit
d96f05d2a7
|
@ -196,6 +196,8 @@ static void service_start_if_not_disabled(struct service *svc)
|
|||
{
|
||||
if (!(svc->flags & SVC_DISABLED)) {
|
||||
service_start(svc, NULL);
|
||||
} else {
|
||||
svc->flags |= SVC_DISABLED_START;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -238,6 +240,21 @@ int do_domainname(int nargs, char **args)
|
|||
return write_file("/proc/sys/kernel/domainname", args[1]);
|
||||
}
|
||||
|
||||
int do_enable(int nargs, char **args)
|
||||
{
|
||||
struct service *svc;
|
||||
svc = service_find_by_name(args[1]);
|
||||
if (svc) {
|
||||
svc->flags &= ~(SVC_DISABLED | SVC_RC_DISABLED);
|
||||
if (svc->flags & SVC_DISABLED_START) {
|
||||
service_start(svc, NULL);
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int do_exec(int nargs, char **args)
|
||||
{
|
||||
return -1;
|
||||
|
|
|
@ -164,7 +164,7 @@ void service_start(struct service *svc, const char *dynamic_args)
|
|||
* state and immediately takes it out of the restarting
|
||||
* state if it was in there
|
||||
*/
|
||||
svc->flags &= (~(SVC_DISABLED|SVC_RESTARTING|SVC_RESET|SVC_RESTART));
|
||||
svc->flags &= (~(SVC_DISABLED|SVC_RESTARTING|SVC_RESET|SVC_RESTART|SVC_DISABLED_START));
|
||||
svc->time_started = 0;
|
||||
|
||||
/* running processes require no additional work -- if
|
||||
|
@ -364,7 +364,7 @@ static void service_stop_or_reset(struct service *svc, int how)
|
|||
{
|
||||
/* The service is still SVC_RUNNING until its process exits, but if it has
|
||||
* already exited it shoudn't attempt a restart yet. */
|
||||
svc->flags &= (~SVC_RESTARTING);
|
||||
svc->flags &= ~(SVC_RESTARTING | SVC_DISABLED_START);
|
||||
|
||||
if ((how != SVC_DISABLED) && (how != SVC_RESET) && (how != SVC_RESTART)) {
|
||||
/* Hrm, an illegal flag. Default to SVC_DISABLED */
|
||||
|
|
|
@ -74,6 +74,7 @@ struct svcenvinfo {
|
|||
so it can be restarted with its class */
|
||||
#define SVC_RC_DISABLED 0x80 /* Remember if the disabled flag was set in the rc script */
|
||||
#define SVC_RESTART 0x100 /* Use to safely restart (stop, wait, start) a service */
|
||||
#define SVC_DISABLED_START 0x200 /* a start was requested but it was disabled at the time */
|
||||
|
||||
#define NR_SVC_SUPP_GIDS 12 /* twelve supplementary groups */
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@ static int lookup_keyword(const char *s)
|
|||
if (!strcmp(s, "omainname")) return K_domainname;
|
||||
break;
|
||||
case 'e':
|
||||
if (!strcmp(s, "nable")) return K_enable;
|
||||
if (!strcmp(s, "xec")) return K_exec;
|
||||
if (!strcmp(s, "xport")) return K_export;
|
||||
break;
|
||||
|
|
|
@ -6,6 +6,7 @@ int do_class_start(int nargs, char **args);
|
|||
int do_class_stop(int nargs, char **args);
|
||||
int do_class_reset(int nargs, char **args);
|
||||
int do_domainname(int nargs, char **args);
|
||||
int do_enable(int nargs, char **args);
|
||||
int do_exec(int nargs, char **args);
|
||||
int do_export(int nargs, char **args);
|
||||
int do_hostname(int nargs, char **args);
|
||||
|
@ -55,6 +56,7 @@ enum {
|
|||
KEYWORD(critical, OPTION, 0, 0)
|
||||
KEYWORD(disabled, OPTION, 0, 0)
|
||||
KEYWORD(domainname, COMMAND, 1, do_domainname)
|
||||
KEYWORD(enable, COMMAND, 1, do_enable)
|
||||
KEYWORD(exec, COMMAND, 1, do_exec)
|
||||
KEYWORD(export, COMMAND, 2, do_export)
|
||||
KEYWORD(group, OPTION, 0, 0)
|
||||
|
|
|
@ -178,6 +178,16 @@ class_stop <serviceclass>
|
|||
domainname <name>
|
||||
Set the domain name.
|
||||
|
||||
enable <servicename>
|
||||
Turns a disabled service into an enabled one as if the service did not
|
||||
specify disabled.
|
||||
If the service is supposed to be running, it will be started now.
|
||||
Typically used when the bootloader sets a variable that indicates a specific
|
||||
service should be started when needed. E.g.
|
||||
on property:ro.boot.myfancyhardware=1
|
||||
enable my_fancy_service_for_my_fancy_hardware
|
||||
|
||||
|
||||
insmod <path>
|
||||
Install the module at <path>
|
||||
|
||||
|
|
Loading…
Reference in New Issue