run0: allow explicit control of service manager activation for run0 sessions
This adds a new --lightweight=yes/no switch which allows controlling whether the invoked service will have the service manager around or not. Moreover, this changes that if the target user is root it will now support to the lightweight mode, i.e. run0 towards root will no longer pull in the service manager (a real tty login via getty still will though!). My thinking here is that quickly raising privileges via run0 probably shouldn't be considered a proper login but just something short lived, temporary for a single command or similar.
This commit is contained in:
@@ -31,6 +31,26 @@ int parse_boolean_argument(const char *optname, const char *s, bool *ret) {
|
||||
}
|
||||
}
|
||||
|
||||
int parse_tristate_argument(const char *optname, const char *s, int *ret) {
|
||||
int r;
|
||||
|
||||
if (s) {
|
||||
r = parse_boolean(s);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to parse boolean argument to %s: %s.", optname, s);
|
||||
|
||||
if (ret)
|
||||
*ret = r;
|
||||
|
||||
return r;
|
||||
} else {
|
||||
if (ret)
|
||||
*ret = -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int parse_json_argument(const char *s, sd_json_format_flags_t *ret) {
|
||||
assert(s);
|
||||
assert(ret);
|
||||
|
||||
Reference in New Issue
Block a user