summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-04 22:49:26 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-04 22:49:26 +0200
commit27b14a2297d296f7a2c47dd20d7e0c6fb8acd20c (patch)
tree3afffb52df73d2ec1d13f52701289e9c0ff9941f /main.c
parent61902ea3eb0716227c27caa84d9fb839a0c8b673 (diff)
main: initialize default boot target from argv[1]
Diffstat (limited to 'main.c')
-rw-r--r--main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/main.c b/main.c
index cb4cc211b7..838f5c89e3 100644
--- a/main.c
+++ b/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;
}