mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-12 09:17:44 +03:00
main: initialize default boot target from argv[1]
This commit is contained in:
parent
61902ea3eb
commit
27b14a2297
10
main.c
10
main.c
@ -34,6 +34,12 @@ int main(int argc, char *argv[]) {
|
||||
Unit *target = NULL;
|
||||
Job *job = NULL;
|
||||
int r, retval = 1;
|
||||
const char *default_unit;
|
||||
|
||||
if (argc >= 2)
|
||||
default_unit = argv[1];
|
||||
else
|
||||
default_unit = SPECIAL_DEFAULT_TARGET;
|
||||
|
||||
if ((r = manager_new(&m)) < 0) {
|
||||
log_error("Failed to allocate manager object: %s", strerror(-r));
|
||||
@ -45,7 +51,9 @@ int main(int argc, char *argv[]) {
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if ((r = manager_load_unit(m, SPECIAL_DEFAULT_TARGET, &target)) < 0) {
|
||||
log_debug("Activating default unit: %s", default_unit);
|
||||
|
||||
if ((r = manager_load_unit(m, default_unit, &target)) < 0) {
|
||||
log_error("Failed to load default target: %s", strerror(-r));
|
||||
goto finish;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user