Commit cb3a3b5e authored by Tollef Fog Heen's avatar Tollef Fog Heen
Browse files

Merge remote-tracking branch 'origin/debian' into debian

parents 2bcb06e0 377f38f4
......@@ -10,4 +10,13 @@ init=/bin/systemd
to the kernel command line and then rebooting, or install the
systemd-sysv package.
Enabling persistent logging in journald
=======================================
To enable persistent logging, create /var/log/journal and set up proper
permissions:
install -d -g systemd-journal /var/log/journal
setfacl -R -nm g:adm:rx,d:g:adm:rx /var/log/journal
-- Tollef Fog Heen <tfheen@debian.org>, Wed, 12 Oct 2011 08:43:50 +0200
systemd (204-6) UNRELEASED; urgency=low
[ Michael Stapelberg ]
* Run update-rc.d defaults before update-rc.d <enable|disable>
(Closes: #722523)
* preinst: preserve var-{lock,run}.mount when upgrading from 44 to 204
(Closes: #723936)
* fstab-generator: dont rely on /usr being mounted in the initrd
(Closes: #724797)
* systemctl: mangle names when avoiding dbus (Closes: #723855)
* allow group adm read access on /var/log/journal (Closes: #717386)
* add systemd-journal group (Thanks Guido Günther) (Closes: #724668)
* copy /etc/localtime instead of symlinking (Closes: #726256)
* dont try to start autovt units when not running with systemd as pid 1
(Closes: #726466)
[ Tollef Fog Heen ]
* Make 99-systemd.rules check for /run/systemd/systemd instead of the
ill-named cgroups directory.
......
......@@ -51,7 +51,9 @@ Depends: ${shlibs:Depends},
libsystemd-login0 (= ${binary:Version}),
util-linux (>= 2.19.1-2),
initscripts (>= 2.88dsf-17),
udev
udev,
acl,
adduser
Breaks: lvm2 (<< 2.02.84-1),
lsb-base (<< 4.1+Debian4)
Conflicts: klogd
......
......@@ -80,7 +80,22 @@ fi
systemd-machine-id-setup
if ! getent group systemd-journal >/dev/null; then
addgroup --system systemd-journal
fi
# initial update of the Message Catalogs database
_update_catalog
# We don’t ship /var/log/journal currently, so only run the following fix for
# systems where the administrator has explicitly enabled persistent logging by
# creating /var/log/journal.
if [ -d /var/log/journal ]; then
# Grant read access to /var/log/journal for members of the adm group
# via a filesystem ACL. This makes them able to read the journal.
# Failure is ignored since there might be file systems mounted without
# ACL support.
setfacl -R -nm g:adm:rx,d:g:adm:rx /var/log/journal || true
fi
#DEBHELPER#
......@@ -194,9 +194,7 @@ static bool mount_is_network(struct mntent *me) {
static bool mount_in_initrd(struct mntent *me) {
assert(me);
return
hasmntopt(me, "x-initrd.mount") ||
streq(me->mnt_dir, "/usr");
return hasmntopt(me, "x-initrd.mount");
}
static int add_mount(
......
......@@ -978,6 +978,11 @@ int manager_spawn_autovt(Manager *m, int vtnr) {
(unsigned) vtnr != m->reserve_vt)
return 0;
/* It only makes sense to send a StartUnit call to systemd if this
* machine is actually booted with systemd. */
if (!sd_booted())
return 0;
if ((unsigned) vtnr != m->reserve_vt) {
/* If this is the reserved TTY, we'll start the getty
* on it in any case, but otherwise only if it is not
......
......@@ -4244,33 +4244,37 @@ static int enable_unit(DBusConnection *bus, char **args) {
_cleanup_dbus_error_free_ DBusError error;
_cleanup_strv_free_ char **mangled_names = NULL;
dbus_error_init(&error);
if (!args[1])
return 0;
r = mangle_names(args+1, &mangled_names);
if (r < 0)
goto finish;
r = enable_sysv_units(args);
if (r < 0)
return r;
if (!args[1])
return 0;
dbus_error_init(&error);
if (!bus || avoid_bus()) {
if (streq(verb, "enable")) {
r = unit_file_enable(arg_scope, arg_runtime, arg_root, args+1, arg_force, &changes, &n_changes);
r = unit_file_enable(arg_scope, arg_runtime, arg_root, mangled_names, arg_force, &changes, &n_changes);
carries_install_info = r;
} else if (streq(verb, "disable"))
r = unit_file_disable(arg_scope, arg_runtime, arg_root, args+1, &changes, &n_changes);
r = unit_file_disable(arg_scope, arg_runtime, arg_root, mangled_names, &changes, &n_changes);
else if (streq(verb, "reenable")) {
r = unit_file_reenable(arg_scope, arg_runtime, arg_root, args+1, arg_force, &changes, &n_changes);
r = unit_file_reenable(arg_scope, arg_runtime, arg_root, mangled_names, arg_force, &changes, &n_changes);
carries_install_info = r;
} else if (streq(verb, "link"))
r = unit_file_link(arg_scope, arg_runtime, arg_root, args+1, arg_force, &changes, &n_changes);
r = unit_file_link(arg_scope, arg_runtime, arg_root, mangled_names, arg_force, &changes, &n_changes);
else if (streq(verb, "preset")) {
r = unit_file_preset(arg_scope, arg_runtime, arg_root, args+1, arg_force, &changes, &n_changes);
r = unit_file_preset(arg_scope, arg_runtime, arg_root, mangled_names, arg_force, &changes, &n_changes);
carries_install_info = r;
} else if (streq(verb, "mask"))
r = unit_file_mask(arg_scope, arg_runtime, arg_root, args+1, arg_force, &changes, &n_changes);
r = unit_file_mask(arg_scope, arg_runtime, arg_root, mangled_names, arg_force, &changes, &n_changes);
else if (streq(verb, "unmask"))
r = unit_file_unmask(arg_scope, arg_runtime, arg_root, args+1, &changes, &n_changes);
r = unit_file_unmask(arg_scope, arg_runtime, arg_root, mangled_names, &changes, &n_changes);
else
assert_not_reached("Unknown verb");
......@@ -4329,10 +4333,6 @@ static int enable_unit(DBusConnection *bus, char **args) {
dbus_message_iter_init_append(m, &iter);
r = mangle_names(args+1, &mangled_names);
if(r < 0)
goto finish;
r = bus_append_strv_iter(&iter, mangled_names);
if (r < 0) {
log_error("Failed to append unit files.");
......
......@@ -153,6 +153,94 @@ static bool valid_timezone(const char *name) {
return true;
}
static int symlink_or_copy(const char *from, const char *to) {
char *pf = NULL, *pt = NULL;
struct stat a, b;
int r;
assert(from);
assert(to);
if (path_get_parent(from, &pf) < 0 ||
path_get_parent(to, &pt) < 0) {
r = -ENOMEM;
goto finish;
}
if (stat(pf, &a) < 0 ||
stat(pt, &b) < 0) {
r = -errno;
goto finish;
}
if (a.st_dev != b.st_dev) {
free(pf);
free(pt);
return copy_file(from, to);
}
if (symlink(from, to) < 0) {
r = -errno;
goto finish;
}
r = 0;
finish:
free(pf);
free(pt);
return r;
}
static int symlink_or_copy_atomic(const char *from, const char *to) {
char *t, *x;
const char *fn;
size_t k;
unsigned long long ull;
unsigned i;
int r;
assert(from);
assert(to);
t = new(char, strlen(to) + 1 + 16 + 1);
if (!t)
return -ENOMEM;
fn = path_get_file_name(to);
k = fn-to;
memcpy(t, to, k);
t[k] = '.';
x = stpcpy(t+k+1, fn);
ull = random_ull();
for (i = 0; i < 16; i++) {
*(x++) = hexchar(ull & 0xF);
ull >>= 4;
}
*x = 0;
r = symlink_or_copy(from, t);
if (r < 0) {
unlink(t);
free(t);
return r;
}
if (rename(t, to) < 0) {
r = -errno;
unlink(t);
free(t);
return r;
}
free(t);
return r;
}
static int read_data(void) {
int r;
_cleanup_free_ char *t = NULL;
......@@ -220,7 +308,7 @@ static int write_data_timezone(void) {
if (!p)
return log_oom();
r = symlink_atomic(p, "/etc/localtime");
r = symlink_or_copy_atomic(p, "/etc/localtime");
if (r < 0)
return r;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment