chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dbus: add generic DEFINE_BUS_PROPERTY_APPEND_ENUM() macro for enum properties
[elogind.git]
/
main.c
diff --git
a/main.c
b/main.c
index 712c79728383a8002832d506e7fe1ab55f1ff339..139770edeccc5d230af7448277bd14bbd3c6e150 100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-32,6
+32,8
@@
#include "manager.h"
#include "log.h"
#include "mount-setup.h"
#include "manager.h"
#include "log.h"
#include "mount-setup.h"
+#include "hostname-setup.h"
+#include "load-fragment.h"
static enum {
ACTION_RUN,
static enum {
ACTION_RUN,
@@
-70,7
+72,7
@@
static int parse_proc_cmdline_word(const char *word) {
};
if (startswith(word, "systemd.default="))
};
if (startswith(word, "systemd.default="))
- return set_default_unit(word + 1
5
);
+ return set_default_unit(word + 1
6
);
else if (startswith(word, "systemd.log_target=")) {
else if (startswith(word, "systemd.log_target=")) {
@@
-247,7
+249,8
@@
int main(int argc, char *argv[]) {
/* Mount /proc, /sys and friends, so that /proc/cmdline and
* /proc/$PID/fd is available. */
/* Mount /proc, /sys and friends, so that /proc/cmdline and
* /proc/$PID/fd is available. */
- mount_setup();
+ if (mount_setup() < 0)
+ goto finish;
/* Reset all signal handlers. */
assert_se(reset_all_signal_handlers() == 0);
/* Reset all signal handlers. */
assert_se(reset_all_signal_handlers() == 0);
@@
-271,6
+274,9
@@
int main(int argc, char *argv[]) {
assert_se(action == ACTION_RUN || action == ACTION_TEST);
assert_se(action == ACTION_RUN || action == ACTION_TEST);
+ /* Set up PATH unless it is already set */
+ setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", false);
+
/* Move out of the way, so that we won't block unmounts */
assert_se(chdir("/") == 0);
/* Move out of the way, so that we won't block unmounts */
assert_se(chdir("/") == 0);
@@
-289,6
+295,10
@@
int main(int argc, char *argv[]) {
log_debug("systemd running in %s mode.", manager_running_as_to_string(running_as));
log_debug("systemd running in %s mode.", manager_running_as_to_string(running_as));
+ if (running_as == MANAGER_INIT)
+ if (hostname_setup() < 0)
+ goto finish;
+
if ((r = manager_new(running_as, &m)) < 0) {
log_error("Failed to allocate manager object: %s", strerror(-r));
goto finish;
if ((r = manager_new(running_as, &m)) < 0) {
log_error("Failed to allocate manager object: %s", strerror(-r));
goto finish;
@@
-303,7
+313,12
@@
int main(int argc, char *argv[]) {
if ((r = manager_load_unit(m, default_unit, &target)) < 0) {
log_error("Failed to load default target: %s", strerror(-r));
if ((r = manager_load_unit(m, default_unit, &target)) < 0) {
log_error("Failed to load default target: %s", strerror(-r));
- goto finish;
+
+ log_info("Trying to load rescue target...");
+ if ((r = manager_load_unit(m, SPECIAL_RESCUE_TARGET, &target)) < 0) {
+ log_error("Failed to load rescue target: %s", strerror(-r));
+ goto finish;
+ }
}
if (action == ACTION_TEST) {
}
if (action == ACTION_TEST) {