[systemd-commits] 7 commits - src/core src/cryptsetup src/remount-api-vfs units/remount-rootfs.service units/systemd-remount-api-vfs.service.in
Lennart Poettering
lennart at kemper.freedesktop.org
Sun Apr 22 07:09:30 PDT 2012
src/core/hostname-setup.c | 25 ++++++++++++++++--------
src/core/job.c | 12 +++++------
src/core/mount.c | 5 ++--
src/core/shutdown.c | 4 ++-
src/core/transaction.c | 32 +++++++++++++++++++++++++++----
src/core/transaction.h | 21 ++++++++++++++++++++
src/cryptsetup/cryptsetup.c | 3 +-
src/remount-api-vfs/remount-api-vfs.c | 5 ++++
units/remount-rootfs.service | 1
units/systemd-remount-api-vfs.service.in | 1
10 files changed, 87 insertions(+), 22 deletions(-)
New commits:
commit ff644623750b4f672a79cab6cc52e8681e55a044
Author: Lennart Poettering <lennart at poettering.net>
Date: Sun Apr 22 15:50:52 2012 +0200
shutdown: don't try to shut down DM devices in a container
diff --git a/src/core/shutdown.c b/src/core/shutdown.c
index cd478b0..9631f92 100644
--- a/src/core/shutdown.c
+++ b/src/core/shutdown.c
@@ -356,8 +356,10 @@ int main(int argc, char *argv[]) {
log_info("Sending SIGKILL to remaining processes...");
send_signal(SIGKILL);
- if (in_container)
+ if (in_container) {
need_swapoff = false;
+ need_dm_detach = false;
+ }
/* Unmount all mountpoints, swaps, and loopback devices */
for (retries = 0; retries < FINALIZE_ATTEMPTS; retries++) {
commit fb3d2b8fec7c705d8027e6967adae0c2a86acf31
Author: Lennart Poettering <lennart at poettering.net>
Date: Sun Apr 22 15:47:38 2012 +0200
hostname: if there's already a hostname set when PID 1 is invoked, don't complain
diff --git a/src/core/hostname-setup.c b/src/core/hostname-setup.c
index 550d3c2..03b5f47 100644
--- a/src/core/hostname-setup.c
+++ b/src/core/hostname-setup.c
@@ -47,7 +47,8 @@ static int read_and_strip_hostname(const char *path, char **hn) {
assert(path);
assert(hn);
- if ((r = read_one_line_file(path, &s)) < 0)
+ r = read_one_line_file(path, &s);
+ if (r < 0)
return r;
hostname_cleanup(s);
@@ -70,7 +71,8 @@ static int read_distro_hostname(char **hn) {
assert(hn);
- if (!(f = fopen(FILENAME, "re")))
+ f = fopen(FILENAME, "re");
+ if (!f)
return -errno;
for (;;) {
@@ -90,7 +92,8 @@ static int read_distro_hostname(char **hn) {
if (!startswith_no_case(s, "HOSTNAME="))
continue;
- if (!(k = strdup(s+9))) {
+ k = strdup(s+9);
+ if (!k) {
r = -ENOMEM;
goto finish;
}
@@ -129,8 +132,8 @@ static int read_hostname(char **hn) {
/* First, try to load the generic hostname configuration file,
* that we support on all distributions */
- if ((r = read_and_strip_hostname("/etc/hostname", hn)) < 0) {
-
+ r = read_and_strip_hostname("/etc/hostname", hn);
+ if (r < 0) {
if (r == -ENOENT)
return read_distro_hostname(hn);
@@ -144,10 +147,12 @@ int hostname_setup(void) {
int r;
char *b = NULL;
const char *hn = NULL;
+ bool enoent = false;
- if ((r = read_hostname(&b)) < 0) {
+ r = read_hostname(&b);
+ if (r < 0) {
if (r == -ENOENT)
- log_info("No hostname configured.");
+ enoent = true;
else
log_warning("Failed to read configured hostname: %s", strerror(-r));
@@ -161,7 +166,8 @@ int hostname_setup(void) {
char *old_hostname = NULL;
- if ((old_hostname = gethostname_malloc())) {
+ old_hostname = gethostname_malloc();
+ if (old_hostname) {
bool already_set;
already_set = old_hostname[0] != 0;
@@ -171,6 +177,9 @@ int hostname_setup(void) {
goto finish;
}
+ if (enoent)
+ log_info("No hostname configured.");
+
hn = "localhost";
}
commit 78ff1acdfe6a1f50d4ac62dc354c667999be0508
Author: Lennart Poettering <lennart at poettering.net>
Date: Sun Apr 22 15:39:26 2012 +0200
job: the status messages are proper sentences, hence end them with a full stop
diff --git a/src/core/job.c b/src/core/job.c
index b21de44..07d4fc3 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -489,20 +489,20 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
case JOB_DONE:
if (u->condition_result)
- unit_status_printf(u, ANSI_HIGHLIGHT_GREEN_ON " OK " ANSI_HIGHLIGHT_OFF, "Started %s", unit_description(u));
+ unit_status_printf(u, ANSI_HIGHLIGHT_GREEN_ON " OK " ANSI_HIGHLIGHT_OFF, "Started %s.", unit_description(u));
break;
case JOB_FAILED:
- unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON "FAILED" ANSI_HIGHLIGHT_OFF, "Failed to start %s", unit_description(u));
+ unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON "FAILED" ANSI_HIGHLIGHT_OFF, "Failed to start %s.", unit_description(u));
unit_status_printf(u, NULL, "See 'systemctl status %s' for details.", u->id);
break;
case JOB_DEPENDENCY:
- unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " ABORT" ANSI_HIGHLIGHT_OFF, "Dependency failed. Aborted start of %s", unit_description(u));
+ unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " ABORT" ANSI_HIGHLIGHT_OFF, "Dependency failed. Aborted start of %s.", unit_description(u));
break;
case JOB_TIMEOUT:
- unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " TIME " ANSI_HIGHLIGHT_OFF, "Timed out starting %s", unit_description(u));
+ unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " TIME " ANSI_HIGHLIGHT_OFF, "Timed out starting %s.", unit_description(u));
break;
default:
@@ -514,12 +514,12 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
switch (result) {
case JOB_TIMEOUT:
- unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " TIME " ANSI_HIGHLIGHT_OFF, "Timed out stopping %s", unit_description(u));
+ unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " TIME " ANSI_HIGHLIGHT_OFF, "Timed out stopping %s.", unit_description(u));
break;
case JOB_DONE:
case JOB_FAILED:
- unit_status_printf(u, ANSI_HIGHLIGHT_GREEN_ON " OK " ANSI_HIGHLIGHT_OFF, "Stopped %s", unit_description(u));
+ unit_status_printf(u, ANSI_HIGHLIGHT_GREEN_ON " OK " ANSI_HIGHLIGHT_OFF, "Stopped %s.", unit_description(u));
break;
default:
commit e3f7277c6e50ce567f07cad5232292ec62207b8c
Author: Lennart Poettering <lennart at poettering.net>
Date: Sun Apr 22 15:35:35 2012 +0200
units: remount file systems only if /etc/fstab actually exists
diff --git a/units/remount-rootfs.service b/units/remount-rootfs.service
index 6ca057e..52a7074 100644
--- a/units/remount-rootfs.service
+++ b/units/remount-rootfs.service
@@ -12,6 +12,7 @@ Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service fsck-root.service
Before=local-fs-pre.target local-fs.target shutdown.target
Wants=local-fs-pre.target
+ConditionPathExists=/etc/fstab
[Service]
Type=oneshot
diff --git a/units/systemd-remount-api-vfs.service.in b/units/systemd-remount-api-vfs.service.in
index d1eba4b..60ff9c3 100644
--- a/units/systemd-remount-api-vfs.service.in
+++ b/units/systemd-remount-api-vfs.service.in
@@ -12,6 +12,7 @@ Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service
Before=local-fs-pre.target local-fs.target shutdown.target
Wants=local-fs-pre.target
+ConditionPathExists=/etc/fstab
[Service]
Type=oneshot
commit e0295d2651cff034ab8200156f1ece06154b7bbc
Author: Lennart Poettering <lennart at poettering.net>
Date: Sun Apr 22 15:33:43 2012 +0200
mount: don't fail if fstab doesn't exist
diff --git a/src/core/mount.c b/src/core/mount.c
index 760ffcd..dbd4893 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1537,8 +1537,9 @@ static int mount_load_etc_fstab(Manager *m) {
assert(m);
errno = 0;
- if (!(f = setmntent("/etc/fstab", "r")))
- return -errno;
+ f = setmntent("/etc/fstab", "r");
+ if (!f)
+ return errno == ENOENT ? 0 : -errno;
while ((me = getmntent(f))) {
char *where, *what;
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index f214d60..3ff0ddf 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -190,7 +190,8 @@ static char *disk_mount_point(const char *label) {
if (asprintf(&device, "/dev/mapper/%s", label) < 0)
goto finish;
- if (!(f = setmntent("/etc/fstab", "r")))
+ f = setmntent("/etc/fstab", "r");
+ if (!f)
goto finish;
while ((m = getmntent(f)))
diff --git a/src/remount-api-vfs/remount-api-vfs.c b/src/remount-api-vfs/remount-api-vfs.c
index 6cb77c1..373ae25 100644
--- a/src/remount-api-vfs/remount-api-vfs.c
+++ b/src/remount-api-vfs/remount-api-vfs.c
@@ -56,6 +56,11 @@ int main(int argc, char *argv[]) {
f = setmntent("/etc/fstab", "r");
if (!f) {
+ if (errno == ENOENT) {
+ ret = EXIT_SUCCESS;
+ goto finish;
+ }
+
log_error("Failed to open /etc/fstab: %m");
goto finish;
}
commit 59e132a7f416d7c4a33a46d791f250e03d2c2cd0
Author: Lennart Poettering <lennart at poettering.net>
Date: Sun Apr 22 15:22:52 2012 +0200
transaction: downgrade warnings about masked units
diff --git a/src/core/transaction.c b/src/core/transaction.c
index 91feab0..a8b7e4c 100644
--- a/src/core/transaction.c
+++ b/src/core/transaction.c
@@ -843,7 +843,7 @@ int transaction_add_job_and_dependencies(
if (type != JOB_STOP && unit->load_state == UNIT_MASKED) {
dbus_set_error(e, BUS_ERROR_MASKED, "Unit %s is masked.", unit->id);
- return -EINVAL;
+ return -EADDRNOTAVAIL;
}
if (!unit_job_is_applicable(unit, type)) {
@@ -913,7 +913,8 @@ int transaction_add_job_and_dependencies(
SET_FOREACH(dep, ret->unit->dependencies[UNIT_REQUIRES_OVERRIDABLE], i) {
r = transaction_add_job_and_dependencies(tr, JOB_START, dep, ret, !override, override, false, false, ignore_order, e);
if (r < 0) {
- log_warning("Cannot add dependency job for unit %s, ignoring: %s", dep->id, bus_error(e, r));
+ log_full(r == -EADDRNOTAVAIL ? LOG_DEBUG : LOG_WARNING,
+ "Cannot add dependency job for unit %s, ignoring: %s", dep->id, bus_error(e, r));
if (e)
dbus_error_free(e);
@@ -923,7 +924,8 @@ int transaction_add_job_and_dependencies(
SET_FOREACH(dep, ret->unit->dependencies[UNIT_WANTS], i) {
r = transaction_add_job_and_dependencies(tr, JOB_START, dep, ret, false, false, false, false, ignore_order, e);
if (r < 0) {
- log_warning("Cannot add dependency job for unit %s, ignoring: %s", dep->id, bus_error(e, r));
+ log_full(r == -EADDRNOTAVAIL ? LOG_DEBUG : LOG_WARNING,
+ "Cannot add dependency job for unit %s, ignoring: %s", dep->id, bus_error(e, r));
if (e)
dbus_error_free(e);
@@ -944,7 +946,8 @@ int transaction_add_job_and_dependencies(
SET_FOREACH(dep, ret->unit->dependencies[UNIT_REQUISITE_OVERRIDABLE], i) {
r = transaction_add_job_and_dependencies(tr, JOB_VERIFY_ACTIVE, dep, ret, !override, override, false, false, ignore_order, e);
if (r < 0) {
- log_warning("Cannot add dependency job for unit %s, ignoring: %s", dep->id, bus_error(e, r));
+ log_full(r == -EADDRNOTAVAIL ? LOG_DEBUG : LOG_WARNING,
+ "Cannot add dependency job for unit %s, ignoring: %s", dep->id, bus_error(e, r));
if (e)
dbus_error_free(e);
commit 7c0436b94c52915f2c39fe4a29616313378c3b78
Author: Lennart Poettering <lennart at poettering.net>
Date: Sun Apr 22 15:22:27 2012 +0200
transaction: add missing emacs and license headers
diff --git a/src/core/transaction.c b/src/core/transaction.c
index a2efcbc..91feab0 100644
--- a/src/core/transaction.c
+++ b/src/core/transaction.c
@@ -1,3 +1,24 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+ This file is part of systemd.
+
+ Copyright 2010 Lennart Poettering
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
#include "transaction.h"
#include "bus-errors.h"
diff --git a/src/core/transaction.h b/src/core/transaction.h
index 74d7461..67ace4d 100644
--- a/src/core/transaction.h
+++ b/src/core/transaction.h
@@ -1,6 +1,27 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
#ifndef footransactionhfoo
#define footransactionhfoo
+/***
+ This file is part of systemd.
+
+ Copyright 2010 Lennart Poettering
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
typedef struct Transaction Transaction;
#include "unit.h"
More information about the systemd-commits
mailing list