Stephan Kulow 2013-06-20 13:51:16 +00:00 committed by Git OBS Bridge
commit c9cfc69bc4
67 changed files with 11892 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,74 @@
From 53113dc8254cae9a27e321e539d2d876677e61b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 7 Jun 2013 22:01:03 -0400
Subject: [PATCH] journal: letting (interleaved) seqnums go
In the following scenario:
server creates system.journal
server creates user-1000.journal
both journals share the same seqnum_id.
Then
server writes to user-1000.journal first,
and server writes to system.journal a bit later,
and everything is fine.
The server then terminates (crash, reboot, rsyslog testing,
whatever), and user-1000.journal has entries which end with
a lower seqnum than system.journal. Now
server is restarted
server opens user-1000.journal and writes entries to it...
BAM! duplicate seqnums for the same seqnum_id.
Now, we usually don't see that happen, because system.journal
is closed last, and opened first. Since usually at least one
message is written during boot and lands in the system.journal,
the seqnum is initialized from it, and is set to a number higher
than than anything found in user journals. Nevertheless, if
system.journal is corrupted and is rotated, it can happen that
an entry is written to the user journal with a seqnum that is
a duplicate with an entry found in the corrupted system.journal~.
When browsing the journal, journalctl can fall into a loop
where it tries to follow the seqnums, and tries to go the
next location by seqnum, and is transported back in time to
to the older duplicate seqnum. There is not way to find
out the maximum seqnum used in a multiple files, without
actually looking at all of them. But we don't want to do
that because it would be slow, and actually it isn't really
possible, because a file might e.g. be temporarily unaccessible.
Fix the problem by using different seqnum series for user
journals. Using the same seqnum series for rotated journals
is still fine, because we know that nothing will write
to the rotated journal anymore.
Likely related:
https://bugs.freedesktop.org/show_bug.cgi?id=64566
https://bugs.freedesktop.org/show_bug.cgi?id=59856
https://bugs.freedesktop.org/show_bug.cgi?id=64296
https://bugs.archlinux.org/task/35581
https://bugzilla.novell.com/show_bug.cgi?id=817778
Possibly related:
https://bugs.freedesktop.org/show_bug.cgi?id=64293
Conflicts:
src/journal/journald-server.c
---
src/journal/journald-server.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index cc52b8a..cde63c8 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -280,7 +280,7 @@ static JournalFile* find_journal(Server *s, uid_t uid) {
journal_file_close(f);
}
- r = journal_file_open_reliably(p, O_RDWR|O_CREAT, 0640, s->compress, s->seal, &s->system_metrics, s->mmap, s->system_journal, &f);
+ r = journal_file_open_reliably(p, O_RDWR|O_CREAT, 0640, s->compress, s->seal, &s->system_metrics, s->mmap, NULL, &f);
free(p);
if (r < 0)
--
1.8.2.1

View File

@ -0,0 +1,122 @@
From 87011c25d96e9fbcd8a465ba758fa037c7d08203 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 6 Jun 2013 22:28:05 -0400
Subject: [PATCH 01/13] journal: remember last direction of search and keep
offset cache
The fields in JournalFile are moved around to avoid wasting
7 bytes because of alignment.
---
TODO | 3 ---
src/journal/journal-file.h | 18 +++++++++++-------
src/journal/sd-journal.c | 11 +++++------
3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/TODO b/TODO
index 0dd19a0..1dc585c 100644
--- a/TODO
+++ b/TODO
@@ -77,9 +77,6 @@ Features:
* investigate endianess issues of UUID vs. GUID
-* see if we can fix https://bugs.freedesktop.org/show_bug.cgi?id=63672
- without dropping the location cache entirely.
-
* dbus: when a unit failed to load (i.e. is in UNIT_ERROR state), we
should be able to safely try another attempt when the bus call LoadUnit() is invoked.
diff --git a/src/journal/journal-file.h b/src/journal/journal-file.h
index 7b1cd42..5cc2c2d 100644
--- a/src/journal/journal-file.h
+++ b/src/journal/journal-file.h
@@ -42,10 +42,14 @@ typedef struct JournalMetrics {
uint64_t keep_free;
} JournalMetrics;
+typedef enum direction {
+ DIRECTION_UP,
+ DIRECTION_DOWN
+} direction_t;
+
typedef struct JournalFile {
int fd;
- char *path;
- struct stat last_stat;
+
mode_t mode;
int flags;
@@ -56,6 +60,11 @@ typedef struct JournalFile {
bool tail_entry_monotonic_valid;
+ direction_t last_direction;
+
+ char *path;
+ struct stat last_stat;
+
Header *header;
HashItem *data_hash_table;
HashItem *field_hash_table;
@@ -90,11 +99,6 @@ typedef struct JournalFile {
#endif
} JournalFile;
-typedef enum direction {
- DIRECTION_UP,
- DIRECTION_DOWN
-} direction_t;
-
int journal_file_open(
const char *fname,
int flags,
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 3aa9ed4..4c4cc2d 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -102,7 +102,8 @@ static void init_location(Location *l, LocationType type, JournalFile *f, Object
l->seqnum_set = l->realtime_set = l->monotonic_set = l->xor_hash_set = true;
}
-static void set_location(sd_journal *j, LocationType type, JournalFile *f, Object *o, uint64_t offset) {
+static void set_location(sd_journal *j, LocationType type, JournalFile *f, Object *o,
+ direction_t direction, uint64_t offset) {
assert(j);
assert(type == LOCATION_DISCRETE || type == LOCATION_SEEK);
assert(f);
@@ -110,12 +111,10 @@ static void set_location(sd_journal *j, LocationType type, JournalFile *f, Objec
init_location(&j->current_location, type, f, o);
- if (j->current_file)
- j->current_file->current_offset = 0;
-
j->current_file = f;
j->current_field = 0;
+ f->last_direction = direction;
f->current_offset = offset;
}
@@ -811,7 +810,7 @@ static int next_beyond_location(sd_journal *j, JournalFile *f, direction_t direc
assert(j);
assert(f);
- if (f->current_offset > 0) {
+ if (f->last_direction == direction && f->current_offset > 0) {
cp = f->current_offset;
r = journal_file_move_to_object(f, OBJECT_ENTRY, cp, &c);
@@ -908,7 +907,7 @@ static int real_journal_next(sd_journal *j, direction_t direction) {
if (r < 0)
return r;
- set_location(j, LOCATION_DISCRETE, new_file, o, new_offset);
+ set_location(j, LOCATION_DISCRETE, new_file, o, direction, new_offset);
return 1;
}
--
1.8.2.1

View File

@ -0,0 +1,87 @@
From 7f20c71497ec7c78c6d2572a0d7075f78b14548a Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Tue, 28 May 2013 20:45:34 +0200
Subject: [PATCH 4/8] journald: DO recalculate the ACL mask, but only if it
doesn't exist
Since 11ec7ce, journald isn't setting the ACLs properly anymore if
the files had no ACLs to begin with: acl_set_fd fails with EINVAL.
An ACL with ACL_USER or ACL_GROUP entries but no ACL_MASK entry is
invalid, so make sure a mask exists before trying to set the ACL.
---
src/journal/journald-server.c | 6 ++++--
src/shared/acl-util.c | 28 ++++++++++++++++++++++++++++
src/shared/acl-util.h | 1 +
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index cc52b8a..01f23ce 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -227,9 +227,11 @@ void server_fix_perms(Server *s, JournalFile *f, uid_t uid) {
}
}
- /* We do not recalculate the mask here, so that the fchmod() mask above stays intact. */
+ /* We do not recalculate the mask unconditionally here,
+ * so that the fchmod() mask above stays intact. */
if (acl_get_permset(entry, &permset) < 0 ||
- acl_add_perm(permset, ACL_READ) < 0) {
+ acl_add_perm(permset, ACL_READ) < 0 ||
+ calc_acl_mask_if_needed(&acl) < 0) {
log_warning("Failed to patch ACL on %s, ignoring: %m", f->path);
goto finish;
}
diff --git a/src/shared/acl-util.c b/src/shared/acl-util.c
index 48bb12f..fb04e49 100644
--- a/src/shared/acl-util.c
+++ b/src/shared/acl-util.c
@@ -69,6 +69,34 @@ int acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *entry) {
return 0;
}
+int calc_acl_mask_if_needed(acl_t *acl_p) {
+ acl_entry_t i;
+ int found;
+
+ assert(acl_p);
+
+ for (found = acl_get_entry(*acl_p, ACL_FIRST_ENTRY, &i);
+ found > 0;
+ found = acl_get_entry(*acl_p, ACL_NEXT_ENTRY, &i)) {
+
+ acl_tag_t tag;
+
+ if (acl_get_tag_type(i, &tag) < 0)
+ return -errno;
+
+ if (tag == ACL_MASK)
+ return 0;
+ }
+
+ if (found < 0)
+ return -errno;
+
+ if (acl_calc_mask(acl_p) < 0)
+ return -errno;
+
+ return 0;
+}
+
int search_acl_groups(char*** dst, const char* path, bool* belong) {
acl_t acl;
diff --git a/src/shared/acl-util.h b/src/shared/acl-util.h
index 23090d9..36ef490 100644
--- a/src/shared/acl-util.h
+++ b/src/shared/acl-util.h
@@ -24,4 +24,5 @@
#include <stdbool.h>
int acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *entry);
+int calc_acl_mask_if_needed(acl_t *acl_p);
int search_acl_groups(char*** dst, const char* path, bool* belong);
--
1.8.1.4

View File

@ -0,0 +1,36 @@
From 3b1680e04cb0ff0e4cf180dbacd067f1f99316a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 3 Jun 2013 13:55:13 -0400
Subject: [PATCH 6/8] systemctl,core: allow nuking of symlinks to removed units
Before, one the unit file was deleted, install_context_for_removal()
would refuse to look for symlinks. But we can remove dangling symlinks
anyway.
In principle, package installation/deinstallation scripts should do
that before the unit is uninstalled, but they don't always do. Also,
a user might have added additional symlinks manually.
https://bugs.freedesktop.org/show_bug.cgi?id=62395
---
src/shared/install.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/shared/install.c b/src/shared/install.c
index edf4d2a..a695e12 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1413,7 +1413,9 @@ static int install_context_mark_for_removal(
assert_se(hashmap_move_one(c->have_installed, c->will_install, i->name) == 0);
q = unit_file_search(c, i, paths, root_dir, false);
- if (q < 0) {
+ if (q == -ENOENT) {
+ /* do nothing */
+ } else if (q < 0) {
if (r >= 0)
r = q;
--
1.8.1.4

View File

@ -0,0 +1,29 @@
From 3608595751f62bbc6d37eb78b746ab6fecfa2d45 Mon Sep 17 00:00:00 2001
From: Ross Lagerwall <rosslagerwall@gmail.com>
Date: Sun, 9 Jun 2013 17:28:44 +0100
Subject: [PATCH 8/8] service: don't report alien child as alive when it's not
When a sigchld is received from an alien child, main_pid is set to
0 then service_enter_running calls main_pid_good to check if the
child is running. This incorrectly returned true because
kill(main_pid, 0) would return >= 0.
This fixes an error where a service would die and the cgroup would
become empty but the service would still report as active (running).
---
src/core/service.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: systemd-204/src/core/service.c
===================================================================
--- systemd-204.orig/src/core/service.c
+++ systemd-204/src/core/service.c
@@ -1933,7 +1933,7 @@ static int main_pid_good(Service *s) {
/* If it's an alien child let's check if it is still
* alive ... */
- if (s->main_pid_alien)
+ if (s->main_pid_alien && s->main_pid > 0)
return kill(s->main_pid, 0) >= 0 || errno != ESRCH;
/* .. otherwise assume we'll get a SIGCHLD for it,

View File

@ -0,0 +1,120 @@
From: Robert Milasan <rmilasan@suse.com>
Date: Thu, 12 Jul 2012 15:56:34 +0000
Subject: re-enable by_path links for ata devices
Fix by-path links for ATA transport (bnc#770910)
---
src/udev/udev-builtin-path_id.c | 92 +++++++++++++++++++++++++++++++++++------
1 file changed, 80 insertions(+), 12 deletions(-)
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
index da02731..a77d4e8 100644
--- a/src/udev/udev-builtin-path_id.c
+++ b/src/udev/udev-builtin-path_id.c
@@ -338,6 +338,85 @@ static struct udev_device *handle_scsi_hyperv(struct udev_device *parent, char *
return parent;
}
+static struct udev_device *handle_ata(struct udev_device *parent, char **path)
+{
+ struct udev_device *hostdev;
+ int host, bus, target, lun;
+ const char *name;
+ char *base;
+ char *pos;
+ DIR *dir;
+ struct dirent *dent;
+ int basenum, len;
+
+ hostdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_host");
+ if (hostdev == NULL)
+ return NULL;
+
+ name = udev_device_get_sysname(parent);
+ if (sscanf(name, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4)
+ return NULL;
+
+ /* rebase ata offset to get the local relative number */
+ basenum = -1;
+ base = strdup(udev_device_get_syspath(hostdev));
+ if (base == NULL)
+ return NULL;
+ pos = strrchr(base, '/');
+ if (pos == NULL) {
+ parent = NULL;
+ goto out;
+ }
+ pos[0] = '\0';
+ len = strlen(base) - 5;
+ if (len <= 0) {
+ parent = NULL;
+ goto out;
+ }
+ base[len] = '\0';
+ dir = opendir(base);
+ if (dir == NULL) {
+ parent = NULL;
+ goto out;
+ }
+ for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
+ char *rest;
+ int i;
+
+ if (dent->d_name[0] == '.')
+ continue;
+ if (dent->d_type != DT_DIR && dent->d_type != DT_LNK)
+ continue;
+ if (strncmp(dent->d_name, "ata", 3) != 0)
+ continue;
+ i = strtoul(&dent->d_name[3], &rest, 10);
+
+ /* ata devices start with 1, so decrease by 1 if i is bigger then 0 */
+ if (i > 0)
+ i--;
+ if (rest[0] != '\0')
+ continue;
+ /*
+ * find the smallest number; the host really needs to export its
+ * own instance number per parent device; relying on the global host
+ * enumeration and plainly rebasing the numbers sounds unreliable
+ */
+ if (basenum == -1 || i < basenum)
+ basenum = i;
+ }
+ closedir(dir);
+ if (basenum == -1) {
+ parent = NULL;
+ goto out;
+ }
+ host -= basenum;
+
+ path_prepend(path, "scsi-%u:%u:%u:%u", host, bus, target, lun);
+out:
+ free(base);
+ return hostdev;
+}
+
static struct udev_device *handle_scsi(struct udev_device *parent, char **path)
{
const char *devtype;
@@ -374,19 +453,8 @@ static struct udev_device *handle_scsi(struct udev_device *parent, char **path)
goto out;
}
- /*
- * We do not support the ATA transport class, it uses global counters
- * to name the ata devices which numbers spread across multiple
- * controllers.
- *
- * The real link numbers are not exported. Also, possible chains of ports
- * behind port multipliers cannot be composed that way.
- *
- * Until all that is solved at the kernel level, there are no by-path/
- * links for ATA devices.
- */
if (strstr(name, "/ata") != NULL) {
- parent = NULL;
+ parent = handle_ata(parent, path);
goto out;
}

View File

@ -0,0 +1,24 @@
From: Robert Milasan <rmilasan@suse.com>
Date: Wed, 27 Jun 2012 08:55:59 +0000
Subject: rules create by id scsi links for ATA devices
Re-enable creation of by-id scsi links for ATA devices. (bnc#769002)
---
rules/60-persistent-storage.rules | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules
index a4d009a..f720c7e 100644
--- a/rules/60-persistent-storage.rules
+++ b/rules/60-persistent-storage.rules
@@ -42,6 +42,10 @@ KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="s
KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
+# scsi compat links for ATA devices
+KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="ata", PROGRAM="scsi_id --whitelisted --replace-whitespace -p0x80 -d $devnode", RESULT=="?*", ENV{ID_SCSI_COMPAT}="$result", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}"
+KERNEL=="sd*[0-9]", ENV{ID_SCSI_COMPAT}=="?*", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}-part%n"
+
# firewire
KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}"
KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n"

View File

@ -0,0 +1,22 @@
From: Robert Milasan <rmilasan@suse.com>
Date: Mon, 6 Aug 2012 13:35:34 +0000
Subject: udev netlink null rules
udevd race for netlink events (bnc#774646)
---
src/udev/udevd.c | 2 ++
1 file changed, 2 insertions(+)
Index: systemd-202/src/udev/udevd.c
===================================================================
--- systemd-202.orig/src/udev/udevd.c
+++ systemd-202/src/udev/udevd.c
@@ -1407,6 +1407,8 @@ int main(int argc, char *argv[])
dev = udev_monitor_receive_device(monitor);
if (dev != NULL) {
udev_device_set_usec_initialized(dev, now(CLOCK_MONOTONIC));
+ if (rules == NULL)
+ rules = udev_rules_new(udev, resolve_names);
if (event_queue_insert(dev) < 0)
udev_device_unref(dev);
}

View File

@ -0,0 +1,22 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Wed, 5 Dec 2012 15:13:27 +0000
Subject: fix devname prefix
fix modules.devname path, it isn't in /usr.
---
src/udev/udevd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: systemd-202/src/udev/udevd.c
===================================================================
--- systemd-202.orig/src/udev/udevd.c
+++ systemd-202/src/udev/udevd.c
@@ -824,7 +824,7 @@ static void static_dev_create_from_modul
return;
}
- strscpyl(modules, sizeof(modules), ROOTPREFIX "/lib/modules/", kernel.release, "/modules.devname", NULL);
+ strscpyl(modules, sizeof(modules), "/lib/modules/", kernel.release, "/modules.devname", NULL);
f = fopen(modules, "re");
if (f == NULL)
return;

View File

@ -0,0 +1,24 @@
From: Robert Milasan <rmilasan@suse.com>
Date: Tue, 12 Feb 2013 09:16:23 +0000
Subject: create default links for primary cd_dvd drive
cdrom_id: created links for the default cd/dvd drive (bnc#783054).
---
rules/60-cdrom_id.rules | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/rules/60-cdrom_id.rules b/rules/60-cdrom_id.rules
index 6eaf76a..ec0b19a 100644
--- a/rules/60-cdrom_id.rules
+++ b/rules/60-cdrom_id.rules
@@ -15,6 +15,9 @@ ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $devnode", GOTO="cdr
# enable the receiving of media eject button events
IMPORT{program}="cdrom_id --lock-media $devnode"
-KERNEL=="sr0", SYMLINK+="cdrom", OPTIONS+="link_priority=-100"
+KERNEL=="sr0", ENV{ID_CDROM}=="1", SYMLINK+="cdrom", OPTIONS+="link_priority=-100"
+KERNEL=="sr0", ENV{ID_CDROM_CD_RW}=="1", SYMLINK+="cdrw", OPTIONS+="link_priority=-100"
+KERNEL=="sr0", ENV{ID_CDROM_DVD}=="1", SYMLINK+="dvd", OPTIONS+="link_priority=-100"
+KERNEL=="sr0", ENV{ID_CDROM_DVD_RW}=="1", SYMLINK+="dvdrw", OPTIONS+="link_priority=-100"
LABEL="cdrom_end"

View File

@ -0,0 +1,77 @@
From: Robert Milasan <rmilasan@suse.com>
Date: Thu, 28 Mar 2013 09:24:43 +0000
Subject: udev always rename network
udev: ensure that the network interfaces are renamed even if they exist
(bnc#809843).
---
src/udev/udev-event.c | 46 +++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 43 insertions(+), 3 deletions(-)
Index: systemd-204/src/udev/udev-event.c
===================================================================
--- systemd-204.orig/src/udev/udev-event.c
+++ systemd-204/src/udev/udev-event.c
@@ -750,6 +750,7 @@ static int rename_netif(struct udev_even
struct udev_device *dev = event->dev;
int sk;
struct ifreq ifr;
+ int loop;
int err;
log_debug("changing net interface name from '%s' to '%s'\n",
@@ -766,12 +767,51 @@ static int rename_netif(struct udev_even
strscpy(ifr.ifr_name, IFNAMSIZ, udev_device_get_sysname(dev));
strscpy(ifr.ifr_newname, IFNAMSIZ, event->name);
err = ioctl(sk, SIOCSIFNAME, &ifr);
- if (err >= 0) {
+ if (err == 0) {
print_kmsg("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
- } else {
+ goto out;
+ }
+
+ /* keep trying if the destination interface name already exists */
+ err = -errno;
+ if (err != -EEXIST) {
+ goto out;
+ }
+
+ /* free our own name, another process may wait for us */
+ snprintf(ifr.ifr_newname, IFNAMSIZ, "rename%u", udev_device_get_ifindex(dev));
+ err = ioctl(sk, SIOCSIFNAME, &ifr);
+ if (err < 0) {
err = -errno;
- log_error("error changing net interface name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname);
+ goto out;
}
+
+ /* log temporary name */
+ print_kmsg("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
+
+ /* wait a maximum of 90 seconds for our target to become available */
+ strscpy(ifr.ifr_name, IFNAMSIZ, ifr.ifr_newname);
+ strscpy(ifr.ifr_newname, IFNAMSIZ, event->name);
+ loop = 90 * 20;
+ while (loop--) {
+ const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 };
+
+ log_debug("wait for netif '%s' to become free, loop=%i\n", event->name, (90 * 20) - loop);
+ nanosleep(&duration, NULL);
+
+ err = ioctl(sk, SIOCSIFNAME, &ifr);
+ if (err == 0) {
+ print_kmsg("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
+ break;
+ }
+ err = -errno;
+ if (err != -EEXIST)
+ break;
+ }
+
+out:
+ if (err < 0)
+ log_error("error changing net interface name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname);
close(sk);
return err;
}

View File

@ -0,0 +1,29 @@
Index: systemd-204/Makefile.am
===================================================================
--- systemd-204.orig/Makefile.am
+++ systemd-204/Makefile.am
@@ -2238,6 +2238,10 @@ dist_udevrules_DATA += \
rules/73-seat-numlock.rules
# ------------------------------------------------------------------------------
+dist_udevrules_DATA += \
+ rules/61-msft.rules
+
+# ------------------------------------------------------------------------------
if ENABLE_GUDEV
if ENABLE_GTK_DOC
SUBDIRS += \
Index: systemd-204/rules/61-msft.rules
===================================================================
--- /dev/null
+++ systemd-204/rules/61-msft.rules
@@ -0,0 +1,9 @@
+# MSFT compability rules
+ACTION!="add|change", GOTO="msft_end"
+
+ENV{DEVTYPE}=="partition", IMPORT{parent}="SCSI_IDENT_*"
+KERNEL=="sd*[!0-9]|sr*", ENV{SCSI_IDENT_LUN_T10}!="?*", IMPORT{program}="/usr/bin/sg_inq -p di --export $tempnode", ENV{ID_BUS}="scsi"
+KERNEL=="sd*|sr*", ENV{DEVTYPE}=="disk", ENV{SCSI_IDENT_LUN_T10}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-1$env{SCSI_IDENT_LUN_T10}"
+KERNEL=="sd*", ENV{DEVTYPE}=="partition", ENV{SCSI_IDENT_LUN_T10}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-1$env{SCSI_IDENT_LUN_T10}-part%n"
+
+LABEL="msft_end"

View File

@ -0,0 +1,39 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Wed, 7 Dec 2011 15:15:07 +0000
Subject: Fix /run/lock directories permissions to follow openSUSE policy
disable /var/lock/{subsys,lockdev} and change default permissions on
/var/lock (bnc#733523).
---
tmpfiles.d/legacy.conf | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tmpfiles.d/legacy.conf b/tmpfiles.d/legacy.conf
index 3fff347..81d5e47 100644
--- a/tmpfiles.d/legacy.conf
+++ b/tmpfiles.d/legacy.conf
@@ -10,12 +10,13 @@
# These files are considered legacy and are unnecessary on legacy-free
# systems.
-d /run/lock 0755 root root -
+# changed for openSUSE : only /run/lock should be available
+d /run/lock 0775 root lock -
# /run/lock/subsys is used for serializing SysV service execution, and
# hence without use on SysV-less systems.
-d /run/lock/subsys 0755 root root -
+#d /run/lock/subsys 0755 root root -
# /run/lock/lockdev is used to serialize access to tty devices via
# LCK..xxx style lock files, For more information see:
@@ -23,7 +24,7 @@ d /run/lock/subsys 0755 root root -
# On modern systems a BSD file lock is a better choice if
# serialization is needed on those devices.
-d /run/lock/lockdev 0775 root lock -
+#d /run/lock/lockdev 0775 root lock -
# /forcefsck, /fastboot and /forcequotecheck are deprecated in favor of the
# kernel command line options 'fsck.mode=force', 'fsck.mode=skip' and

View File

@ -0,0 +1,96 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Tue, 19 Feb 2013 11:20:31 +0100
Subject: Forward suspend / hibernate calls to pm-utils
forward suspend/hibernation calls to pm-utils, if installed (bnc#790157)
---
src/sleep/sleep.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
index a56ab89..232ab67 100644
--- a/src/sleep/sleep.c
+++ b/src/sleep/sleep.c
@@ -24,6 +24,7 @@
#include <errno.h>
#include <string.h>
#include <getopt.h>
+#include <stdlib.h>
#include "systemd/sd-id128.h"
#include "systemd/sd-messages.h"
@@ -35,6 +36,8 @@
#include "sleep-config.h"
static char* arg_verb = NULL;
+static bool delegate_to_pmutils = false;
+static const char *pmtools;
static int write_mode(char **modes) {
int r = 0;
@@ -50,9 +53,6 @@ static int write_mode(char **modes) {
r = k;
}
- if (r < 0)
- log_error("Failed to write mode to /sys/power/disk: %s",
- strerror(-r));
return r;
}
@@ -90,6 +90,8 @@ static int execute(char **modes, char **states) {
FILE *f;
const char* note = strappenda("SLEEP=", arg_verb);
+ if (!delegate_to_pmutils) {
+
/* This file is opened first, so that if we hit an error,
* we can abort before modyfing any state. */
f = fopen("/sys/power/state", "we");
@@ -102,6 +104,7 @@ static int execute(char **modes, char **states) {
r = write_mode(modes);
if (r < 0)
return r;
+ }
arguments[0] = NULL;
arguments[1] = (char*) "pre";
@@ -114,8 +117,10 @@ static int execute(char **modes, char **states) {
"MESSAGE=Suspending system...",
note,
NULL);
-
+ if (!delegate_to_pmutils)
r = write_state(f, states);
+ else
+ r = -system(pmtools);
if (r < 0)
return r;
@@ -158,6 +163,7 @@ static int parse_argv(int argc, char *argv[]) {
};
int c;
+ struct stat buf;
assert(argc >= 0);
assert(argv);
@@ -196,6 +202,18 @@ static int parse_argv(int argc, char *argv[]) {
return -EINVAL;
}
+ if (streq(arg_verb, "suspend")) {
+ pmtools = "/usr/sbin/pm-suspend";
+ }
+ else if (streq(arg_verb, "hibernate") || streq(arg_verb, "hybrid-sleep")) {
+ if (streq(arg_verb, "hibernate"))
+ pmtools = "/usr/sbin/pm-hibernate";
+ else
+ pmtools = "/usr/sbin/pm-suspend-hybrid";
+ }
+
+ delegate_to_pmutils = (stat(pmtools, &buf) >= 0 && S_ISREG(buf.st_mode) && (buf.st_mode & 0111));
+
return 1 /* work to do */;
}

View File

@ -0,0 +1,140 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Fri, 12 Apr 2013 16:56:26 +0200
Subject: Revert "service: drop support for SysV scripts for the early boot"
This reverts commit 3cdebc217c42c8529086f2965319b6a48eaaeabe.
Conflicts:
src/core/service.c
---
src/core/service.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 46 insertions(+), 5 deletions(-)
Index: systemd-204/src/core/service.c
===================================================================
--- systemd-204.orig/src/core/service.c
+++ systemd-204/src/core/service.c
@@ -51,7 +51,8 @@
typedef enum RunlevelType {
RUNLEVEL_UP,
- RUNLEVEL_DOWN
+ RUNLEVEL_DOWN,
+ RUNLEVEL_SYSINIT
} RunlevelType;
static const struct {
@@ -66,6 +67,16 @@ static const struct {
{ "rc4.d", SPECIAL_RUNLEVEL4_TARGET, RUNLEVEL_UP },
{ "rc5.d", SPECIAL_RUNLEVEL5_TARGET, RUNLEVEL_UP },
+#ifdef HAVE_SYSV_COMPAT
+ /* SUSE style boot.d */
+ { "boot.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_SYSINIT },
+#endif
+
+#if defined(TARGET_DEBIAN) || defined(TARGET_UBUNTU) || defined(TARGET_ANGSTROM)
+ /* Debian style rcS.d */
+ { "rcS.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_SYSINIT },
+#endif
+
/* Standard SysV runlevels for shutdown */
{ "rc0.d", SPECIAL_POWEROFF_TARGET, RUNLEVEL_DOWN },
{ "rc6.d", SPECIAL_REBOOT_TARGET, RUNLEVEL_DOWN }
@@ -74,10 +85,12 @@ static const struct {
directories in this order, and we want to make sure that
sysv_start_priority is known when we first load the
unit. And that value we only know from S links. Hence
- UP must be read before DOWN */
+ UP/SYSINIT must be read before DOWN */
};
#define RUNLEVELS_UP "12345"
+/* #define RUNLEVELS_DOWN "06" */
+#define RUNLEVELS_BOOT "bBsS"
#endif
static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = {
@@ -332,6 +345,9 @@ static char *sysv_translate_name(const c
if (endswith(name, ".sh"))
/* Drop .sh suffix */
strcpy(stpcpy(r, name) - 3, ".service");
+ if (startswith(name, "boot."))
+ /* Drop SuSE-style boot. prefix */
+ strcpy(stpcpy(r, name + 5), ".service");
else
/* Normal init script name */
strcpy(stpcpy(r, name), ".service");
@@ -934,6 +950,13 @@ static int service_load_sysv_path(Servic
if ((r = sysv_exec_commands(s, supports_reload)) < 0)
goto finish;
+ if (s->sysv_runlevels &&
+ chars_intersect(RUNLEVELS_BOOT, s->sysv_runlevels) &&
+ chars_intersect(RUNLEVELS_UP, s->sysv_runlevels)) {
+ /* Service has both boot and "up" runlevels
+ configured. Kill the "up" ones. */
+ delete_chars(s->sysv_runlevels, RUNLEVELS_UP);
+ }
if (s->sysv_runlevels && !chars_intersect(RUNLEVELS_UP, s->sysv_runlevels)) {
/* If there a runlevels configured for this service
@@ -1015,6 +1038,9 @@ static int service_load_sysv_name(Servic
if (endswith(name, ".sh.service"))
return -ENOENT;
+ if (startswith(name, "boot."))
+ return -ENOENT;
+
STRV_FOREACH(p, UNIT(s)->manager->lookup_paths.sysvinit_path) {
char *path;
int r;
@@ -1035,6 +1061,18 @@ static int service_load_sysv_name(Servic
}
free(path);
+ if (r >= 0 && UNIT(s)->load_state == UNIT_STUB) {
+ /* Try SUSE style boot.* init scripts */
+
+ path = strjoin(*p, "/boot.", name, NULL);
+ if (!path)
+ return -ENOMEM;
+
+ /* Drop .service suffix */
+ path[strlen(path)-8] = 0;
+ r = service_load_sysv_path(s, path);
+ free(path);
+ }
if (r < 0)
return r;
@@ -3667,7 +3705,7 @@ static int service_enumerate(Manager *m)
if (de->d_name[0] == 'S') {
- if (rcnd_table[i].type == RUNLEVEL_UP) {
+ if (rcnd_table[i].type == RUNLEVEL_UP || rcnd_table[i].type == RUNLEVEL_SYSINIT) {
SERVICE(service)->sysv_start_priority_from_rcnd =
MAX(a*10 + b, SERVICE(service)->sysv_start_priority_from_rcnd);
@@ -3684,7 +3722,8 @@ static int service_enumerate(Manager *m)
goto finish;
} else if (de->d_name[0] == 'K' &&
- (rcnd_table[i].type == RUNLEVEL_DOWN)) {
+ (rcnd_table[i].type == RUNLEVEL_DOWN ||
+ rcnd_table[i].type == RUNLEVEL_SYSINIT)) {
r = set_ensure_allocated(&shutdown_services,
trivial_hash_func, trivial_compare_func);
@@ -3724,7 +3763,9 @@ static int service_enumerate(Manager *m)
* runlevels we assume the stop jobs will be implicitly added
* by the core logic. Also, we don't really distinguish here
* between the runlevels 0 and 6 and just add them to the
- * special shutdown target. */
+ * special shutdown target. On SUSE the boot.d/ runlevel is
+ * also used for shutdown, so we add links for that too to the
+ * shutdown target.*/
SET_FOREACH(service, shutdown_services, j) {
service = unit_follow_merge(service);

View File

@ -0,0 +1,27 @@
From f49fd1d57a429d4a05ac86352c017a845f8185b3 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Tue, 7 May 2013 14:16:53 +0200
Subject: [PATCH] Start ctrl-alt-del.target irreversibly
This makes ctrl-alt-del reboots more robust, just like "systemctl
reboot".
---
src/core/manager.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/manager.c b/src/core/manager.c
index c7f8f20..0508628 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -1372,7 +1372,7 @@ static int manager_process_signal_fd(Manager *m) {
case SIGINT:
if (m->running_as == SYSTEMD_SYSTEM) {
- manager_start_target(m, SPECIAL_CTRL_ALT_DEL_TARGET, JOB_REPLACE);
+ manager_start_target(m, SPECIAL_CTRL_ALT_DEL_TARGET, JOB_REPLACE_IRREVERSIBLY);
break;
}
--
1.8.1.4

View File

@ -0,0 +1,47 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Thu, 10 Jan 2013 15:43:25 +0000
Subject: allow multiple sulogin to be started
allows multiple sulogin instance (bnc#793182).
---
units/getty@.service.m4 | 1 +
units/rescue.target | 1 +
units/serial-getty@.service.m4 | 1 +
3 files changed, 3 insertions(+)
diff --git a/units/getty@.service.m4 b/units/getty@.service.m4
index 083eb97..243fea5 100644
--- a/units/getty@.service.m4
+++ b/units/getty@.service.m4
@@ -9,6 +9,7 @@
Description=Getty on %I
Documentation=man:agetty(8) man:systemd-getty-generator(8)
Documentation=http://0pointer.de/blog/projects/serial-console.html
+Conflicts=rescue.service
After=systemd-user-sessions.service plymouth-quit-wait.service
m4_ifdef(`HAVE_SYSV_COMPAT',
After=rc-local.service
diff --git a/units/rescue.target b/units/rescue.target
index 3f59b14..20f6841 100644
--- a/units/rescue.target
+++ b/units/rescue.target
@@ -10,6 +10,7 @@ Description=Rescue Mode
Documentation=man:systemd.special(7)
Requires=sysinit.target rescue.service
After=sysinit.target rescue.service
+Conflicts=getty.target
AllowIsolate=yes
[Install]
diff --git a/units/serial-getty@.service.m4 b/units/serial-getty@.service.m4
index 60d7737..2b18dbf 100644
--- a/units/serial-getty@.service.m4
+++ b/units/serial-getty@.service.m4
@@ -10,6 +10,7 @@ Description=Serial Getty on %I
Documentation=man:agetty(8) man:systemd-getty-generator(8)
Documentation=http://0pointer.de/blog/projects/serial-console.html
BindsTo=dev-%i.device
+Conflicts=rescue.service
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
m4_ifdef(`HAVE_SYSV_COMPAT',
After=rc-local.service

View File

@ -0,0 +1,44 @@
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Mon, 8 Apr 2013 14:51:47 +0200
Subject: apply ACL for nvidia device nodes
set ACL on nvidia devices (bnc#808319).
---
src/login/logind-acl.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/login/logind-acl.c b/src/login/logind-acl.c
index cb045a9..51093f2 100644
--- a/src/login/logind-acl.c
+++ b/src/login/logind-acl.c
@@ -24,6 +24,7 @@
#include <acl/libacl.h>
#include <errno.h>
#include <string.h>
+#include <strv.h>
#include "logind-acl.h"
#include "util.h"
@@ -240,6 +241,22 @@ int devnode_acl_all(struct udev *udev,
goto finish;
}
+ /* only search for nvidia* if /dev/nvidiactl exists */
+ if (!devnode_acl("/dev/nvidiactl", flush, del, old_uid, add, new_uid)) {
+ char** directory;
+ char **f, *resolved;
+
+ if (get_files_in_directory ("/dev", &directory)) {
+ STRV_FOREACH(f,directory)
+ if (startswith(*f,"nvidia")) {
+ resolved = strjoin("/dev/", *f, NULL);
+ devnode_acl(resolved, flush, del, old_uid, add, new_uid);
+ free(resolved);
+ }
+ }
+ strv_free(directory);
+ }
+
finish:
if (e)
udev_enumerate_unref(e);

View File

@ -0,0 +1,26 @@
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Mon, 26 Nov 2012 09:49:42 +0100
Subject: avoid assertion if invalid address familily is passed to
gethostbyaddr_r (bnc#791101)
---
src/nss-myhostname/nss-myhostname.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/nss-myhostname/nss-myhostname.c b/src/nss-myhostname/nss-myhostname.c
index 60e256d..e97d4e5 100644
--- a/src/nss-myhostname/nss-myhostname.c
+++ b/src/nss-myhostname/nss-myhostname.c
@@ -442,6 +442,12 @@ enum nss_status _nss_myhostname_gethostbyaddr2_r(
uint32_t local_address_ipv4 = LOCALADDRESS_IPV4;
const char *canonical = NULL, *additional = NULL;
+ if (af != AF_INET && af != AF_INET6) {
+ *errnop = EAFNOSUPPORT;
+ *h_errnop = NO_DATA;
+ return NSS_STATUS_UNAVAIL;
+ }
+
if (len != PROTO_ADDRESS_SIZE(af)) {
*errnop = EINVAL;
*h_errnop = NO_RECOVERY;

7
baselibs.conf Normal file
View File

@ -0,0 +1,7 @@
systemd
supplements "packageand(systemd:pam-<targettype>)"
-/lib/systemd/system/
libudev0
libgudev-1_0-0
libudev1
nss-myhostname

74
boot.udev Normal file
View File

@ -0,0 +1,74 @@
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: boot.udev
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: B
# Default-Stop:
# Short-Description: manage /dev and kernel device-events
# Description: udevd daemon to manage /dev and kernel device events
### END INIT INFO
. /etc/rc.status
PATH="/sbin:/bin:/usr/sbin:/usr/bin"
DAEMON="@@SYSTEMD@@/systemd-udevd"
UDEVADM="@@BINDIR@@/udevadm"
WRITERULE="@@PREFIX@@/write_dev_root_rule"
udev_timeout=180
case "$1" in
start)
# create /dev/root symlink with dynamic rule
if [ -x ${WRITERULE} ]; then
${WRITERULE} >/dev/null 2>&1 || true
fi
# start udevd
echo -n "Starting udevd: "
${DAEMON} --daemon
if [ $? -ne 0 ]; then
rc_status -v
rc_exit
fi
rc_status -v
# trigger events for all devices
echo -n "Loading drivers, configuring devices: "
${UDEVADM} trigger --type=subsystems --action=add
${UDEVADM} trigger --type=devices --action=add
# wait for events to finish
${UDEVADM} settle --timeout=$udev_timeout
rc_status -v
;;
stop)
echo -n "Stopping udevd: "
killproc ${DAEMON}
rc_status -v
;;
restart)
echo -n "Restarting udevd: "
killproc ${DAEMON}
${DAEMON} --daemon
rc_status -v
;;
status)
echo -n "Checking for udevd: "
checkproc ${DAEMON}
rc_status -v
;;
reload|force-reload)
echo -n "Reloading udevd: "
killproc -G -HUP ${DAEMON}
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|restart|status|reload|force-reload}"
exit 1
;;
esac
rc_exit

View File

@ -0,0 +1,34 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Wed, 9 Nov 2011 11:10:49 +0100
Subject: delay fsck / cryptsetup after md / dmraid / lvm are started
---
src/cryptsetup/cryptsetup-generator.c | 1 +
units/systemd-fsck@.service.in | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 9b8e229..0949287 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -160,6 +160,7 @@ static int create_disk(
"Conflicts=umount.target\n"
"DefaultDependencies=no\n"
"BindsTo=dev-mapper-%i.device\n"
+ "After=md.service dmraid.service lvm.service\n"
"After=systemd-readahead-collect.service systemd-readahead-replay.service\n",
f);
diff --git a/units/systemd-fsck@.service.in b/units/systemd-fsck@.service.in
index b3c71eb..c66a411 100644
--- a/units/systemd-fsck@.service.in
+++ b/units/systemd-fsck@.service.in
@@ -10,7 +10,7 @@ Description=File System Check on %f
Documentation=man:systemd-fsck@.service(8)
DefaultDependencies=no
BindsTo=%i.device
-After=systemd-readahead-collect.service systemd-readahead-replay.service %i.device
+After=systemd-readahead-collect.service systemd-readahead-replay.service %i.device lvm.service md.service dmraid.service
Before=shutdown.target
[Service]

View File

@ -0,0 +1,20 @@
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Tue, 12 Feb 2013 17:24:35 +0100
Subject: disable nss-myhostname warning (bnc#783841)
---
src/hostname/hostnamed.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index 0437e33..c7f454c 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -134,6 +134,7 @@ static int read_data(void) {
static bool check_nss(void) {
void *dl;
+ return true;
dl = dlopen("libnss_myhostname.so.2", RTLD_LAZY);
if (dl) {

View File

@ -0,0 +1,19 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Thu, 9 Feb 2012 16:19:38 +0000
Subject: ensure DM and LVM are started before local-fs-pre-target
ensure md / lvm /dmraid is started before mounting partitions,
if fsck was disabled for them (bnc#733283).
---
units/local-fs-pre.target | 1 +
1 file changed, 1 insertion(+)
diff --git a/units/local-fs-pre.target b/units/local-fs-pre.target
index 809f2ed..05fcbd4 100644
--- a/units/local-fs-pre.target
+++ b/units/local-fs-pre.target
@@ -9,3 +9,4 @@
Description=Local File Systems (Pre)
Documentation=man:systemd.special(7)
RefuseManualStart=yes
+After=md.service lvm.service dmraid.service

View File

@ -0,0 +1,22 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Wed, 24 Aug 2011 13:02:12 +0000
Subject: ensure ask-password-wall starts after getty@tty1
ensure passphrase is handled before starting getty on tty1.
---
units/systemd-ask-password-wall.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/units/systemd-ask-password-wall.service.in b/units/systemd-ask-password-wall.service.in
index 0eaa274..ca51e4e 100644
--- a/units/systemd-ask-password-wall.service.in
+++ b/units/systemd-ask-password-wall.service.in
@@ -8,7 +8,7 @@
[Unit]
Description=Forward Password Requests to Wall
Documentation=man:systemd-ask-password-console.service(8)
-After=systemd-user-sessions.service
+After=systemd-user-sessions.service getty@tty1.service
[Service]
ExecStartPre=-@SYSTEMCTL@ stop systemd-ask-password-console.path systemd-ask-password-console.service systemd-ask-password-plymouth.path systemd-ask-password-plymouth.service

View File

@ -0,0 +1,34 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Tue, 28 May 2013 15:17:35 +0200
Subject: ensure shortname is set as hostname (bnc#820213)
strip hostname so the domain part isn't set as part of the hostname
---
src/core/hostname-setup.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/core/hostname-setup.c b/src/core/hostname-setup.c
index 0ce683b..1c8e555 100644
--- a/src/core/hostname-setup.c
+++ b/src/core/hostname-setup.c
@@ -32,7 +32,7 @@
#include "fileio.h"
static int read_and_strip_hostname(const char *path, char **hn) {
- char *s;
+ char *s, *domain;
int r;
assert(path);
@@ -49,6 +49,11 @@ static int read_and_strip_hostname(const char *path, char **hn) {
return -ENOENT;
}
+ /* strip any leftover of a domain name */
+ if (domain = strchr(s, '.')) {
+ *domain = NULL;
+ }
+
*hn = s;
return 0;
}

View File

@ -0,0 +1,21 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Mon, 9 Jan 2012 17:01:22 +0000
Subject: ensure sysctl are applied after modules are loaded
(bnc#725412)
---
units/systemd-sysctl.service.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/units/systemd-sysctl.service.in b/units/systemd-sysctl.service.in
index 45e1ceb..caaaa9a 100644
--- a/units/systemd-sysctl.service.in
+++ b/units/systemd-sysctl.service.in
@@ -11,6 +11,7 @@ Documentation=man:systemd-sysctl.service(8) man:sysctl.d(5)
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service
+After=systemd-modules-load.service
Before=sysinit.target shutdown.target
ConditionPathIsReadWrite=/proc/sys/
ConditionPathExists=|/etc/sysctl.conf

View File

@ -0,0 +1,22 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Tue, 20 Nov 2012 09:36:43 +0000
Subject: fix owner of /var/log/btmp
ensure btmp is owned only by root (bnc#777405).
---
tmpfiles.d/systemd.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tmpfiles.d/systemd.conf b/tmpfiles.d/systemd.conf
index ee86f2e..29d6e97 100644
--- a/tmpfiles.d/systemd.conf
+++ b/tmpfiles.d/systemd.conf
@@ -11,7 +11,7 @@ d /run/user 0755 root root ~10d
F /run/utmp 0664 root utmp -
f /var/log/wtmp 0664 root utmp -
-f /var/log/btmp 0600 root utmp -
+f /var/log/btmp 0600 root root -
d /var/cache/man - - - 30d

View File

@ -0,0 +1,42 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Thu, 23 Aug 2012 11:08:25 +0200
Subject: fix support for boot prefixed initscript (bnc#746506)
---
src/systemctl/systemctl.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
Index: systemd-204/src/systemctl/systemctl.c
===================================================================
--- systemd-204.orig/src/systemctl/systemctl.c
+++ systemd-204/src/systemctl/systemctl.c
@@ -4082,8 +4082,28 @@ static int enable_sysv_units(char **args
p[strlen(p) - sizeof(".service") + 1] = 0;
found_sysv = access(p, F_OK) >= 0;
- if (!found_sysv)
+ if (!found_sysv) {
+#ifdef HAVE_SYSV_COMPAT
+ free(p);
+ p = NULL;
+ if (!isempty(arg_root))
+ asprintf(&p, "%s/" SYSTEM_SYSVINIT_PATH "/boot.%s", arg_root, name);
+ else
+ asprintf(&p, SYSTEM_SYSVINIT_PATH "/boot.%s", name);
+ if (!p) {
+ r = log_oom();
+ goto finish;
+ }
+ p[strlen(p) - sizeof(".service") + 1] = 0;
+ found_sysv = access(p, F_OK) >= 0;
+
+ if (!found_sysv) {
+ continue;
+ }
+#else
continue;
+#endif
+ }
/* Mark this entry, so that we don't try enabling it as native unit */
args[f] = (char*) "";

View File

@ -0,0 +1,104 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Mon, 7 Nov 2011 18:04:20 +0100
Subject: force lvm restart after cryptsetup target is reached
---
src/cryptsetup/cryptsetup-generator.c | 57 ++++++++++++++++++++++++++++++++++-
1 file changed, 56 insertions(+), 1 deletion(-)
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 81b7708..1940985 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -22,6 +22,7 @@
#include <string.h>
#include <errno.h>
#include <unistd.h>
+#include <stdlib.h>
#include "log.h"
#include "util.h"
@@ -64,6 +65,54 @@ static bool has_option(const char *haystack, const char *needle) {
return false;
}
+static int create_storage_after_cryptsetup (void) {
+ _cleanup_free_ char *to = NULL, *p = NULL;
+ _cleanup_fclose_ FILE *f = NULL;
+
+ if (asprintf(&p, "%s/storage-after-cryptsetup.service", arg_dest) < 0)
+ return log_oom();
+
+ if (!(f = fopen(p, "wxe"))) {
+ log_error("Failed to create unit file: %m");
+ return -errno;
+ }
+
+ fprintf(f,
+ "[Unit]\n"
+ "Description=Restart storage after cryptsetup\n"
+ "DefaultDependencies=no\n"
+ "After=cryptsetup.target\n"
+ "Wants=cryptsetup.target\n"
+ "Before=local-fs.target\n"
+ "Before=shutdown.target\n");
+
+ fprintf(f,
+ "\n[Service]\n"
+ "RemainAfterExit=true\n"
+ "Type=oneshot\n"
+ "TimeoutSec=0\n"
+ "ExecStart=/usr/bin/systemctl restart lvm.service\n");
+
+ fflush(f);
+
+ if (ferror(f)) {
+ log_error("Failed to write file: %m");
+ return -errno;
+ }
+
+ if (asprintf(&to, "%s/local-fs.target.wants/storage-after-cryptsetup.service", arg_dest) < 0)
+ return log_oom();
+
+ mkdir_parents(to, 0755);
+
+ if (symlink("../storage-after-cryptsetup.service", to) < 0) {
+ log_error("Failed to create symlink ../storage-after-cryptsetup.service to '%s': %m", to);
+ return -errno;
+ }
+
+ return 0;
+}
+
static int create_disk(
const char *name,
const char *device,
@@ -334,6 +383,7 @@ int main(int argc, char *argv[]) {
_cleanup_fclose_ FILE *f = NULL;
unsigned n = 0;
int r = EXIT_SUCCESS;
+ bool no_crypttab = false;
char **i;
if (argc > 1 && argc != 4) {
@@ -361,8 +411,10 @@ int main(int argc, char *argv[]) {
f = fopen("/etc/crypttab", "re");
if (!f) {
- if (errno == ENOENT)
+ if (errno == ENOENT) {
+ no_crypttab = true;
r = EXIT_SUCCESS;
+ }
else {
r = EXIT_FAILURE;
log_error("Failed to open /etc/crypttab: %m");
@@ -464,5 +516,8 @@ next:
r = EXIT_FAILURE;
}
+ if ((r == EXIT_SUCCESS && !no_crypttab) && (create_storage_after_cryptsetup () < 0))
+ r = EXIT_FAILURE;
+
return r;
}

View File

@ -0,0 +1,42 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Tue, 22 Jan 2013 17:02:04 +0000
Subject: handle SYSTEMCTL_OPTIONS environment variable
(bnc#798620)
---
src/systemctl/systemctl.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
Index: systemd-204/src/systemctl/systemctl.c
===================================================================
--- systemd-204.orig/src/systemctl/systemctl.c
+++ systemd-204/src/systemctl/systemctl.c
@@ -5974,6 +5974,28 @@ int main(int argc, char*argv[]) {
log_parse_environment();
log_open();
+ if (secure_getenv("SYSTEMCTL_OPTIONS") &&
+ (!program_invocation_short_name ||
+ (program_invocation_short_name && strstr(program_invocation_short_name, "systemctl")))) {
+ char **parsed_systemctl_options = strv_split_quoted(getenv("SYSTEMCTL_OPTIONS"));
+
+ if (*parsed_systemctl_options && **parsed_systemctl_options) {
+ char **k,**a;
+ char **new_argv = new(char*, strv_length(argv) + strv_length(parsed_systemctl_options) + 1);
+ new_argv[0] = strdup(argv[0]);
+ for (k = new_argv+1, a = parsed_systemctl_options; *a; k++, a++) {
+ *k = strdup(*a);
+ }
+ for (a = argv+1; *a; k++, a++) {
+ *k = strdup(*a);
+ }
+ *k = NULL;
+ argv = new_argv;
+ argc = strv_length(new_argv);
+ strv_free (parsed_systemctl_options);
+ }
+ }
+
r = parse_argv(argc, argv);
if (r < 0)
goto finish;

View File

@ -0,0 +1,233 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Fri, 19 Aug 2011 15:29:49 +0000
Subject: handle disable_caplock and compose_table and kbd_rate
(bnc#746595)
---
src/vconsole/vconsole-setup.c | 156 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 153 insertions(+), 3 deletions(-)
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index 1bbf737..384f936 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -40,6 +40,7 @@
#include "macro.h"
#include "virt.h"
#include "fileio.h"
+#include "strv.h"
static bool is_vconsole(int fd) {
unsigned char data[1];
@@ -99,8 +100,8 @@ static int enable_utf8(int fd) {
return r;
}
-static int keymap_load(const char *vc, const char *map, const char *map_toggle, bool utf8, pid_t *_pid) {
- const char *args[8];
+static int keymap_load(const char *vc, const char *map, const char *map_toggle, bool utf8, bool disable_capslock, pid_t *_pid) {
+ const char *args[9];
int i = 0;
pid_t pid;
@@ -119,6 +120,8 @@ static int keymap_load(const char *vc, const char *map, const char *map_toggle,
args[i++] = map;
if (map_toggle)
args[i++] = map_toggle;
+ if (disable_capslock)
+ args[i++] = "disable.capslock";
args[i++] = NULL;
pid = fork();
@@ -212,6 +215,101 @@ static void font_copy_to_all_vcs(int fd) {
}
}
+#ifdef HAVE_SYSV_COMPAT
+static int load_compose_table(const char *vc, const char *compose_table, pid_t *_pid) {
+ const char *args[1024];
+ int i = 0, j = 0;
+ pid_t pid;
+ char **strv_compose_table = NULL;
+ char *to_free[1024];
+
+ if (isempty(compose_table)) {
+ /* An empty map means no compose table*/
+ *_pid = 0;
+ return 0;
+ }
+
+ args[i++] = KBD_LOADKEYS;
+ args[i++] = "-q";
+ args[i++] = "-C";
+ args[i++] = vc;
+
+ strv_compose_table = strv_split(compose_table, WHITESPACE);
+ if (strv_compose_table) {
+ bool compose_loaded = false;
+ bool compose_clear = false;
+ char **name;
+ char *arg;
+
+ STRV_FOREACH (name, strv_compose_table) {
+ if (streq(*name,"-c") || streq(*name,"clear")) {
+ compose_clear = true;
+ continue;
+ }
+ if (!compose_loaded) {
+ if (compose_clear)
+ args[i++] = "-c";
+ }
+ asprintf(&arg, "compose.%s",*name);
+ compose_loaded = true;
+ args[i++] = to_free[j++] = arg;
+
+ }
+ strv_free(strv_compose_table);
+ }
+ args[i++] = NULL;
+
+ if ((pid = fork()) < 0) {
+ log_error("Failed to fork: %m");
+ return -errno;
+ } else if (pid == 0) {
+ execv(args[0], (char **) args);
+ _exit(EXIT_FAILURE);
+ }
+
+ *_pid = pid;
+
+ for (i=0 ; i < j ; i++)
+ free (to_free[i]);
+
+ return 0;
+}
+#endif
+
+static int set_kbd_rate(const char *vc, const char *kbd_rate, const char *kbd_delay, pid_t *_pid) {
+ const char *args[7];
+ int i = 0;
+ pid_t pid;
+
+ if (isempty(kbd_rate) && isempty(kbd_delay)) {
+ *_pid = 0;
+ return 0;
+ }
+
+ args[i++] = "/bin/kbdrate";
+ if (!isempty(kbd_rate)) {
+ args[i++] = "-r";
+ args[i++] = kbd_rate;
+ }
+ if (!isempty(kbd_delay)) {
+ args[i++] = "-d";
+ args[i++] = kbd_delay;
+ }
+ args[i++] = "-s";
+ args[i++] = NULL;
+
+ if ((pid = fork()) < 0) {
+ log_error("Failed to fork: %m");
+ return -errno;
+ } else if (pid == 0) {
+ execv(args[0], (char **) args);
+ _exit(EXIT_FAILURE);
+ }
+
+ *_pid = pid;
+ return 0;
+}
+
int main(int argc, char **argv) {
const char *vc;
char *vc_keymap = NULL;
@@ -219,8 +317,16 @@ int main(int argc, char **argv) {
char *vc_font = NULL;
char *vc_font_map = NULL;
char *vc_font_unimap = NULL;
+#ifdef HAVE_SYSV_COMPAT
+ char *vc_kbd_delay = NULL;
+ char *vc_kbd_rate = NULL;
+ char *vc_kbd_disable_caps_lock = NULL;
+ char *vc_compose_table = NULL;
+ pid_t kbd_rate_pid = 0, compose_table_pid = 0;
+#endif
int fd = -1;
bool utf8;
+ bool disable_capslock = false;
pid_t font_pid = 0, keymap_pid = 0;
bool font_copy = false;
int r = EXIT_FAILURE;
@@ -276,13 +382,43 @@ int main(int argc, char **argv) {
log_warning("Failed to read /proc/cmdline: %s", strerror(-r));
}
+ if (r <= 0) {
+#ifdef HAVE_SYSV_COMPAT
+ r = parse_env_file("/etc/sysconfig/keyboard", NEWLINE,
+ "KEYTABLE", &vc_keymap,
+ "KBD_DELAY", &vc_kbd_delay,
+ "KBD_RATE", &vc_kbd_rate,
+ "KBD_DISABLE_CAPS_LOCK", &vc_kbd_disable_caps_lock,
+ "COMPOSETABLE", &vc_compose_table,
+ NULL);
+ if (r < 0 && r != -ENOENT)
+ log_warning("Failed to read /etc/sysconfig/keyboard: %s", strerror(-r));
+
+ r = parse_env_file("/etc/sysconfig/console", NEWLINE,
+ "CONSOLE_FONT", &vc_font,
+ "CONSOLE_SCREENMAP", &vc_font_map,
+ "CONSOLE_UNICODEMAP", &vc_font_unimap,
+ NULL);
+ if (r < 0 && r != -ENOENT)
+ log_warning("Failed to read /etc/sysconfig/console: %s", strerror(-r));
+
+ disable_capslock = vc_kbd_disable_caps_lock && strcasecmp(vc_kbd_disable_caps_lock, "YES") == 0;
+
+#endif
+ }
+
if (utf8)
enable_utf8(fd);
else
disable_utf8(fd);
r = EXIT_FAILURE;
- if (keymap_load(vc, vc_keymap, vc_keymap_toggle, utf8, &keymap_pid) >= 0 &&
+
+ if (keymap_load(vc, vc_keymap, vc_keymap_toggle, utf8, disable_capslock, &keymap_pid) >= 0 &&
+#ifdef HAVE_SYSV_COMPAT
+ load_compose_table(vc, vc_compose_table, &compose_table_pid) >= 0 &&
+ set_kbd_rate(vc, vc_kbd_rate, vc_kbd_delay, &kbd_rate_pid) >= 0 &&
+#endif
font_load(vc, vc_font, vc_font_map, vc_font_unimap, &font_pid) >= 0)
r = EXIT_SUCCESS;
@@ -290,6 +426,14 @@ finish:
if (keymap_pid > 0)
wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid);
+#ifdef HAVE_SYSV_COMPAT
+ if (compose_table_pid > 0)
+ wait_for_terminate_and_warn(KBD_LOADKEYS, compose_table_pid);
+
+ if (kbd_rate_pid > 0)
+ wait_for_terminate_and_warn("/bin/kbdrate", kbd_rate_pid);
+#endif
+
if (font_pid > 0) {
wait_for_terminate_and_warn(KBD_SETFONT, font_pid);
if (font_copy)
@@ -300,6 +444,12 @@ finish:
free(vc_font);
free(vc_font_map);
free(vc_font_unimap);
+#ifdef HAVE_SYSV_COMPAT
+ free(vc_kbd_delay);
+ free(vc_kbd_rate);
+ free(vc_kbd_disable_caps_lock);
+ free(vc_compose_table);
+#endif
if (fd >= 0)
close_nointr_nofail(fd);

81
handle-etc-HOSTNAME.patch Normal file
View File

@ -0,0 +1,81 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Fri, 15 Feb 2013 16:04:39 +0000
Subject: handle /etc/HOSTNAME
(bnc#803653)
---
src/core/hostname-setup.c | 22 +++++++++++++++++-----
src/hostname/hostnamed.c | 12 +++++++++++-
2 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/src/core/hostname-setup.c b/src/core/hostname-setup.c
index 8aa1cff..0ce683b 100644
--- a/src/core/hostname-setup.c
+++ b/src/core/hostname-setup.c
@@ -61,12 +61,24 @@ int hostname_setup(void) {
r = read_and_strip_hostname("/etc/hostname", &b);
if (r < 0) {
- if (r == -ENOENT)
- enoent = true;
- else
+ if (r == -ENOENT) {
+ /* use SUSE fallback */
+ r = read_and_strip_hostname("/etc/HOSTNAME", &b);
+ if (r < 0) {
+ if (r == -ENOENT)
+ enoent = true;
+ else
+ log_warning("Failed to read configured hostname: %s", strerror(-r));
+ hn = NULL;
+ }
+ else
+ hn = b;
+
+ }
+ else {
log_warning("Failed to read configured hostname: %s", strerror(-r));
-
- hn = NULL;
+ hn = NULL;
+ }
} else
hn = b;
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index c7f454c..cfbd706 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -129,6 +129,10 @@ static int read_data(void) {
if (r < 0 && r != -ENOENT)
return r;
+ r = read_one_line_file("/etc/HOSTNAME", &data[PROP_STATIC_HOSTNAME]);
+ if (r < 0 && r != -ENOENT)
+ return r;
+
return 0;
}
@@ -283,6 +287,7 @@ static int write_data_hostname(void) {
static int write_data_static_hostname(void) {
+ int r;
if (isempty(data[PROP_STATIC_HOSTNAME])) {
if (unlink("/etc/hostname") < 0)
@@ -290,7 +295,12 @@ static int write_data_static_hostname(void) {
return 0;
}
- return write_string_file_atomic_label("/etc/hostname", data[PROP_STATIC_HOSTNAME]);
+
+ r = write_string_file_atomic_label("/etc/hostname", data[PROP_STATIC_HOSTNAME]);
+ if (!r) {
+ r = symlink_atomic("/etc/hostname", "/etc/HOSTNAME");
+ }
+ return r;
}
static int write_data_other(void) {

View File

@ -0,0 +1,191 @@
Set NumLock according to /etc/sysconfig/keyboard.
https://bugzilla.novell.com/show_bug.cgi?id=746595
Authors:
Stanislav Brabec <sbrabec@suse.cz>
Cristian Rodríguez <crrodriguez@opensuse.org>
Index: systemd-204/src/vconsole/vconsole-setup.c
===================================================================
--- systemd-204.orig/src/vconsole/vconsole-setup.c
+++ systemd-204/src/vconsole/vconsole-setup.c
@@ -42,6 +42,10 @@
#include "fileio.h"
#include "strv.h"
+#define BIOS_DATA_AREA 0x400
+#define BDA_KEYBOARD_STATUS_FLAGS_4 0x97
+#define BDA_KSF4_NUMLOCK_MASK 0x02
+
static bool is_vconsole(int fd) {
unsigned char data[1];
@@ -321,12 +325,14 @@ int main(int argc, char **argv) {
char *vc_kbd_delay = NULL;
char *vc_kbd_rate = NULL;
char *vc_kbd_disable_caps_lock = NULL;
+ char *vc_kbd_numlock = NULL;
char *vc_compose_table = NULL;
pid_t kbd_rate_pid = 0, compose_table_pid = 0;
#endif
int fd = -1;
bool utf8;
bool disable_capslock = false;
+ bool numlock = false;
pid_t font_pid = 0, keymap_pid = 0;
bool font_copy = false;
int r = EXIT_FAILURE;
@@ -389,6 +395,7 @@ int main(int argc, char **argv) {
"KBD_DELAY", &vc_kbd_delay,
"KBD_RATE", &vc_kbd_rate,
"KBD_DISABLE_CAPS_LOCK", &vc_kbd_disable_caps_lock,
+ "KBD_NUMLOCK", &vc_kbd_numlock,
"COMPOSETABLE", &vc_compose_table,
NULL);
if (r < 0 && r != -ENOENT)
@@ -403,6 +410,36 @@ int main(int argc, char **argv) {
log_warning("Failed to read /etc/sysconfig/console: %s", strerror(-r));
disable_capslock = vc_kbd_disable_caps_lock && strcasecmp(vc_kbd_disable_caps_lock, "YES") == 0;
+#if defined(__i386__) || defined(__x86_64__)
+ if (vc_kbd_numlock && strcaseeq(vc_kbd_numlock, "bios")) {
+ int _cleanup_close_ fdmem;
+ char c;
+
+ fdmem = open ("/dev/mem", O_RDONLY);
+
+ if(fdmem < 0) {
+ r = EXIT_FAILURE;
+ log_error("Failed to open /dev/mem: %m");
+ goto finish;
+ }
+
+ if(lseek(fdmem, BIOS_DATA_AREA + BDA_KEYBOARD_STATUS_FLAGS_4, SEEK_SET) == (off_t) -1) {
+ r = EXIT_FAILURE;
+ log_error("Failed to seek /dev/mem: %m");
+ goto finish;
+ }
+
+ if(read (fdmem, &c, sizeof(char)) == -1) {
+ r = EXIT_FAILURE;
+ log_error("Failed to read /dev/mem: %m");
+ goto finish;
+ }
+
+ if (c & BDA_KSF4_NUMLOCK_MASK)
+ numlock = true;
+ } else
+#endif
+ numlock = vc_kbd_numlock && strcaseeq(vc_kbd_numlock, "yes");
#endif
}
@@ -425,6 +462,10 @@ int main(int argc, char **argv) {
finish:
if (keymap_pid > 0)
wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid);
+ if (numlock)
+ touch("/run/numlock-on");
+ else
+ unlink("/run/numlock-on");
#ifdef HAVE_SYSV_COMPAT
if (compose_table_pid > 0)
@@ -444,6 +485,7 @@ finish:
free(vc_font);
free(vc_font_map);
free(vc_font_unimap);
+ free(vc_kbd_numlock);
#ifdef HAVE_SYSV_COMPAT
free(vc_kbd_delay);
free(vc_kbd_rate);
Index: systemd-204/Makefile.am
===================================================================
--- systemd-204.orig/Makefile.am
+++ systemd-204/Makefile.am
@@ -2219,6 +2219,19 @@ dist_udevrules_DATA += \
rules/61-accelerometer.rules
# ------------------------------------------------------------------------------
+numlock_on_SOURCES = \
+ src/login/numlock-on.c
+
+numlock_on_CFLAGS = \
+ $(AM_CFLAGS)
+
+udevlibexec_PROGRAMS += \
+ numlock-on
+
+dist_udevrules_DATA += \
+ rules/73-seat-numlock.rules
+
+# ------------------------------------------------------------------------------
if ENABLE_GUDEV
if ENABLE_GTK_DOC
SUBDIRS += \
Index: systemd-204/rules/73-seat-numlock.rules
===================================================================
--- /dev/null
+++ systemd-204/rules/73-seat-numlock.rules
@@ -0,0 +1,8 @@
+# This file is part of SUSE customization of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+SUBSYSTEM=="tty", ACTION=="add", KERNEL=="tty[0-9]|tty1[0-2]", TEST=="/run/numlock-on", RUN+="numlock-on $env{DEVNAME}"
Index: systemd-204/src/login/numlock-on.c
===================================================================
--- /dev/null
+++ systemd-204/src/login/numlock-on.c
@@ -0,0 +1,34 @@
+/*
+ * numlock-on.c: Turn numlock-on
+ *
+ * This file may be freely copied under the terms of the GNU General
+ * Public License (GPL), version 2, or at your option any later
+ * version.
+
+ * Copyright (C) 2013 Stanislav Brabec, SUSE
+ *
+ * based on setleds.c, which is
+ * Copyright (C) 1994-1999 Andries E. Brouwer
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <linux/kd.h>
+
+int
+main(int argc, char **argv) {
+ char flags;
+
+ if (ioctl(0, KDGKBLED, &flags)) {
+ perror("KDGKBLED");
+ exit(1);
+ }
+
+ if (ioctl(0, KDSKBLED, flags | LED_NUM | (LED_NUM << 4))) {
+ perror("KDSKBLED");
+ exit(1);
+ }
+
+ exit(0);
+}
Index: systemd-204/units/systemd-vconsole-setup.service.in
===================================================================
--- systemd-204.orig/units/systemd-vconsole-setup.service.in
+++ systemd-204/units/systemd-vconsole-setup.service.in
@@ -11,7 +11,7 @@ Documentation=man:systemd-vconsole-setup
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service
-Before=sysinit.target shutdown.target
+Before=sysinit.target shutdown.target systemd-udev-trigger.service
ConditionPathExists=/dev/tty0
[Service]

View File

@ -0,0 +1,54 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Tue, 4 Dec 2012 16:51:32 +0000
Subject: handle root_uses_lang value in /etc/sysconfig/language
handle ROOT_USES_LANG=ctype (bnc#792182).
---
src/core/locale-setup.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/src/core/locale-setup.c b/src/core/locale-setup.c
index d7113b9..b3fb603 100644
--- a/src/core/locale-setup.c
+++ b/src/core/locale-setup.c
@@ -70,6 +70,11 @@ static const char * const variable_names[_VARIABLE_MAX] = {
int locale_setup(void) {
char *variables[_VARIABLE_MAX] = {};
int r = 0, i;
+#ifdef HAVE_SYSV_COMPAT
+ char _cleanup_free_ *root_uses_lang;
+
+ zero(root_uses_lang);
+#endif
if (detect_container(NULL) <= 0) {
r = parse_env_file("/proc/cmdline", WHITESPACE,
@@ -117,6 +122,28 @@ int locale_setup(void) {
log_warning("Failed to read /etc/locale.conf: %s", strerror(-r));
}
+#ifdef HAVE_SYSV_COMPAT
+ if (r <= 0 &&
+ (r = parse_env_file("/etc/sysconfig/language", NEWLINE,
+ "ROOT_USES_LANG", &root_uses_lang,
+ "RC_LANG", &variables[VARIABLE_LANG],
+ NULL)) < 0) {
+
+ if (r != -ENOENT)
+ log_warning("Failed to read /etc/sysconfig/language: %s", strerror(-r));
+ } else {
+ if (!root_uses_lang || (root_uses_lang && !strcaseeq(root_uses_lang,"yes"))) {
+ if (root_uses_lang && strcaseeq(root_uses_lang,"ctype"))
+ variables[VARIABLE_LC_CTYPE]=variables[VARIABLE_LANG];
+ else
+ free(variables[VARIABLE_LANG]);
+
+ variables[VARIABLE_LANG]=strdup("POSIX");
+ }
+ }
+
+#endif
+
if (!variables[VARIABLE_LANG]) {
variables[VARIABLE_LANG] = strdup("C");
if (!variables[VARIABLE_LANG]) {

123
libgcrypt.m4 Normal file
View File

@ -0,0 +1,123 @@
dnl Autoconf macros for libgcrypt
dnl Copyright (C) 2002, 2004 Free Software Foundation, Inc.
dnl
dnl This file is free software; as a special exception the author gives
dnl unlimited permission to copy and/or distribute it, with or without
dnl modifications, as long as this notice is preserved.
dnl
dnl This file is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION,
dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS.
dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed
dnl with the API version to also check the API compatibility. Example:
dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed
dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using
dnl this features allows to prevent build against newer versions of libgcrypt
dnl with a changed API.
dnl
AC_DEFUN([AM_PATH_LIBGCRYPT],
[ AC_ARG_WITH(libgcrypt-prefix,
AC_HELP_STRING([--with-libgcrypt-prefix=PFX],
[prefix where LIBGCRYPT is installed (optional)]),
libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="")
if test x$libgcrypt_config_prefix != x ; then
if test x${LIBGCRYPT_CONFIG+set} != xset ; then
LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config
fi
fi
AC_PATH_TOOL(LIBGCRYPT_CONFIG, libgcrypt-config, no)
tmp=ifelse([$1], ,1:1.2.0,$1)
if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
else
req_libgcrypt_api=0
min_libgcrypt_version="$tmp"
fi
AC_MSG_CHECKING(for LIBGCRYPT - version >= $min_libgcrypt_version)
ok=no
if test "$LIBGCRYPT_CONFIG" != "no" ; then
req_major=`echo $min_libgcrypt_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
req_minor=`echo $min_libgcrypt_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
req_micro=`echo $min_libgcrypt_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
major=`echo $libgcrypt_config_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
minor=`echo $libgcrypt_config_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
micro=`echo $libgcrypt_config_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
if test "$major" -gt "$req_major"; then
ok=yes
else
if test "$major" -eq "$req_major"; then
if test "$minor" -gt "$req_minor"; then
ok=yes
else
if test "$minor" -eq "$req_minor"; then
if test "$micro" -ge "$req_micro"; then
ok=yes
fi
fi
fi
fi
fi
fi
if test $ok = yes; then
AC_MSG_RESULT([yes ($libgcrypt_config_version)])
else
AC_MSG_RESULT(no)
fi
if test $ok = yes; then
# If we have a recent libgcrypt, we should also check that the
# API is compatible
if test "$req_libgcrypt_api" -gt 0 ; then
tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
if test "$tmp" -gt 0 ; then
AC_MSG_CHECKING([LIBGCRYPT API version])
if test "$req_libgcrypt_api" -eq "$tmp" ; then
AC_MSG_RESULT([okay])
else
ok=no
AC_MSG_RESULT([does not match. want=$req_libgcrypt_api got=$tmp])
fi
fi
fi
fi
if test $ok = yes; then
LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
ifelse([$2], , :, [$2])
if test x"$host" != x ; then
libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none`
if test x"$libgcrypt_config_host" != xnone ; then
if test x"$libgcrypt_config_host" != x"$host" ; then
AC_MSG_WARN([[
***
*** The config script $LIBGCRYPT_CONFIG was
*** built for $libgcrypt_config_host and thus may not match the
*** used host $host.
*** You may want to use the configure option --with-libgcrypt-prefix
*** to specify a matching config script.
***]])
fi
fi
fi
else
LIBGCRYPT_CFLAGS=""
LIBGCRYPT_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(LIBGCRYPT_CFLAGS)
AC_SUBST(LIBGCRYPT_LIBS)
])

8
localfs.service Normal file
View File

@ -0,0 +1,8 @@
[Unit]
Description=Shadow /etc/init.d/boot.localfs
DefaultDependencies=no
After=local-fs.target
[Service]
RemainAfterExit=true
ExecStart=/bin/true

115
macros.systemd Normal file
View File

@ -0,0 +1,115 @@
# -*- Mode: makefile; indent-tabs-mode: t -*- */
# RPM macros for packages installing systemd unit files
#
###
#
# When a package install systemd unit files, it should use the following macros:
#
# add %systemd_requires in the specfile
#
# %pre
# %service_add_pre demo.service demo1.service
#
# %post
# %service_add_post demo.service demo1.service
#
# %preun
# %service_del_preun demo.service
#
# %postun
# %service_del_postun demo.service
#
###
# This is for systemctl
%systemd_requires \
Requires(pre): systemd \
Requires(post): systemd \
Requires(preun): systemd \
Requires(postun): systemd \
%_unitdir /usr/lib/systemd/system
%_presetdir /usr/lib/systemd/system-preset
%_udevhwdbdir /usr/lib/udev/hwdb.d
%_udevrulesdir /usr/lib/udev/rules.d
%_journalcatalogdir /usr/lib/systemd/catalog
%_tmpfilesdir /usr/lib/tmpfiles.d
%_sysctldir /usr/lib/sysctl.d
%service_add_pre() \
test -n "$FIRST_ARG" || FIRST_ARG=$1 \
# disable migration if initial install under systemd \
[ -d /var/lib/systemd/migrated ] || mkdir -p /var/lib/systemd/migrated || : \
if [ $FIRST_ARG -eq 1 ]; then \
for service in %{?*} ; do \
sysv_service=${service%.*} \
touch "/var/lib/systemd/migrated/$sysv_service" || : \
done \
else \
for service in %{?*} ; do \
sysv_service=${service%.*} \
if [ ! -e "/var/lib/systemd/migrated/$sysv_service" ]; then \
services_to_migrate="$services_to_migrate $sysv_service" \
fi \
done \
if [ -n "$services_to_migrate" ]; then \
/usr/sbin/systemd-sysv-convert --save $services_to_migrate >/dev/null 2>&1 || : \
fi \
fi \
%{nil}
# On install, tell systemd to reload its unit files
%service_add_post() \
test -n "$FIRST_ARG" || FIRST_ARG=$1 \
[ -d /var/lib/systemd/migrated ] || mkdir -p /var/lib/systemd/migrated || : \
for service in %{?*} ; do \
sysv_service=${service%.*} \
if [ ! -e "/var/lib/systemd/migrated/$sysv_service" ]; then \
services_to_migrate="$services_to_migrate $sysv_service" \
touch "/var/lib/systemd/migrated/$sysv_service" || : \
fi \
done \
/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : \
if [ -n "$services_to_migrate" ]; then \
/usr/sbin/systemd-sysv-convert --apply $services_to_migrate >/dev/null 2>&1 || : \
elif [ $FIRST_ARG -eq 1 ]; then \
/usr/bin/systemctl preset %{?*} >/dev/null 2>&1 || : \
fi \
%{nil}
# On uninstall, disable and stop services
%service_del_preun() \
test -n "$FIRST_ARG" || FIRST_ARG=$1 \
if [ $FIRST_ARG -eq 0 ]; then \
# Package removal, not upgrade \
/usr/bin/systemctl --no-reload disable %{?*} > /dev/null 2>&1 || : \
/usr/bin/systemctl stop %{?*} > /dev/null 2>&1 || : \
fi \
%{nil}
# On uninstall, tell systemd to reload its unit files
%service_del_postun() \
test -n "$FIRST_ARG" || FIRST_ARG=$1 \
if [ $FIRST_ARG -ge 1 ]; then \
# Package upgrade, not uninstall \
/usr/bin/systemctl try-restart %{?*} >/dev/null 2>&1 || : \
else # package uninstall \
for service in %{?*} ; do \
sysv_service=${service%.*} \
rm -f "/var/lib/systemd/migrated/$sysv_service" 2> /dev/null || : \
done \
/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : \
fi \
%{nil}
%udev_hwdb_update() \
/usr/bin/udevadm hwdb --update >/dev/null 2>&1 || : \
%{nil}
%udev_rules_update() \
/usr/bin/udevadm control --reload >/dev/null 2>&1 || : \
%{nil}
%journal_catalog_update() \
/usr/bin/journalctl --update-catalog >/dev/null 2>&1 || : \
%{nil}

73
macros.systemd.upstream Normal file
View File

@ -0,0 +1,73 @@
# -*- Mode: makefile; indent-tabs-mode: t -*- */
#
# This file is part of systemd.
#
# Copyright 2012 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/>.
# RPM macros for packages installing systemd unit files
%_unitdir @systemunitdir@
%_presetdir @systempresetdir@
%_udevhwdbdir @udevhwdbdir@
%_udevrulesdir @udevrulesdir@
%_journalcatalogdir @catalogdir@
%_tmpfilesdir @tmpfilesdir@
%_sysctldir @sysctldir@
%systemd_requires \
Requires(post): systemd \
Requires(preun): systemd \
Requires(postun): systemd \
%{nil}
%systemd_post() \
if [ $1 -eq 1 ] ; then \
# Initial installation \
@rootbindir@/systemctl preset %{?*} >/dev/null 2>&1 || : \
fi \
%{nil}
%systemd_preun() \
if [ $1 -eq 0 ] ; then \
# Package removal, not upgrade \
@rootbindir@/systemctl --no-reload disable %{?*} > /dev/null 2>&1 || : \
@rootbindir@/systemctl stop %{?*} > /dev/null 2>&1 || : \
fi \
%{nil}
%systemd_postun() \
@rootbindir@/systemctl daemon-reload >/dev/null 2>&1 || : \
%{nil}
%systemd_postun_with_restart() \
@rootbindir@/systemctl daemon-reload >/dev/null 2>&1 || : \
if [ $1 -ge 1 ] ; then \
# Package upgrade, not uninstall \
@rootbindir@/systemctl try-restart %{?*} >/dev/null 2>&1 || : \
fi \
%{nil}
%udev_hwdb_update() \
@rootbindir@/udevadm hwdb --update >/dev/null 2>&1 || : \
%{nil}
%udev_rules_update() \
@rootbindir@/udevadm control --reload >/dev/null 2>&1 || : \
%{nil}
%journal_catalog_update() \
@rootbindir@/journalctl --update-catalog >/dev/null 2>&1 || : \
%{nil}

View File

@ -0,0 +1,66 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Wed, 12 Oct 2011 15:18:29 +0200
Subject: module-load: handle SUSE /etc/sysconfig/kernel module list
---
src/modules-load/modules-load.c | 27 ++++++++++++++++++++++++++-
units/systemd-modules-load.service.in | 1 +
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c
index 7b19ee0..36b1a68 100644
--- a/src/modules-load/modules-load.c
+++ b/src/modules-load/modules-load.c
@@ -262,6 +262,9 @@ static int parse_argv(int argc, char *argv[]) {
int main(int argc, char *argv[]) {
int r, k;
struct kmod_ctx *ctx;
+#ifdef HAVE_SYSV_COMPAT
+ _cleanup_free_ char *modules_on_boot = NULL;
+#endif
r = parse_argv(argc, argv);
if (r <= 0)
@@ -318,7 +321,29 @@ int main(int argc, char *argv[]) {
r = k;
}
}
-
+#ifdef HAVE_SYSV_COMPAT
+ log_debug("apply: /etc/sysconfig/kernel MODULES_LOADED_ON_BOOT");
+ if ((r = parse_env_file("/etc/sysconfig/kernel", NEWLINE,
+ "MODULES_LOADED_ON_BOOT", &modules_on_boot,
+ NULL)) < 0) {
+ if (r != -ENOENT)
+ log_warning("Failed to read /etc/sysconfig/kernel: %s", strerror(-r));
+ } else
+ r = EXIT_SUCCESS;
+ if (modules_on_boot) {
+ char **modules = strv_split(modules_on_boot,WHITESPACE);
+ char **module;
+
+ if (modules) {
+ STRV_FOREACH(module, modules) {
+ k = load_module(ctx, *module);
+ if (k < 0)
+ r = EXIT_FAILURE;
+ }
+ }
+ strv_free(modules);
+ }
+#endif
finish:
kmod_unref(ctx);
strv_free(arg_proc_cmdline_modules);
diff --git a/units/systemd-modules-load.service.in b/units/systemd-modules-load.service.in
index 32deb52..2e26d2f 100644
--- a/units/systemd-modules-load.service.in
+++ b/units/systemd-modules-load.service.in
@@ -13,6 +13,7 @@ Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service
Before=sysinit.target shutdown.target
ConditionCapability=CAP_SYS_MODULE
+ConditionPathExists=|/etc/sysconfig/kernel
ConditionDirectoryNotEmpty=|/lib/modules-load.d
ConditionDirectoryNotEmpty=|/usr/lib/modules-load.d
ConditionDirectoryNotEmpty=|/usr/local/lib/modules-load.d

31
nss-myhostname-config Normal file
View File

@ -0,0 +1,31 @@
#!/bin/bash
# sed calls copied from fedora package
set -e
case "$1" in
--help)
echo "$0 [--enable|--disable]"
exit 0
;;
--enable)
sed -i.bak -e '
/^hosts:/ !b
/\<myhostname\>/ b
s/[[:blank:]]*$/ myhostname/
' /etc/nsswitch.conf
;;
--disable)
sed -i.bak -e '
/^hosts:/ !b
s/[[:blank:]]\+myhostname\>//
' /etc/nsswitch.conf
;;
"")
if grep -q "^hosts:.*\<myhostname\>" /etc/nsswitch.conf; then
echo "enabled"
else
echo "disabled"
fi
;;
*) echo "invalid argument $1"; exit 1 ;;
esac

View File

@ -0,0 +1,106 @@
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Fri, 20 May 2011 15:38:46 +0200
Subject: optionally warn if nss-myhostname is called
---
configure.ac | 11 +++++++++++
src/nss-myhostname/nss-myhostname.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
diff --git a/configure.ac b/configure.ac
index e1278e8..06eb98d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -725,6 +725,17 @@ if test "x$enable_myhostname" != "xno"; then
fi
AM_CONDITIONAL(HAVE_MYHOSTNAME, [test "$have_myhostname" = "yes"])
+if test "x$have_myhostname" != "xno"; then
+ AC_MSG_CHECKING([log warning messages for nss-myhostname])
+ AC_ARG_WITH(nss-my-hostname-warning, AS_HELP_STRING([--with-nss-my-hostname-warning], [log warning to syslog when nss-myhostname is called (default=no)]),[],[with_nss_my_hostname_warning=no])
+ AC_MSG_RESULT([$with_nss_my_hostname_warning])
+
+ if test x$with_nss_my_hostname_warning != xno; then
+ AC_CHECK_HEADERS([syslog.h])
+ AC_DEFINE([LOG_NSS_MY_HOSTNAME_WARNING],[1],[whether to log warning message for nss-myhostname])
+ fi
+fi
+
# ------------------------------------------------------------------------------
AC_ARG_WITH(firmware-path,
AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
diff --git a/src/nss-myhostname/nss-myhostname.c b/src/nss-myhostname/nss-myhostname.c
index e97d4e5..a2a6de8 100644
--- a/src/nss-myhostname/nss-myhostname.c
+++ b/src/nss-myhostname/nss-myhostname.c
@@ -29,6 +29,9 @@
#include <net/if.h>
#include <stdlib.h>
#include <arpa/inet.h>
+#ifdef LOG_NSS_MY_HOSTNAME_WARNING
+#include <syslog.h>
+#endif
#include "ifconf.h"
#include "macro.h"
@@ -47,6 +50,10 @@
#define LOCALADDRESS_IPV6 &in6addr_loopback
#define LOOPBACK_INTERFACE "lo"
+#ifdef LOG_NSS_MY_HOSTNAME_WARNING
+static void warn(const char* hn);
+#endif
+
enum nss_status _nss_myhostname_gethostbyname4_r(
const char *name,
struct gaih_addrtuple **pat,
@@ -129,6 +136,9 @@ enum nss_status _nss_myhostname_gethostbyname4_r(
return NSS_STATUS_NOTFOUND;
}
+#ifdef LOG_NSS_MY_HOSTNAME_WARNING
+ warn(hn);
+#endif
/* If this fails, n_addresses is 0. Which is fine */
ifconf_acquire_addresses(&addresses, &n_addresses);
@@ -382,6 +392,9 @@ enum nss_status _nss_myhostname_gethostbyname3_r(
local_address_ipv4 = LOCALADDRESS_IPV4;
}
+#ifdef LOG_NSS_MY_HOSTNAME_WARNING
+ warn(hn);
+#endif
return fill_in_hostent(
canonical, additional,
af,
@@ -509,6 +522,9 @@ found:
canonical = hn;
}
+#ifdef LOG_NSS_MY_HOSTNAME_WARNING
+ warn(hn);
+#endif
return fill_in_hostent(
canonical, additional,
af,
@@ -537,3 +553,19 @@ enum nss_status _nss_myhostname_gethostbyaddr_r(
errnop, h_errnop,
NULL);
}
+
+#ifdef LOG_NSS_MY_HOSTNAME_WARNING
+static void warn(const char* hn) {
+ if (strstr(program_invocation_short_name, "nscd")) {
+ syslog(LOG_WARNING,
+ "Some application tried to resolve hostname \"%s\" which is not in DNS. Stop nscd to find out which one.\n",
+ hn);
+ } else {
+ syslog(LOG_WARNING,
+ "%s(%u) tried to resolve hostname \"%s\" which is not in DNS. This might be the reason for the delays you experience.\n",
+ program_invocation_short_name,
+ getpid(),
+ hn);
+ }
+}
+#endif

View File

@ -0,0 +1,131 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Fri, 30 Sep 2011 13:55:31 +0000
Subject: parse /etc/insserv.conf and adds dependencies accordingly
(bnc#721428)
---
src/core/service.c | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 104 insertions(+)
diff --git a/src/core/service.c b/src/core/service.c
index 3617c24..3c66cdb 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -3443,6 +3443,108 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
}
#ifdef HAVE_SYSV_COMPAT
+static void sysv_parse_insserv_conf(Manager *mgr, const char* filename) {
+ FILE *f = NULL;
+ int r;
+
+ if (!(f = fopen(filename, "re"))) {
+ log_debug("Failed to open file %s", filename);
+ r = errno == ENOENT ? 0 : -errno;
+ goto finish;
+ }
+
+ while (!feof(f)) {
+ char l[LINE_MAX], *t;
+ char **parsed = NULL;
+
+ if (!fgets(l, sizeof(l), f)) {
+ if (feof(f))
+ break;
+
+ r = -errno;
+ log_error("Failed to read configuration file '%s': %s", filename, strerror(-r));
+ goto finish;
+ }
+
+ t = strstrip(l);
+ if (*t != '$' && *t != '<')
+ continue;
+
+ parsed = strv_split(t,WHITESPACE);
+ /* we ignore <interactive>, not used, equivalent to X-Interactive */
+ if (parsed && !startswith_no_case (parsed[0], "<interactive>")) {
+ char *facility;
+ Unit *u;
+ if (sysv_translate_facility(parsed[0], NULL, &facility) < 0)
+ continue;
+ if (streq(facility, SPECIAL_REMOTE_FS_TARGET)) {
+ /* insert also a Wants dependency from remote-fs-pre on remote-fs */
+ u = manager_get_unit(mgr, SPECIAL_REMOTE_FS_TARGET);
+ if (u) {
+ unit_add_dependency_by_name(u, UNIT_WANTS, SPECIAL_REMOTE_FS_PRE_TARGET, NULL, true);
+ free (facility);
+ facility=strdup(SPECIAL_REMOTE_FS_PRE_TARGET);
+ }
+ }
+ u = manager_get_unit(mgr, facility);
+ if (u && (u->type == UNIT_TARGET)) {
+ char *dep = NULL, *name, **j;
+
+ STRV_FOREACH (j, parsed+1) {
+ if (*j[0] == '+')
+ name = *j+1;
+ else
+ name = *j;
+ if (streq(name, "boot.localfs") ||
+ streq(name, "boot.crypto"))
+ continue;
+ if ((sysv_translate_facility(name, NULL, &dep) < 0) || !dep)
+ continue;
+
+ r = unit_add_two_dependencies_by_name_inverse(u, UNIT_WANTS, UNIT_BEFORE, dep, NULL, true);
+ if (*j[0] != '+')
+ r = unit_add_dependency_by_name(u, UNIT_REQUIRES, dep, NULL, true);
+ free(dep);
+ }
+ }
+ free(facility);
+ }
+ strv_free(parsed);
+ }
+finish:
+ if (f)
+ fclose(f);
+
+}
+
+static void sysv_facility_in_insserv_conf(Manager *mgr) {
+ DIR *d =NULL;
+ struct dirent *de;
+
+#ifdef TARGET_DEBIAN
+ if (!(d = opendir("/etc/insserv.conf.d/")))
+ if (errno != ENOENT) {
+ log_warning("opendir() failed on /etc/insserv.conf.d/ %s", strerror(errno));
+ goto finish;
+ }
+
+ while ((de = readdir(d))) {
+ char *path = NULL;
+ if (ignore_file(de->d_name))
+ continue;
+
+ path = join("/etc/insserv.conf.d/", de->d_name, NULL);
+ sysv_parse_insserv_conf(mgr, path);
+ free(path);
+ }
+finish:
+ if (d)
+ closedir(d);
+#endif
+
+ sysv_parse_insserv_conf(mgr, "/etc/insserv.conf");
+}
+
static int service_enumerate(Manager *m) {
char **p;
@@ -3603,6 +3705,8 @@ static int service_enumerate(Manager *m) {
r = 0;
+ sysv_facility_in_insserv_conf (m);
+
finish:
for (i = 0; i < ELEMENTSOF(rcnd_table); i++)

16
pre_checkin.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/sh
# This script is based on libcdio_spec-prepare.sh (thanks to sbrabec@suse.cz)
# create a -mini spec for systemd for bootstrapping
ORIG_SPEC=systemd
EDIT_WARNING="##### WARNING: please do not edit this auto generated spec file. Use the ${ORIG_SPEC}.spec! #####\n"
sed "s/^%define bootstrap.*$/${EDIT_WARNING}%define bootstrap 1/;
s/^%define udevpkgname.*$/${EDIT_WARNING}%define udevpkgname udev-mini/;
s/^\(Name:.*\)$/\1-mini/;
s/^BuildRoot.*/&\n\nProvides: %{real} = %{version}-%{release}\n/
" < ${ORIG_SPEC}.spec > ${ORIG_SPEC}-mini.spec
cp ${ORIG_SPEC}.changes ${ORIG_SPEC}-mini.changes
cp ${ORIG_SPEC}-rpmlintrc ${ORIG_SPEC}-mini-rpmlintrc
osc service localrun format_spec_file

View File

@ -0,0 +1,91 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Wed, 7 Dec 2011 15:15:07 +0000
Subject: remain_after_exit initscript heuristic and add new LSB headers
Add remain_after_exit heuristic for initscripts and add LSB headers
PIDFile: and X-Systemd-RemainAfterExit to control it.
(bnc#721426) (bnc#727771)
---
src/core/service.c | 34 ++++++++++++++++++++++++++++++++--
src/core/service.h | 1 +
2 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/src/core/service.c b/src/core/service.c
index a8b0d9d..c357b33 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -135,6 +135,7 @@ static void service_init(Unit *u) {
#ifdef HAVE_SYSV_COMPAT
s->sysv_start_priority = -1;
s->sysv_start_priority_from_rcnd = -1;
+ s->sysv_remain_after_exit_heuristic = true;
#endif
s->socket_fd = -1;
s->guess_main_pid = true;
@@ -875,6 +876,34 @@ static int service_load_sysv_path(Service *s, const char *path) {
free(short_description);
short_description = d;
+ } else if (startswith_no_case(t, "PIDFile:")) {
+ char *fn;
+
+ state = LSB;
+
+ fn = strstrip(t+8);
+ if (!path_is_absolute(fn)) {
+ log_warning("[%s:%u] PID file not absolute. Ignoring.", path, line);
+ continue;
+ }
+
+ if (!(fn = strdup(fn))) {
+ r = -ENOMEM;
+ goto finish;
+ }
+
+ free(s->pid_file);
+ s->pid_file = fn;
+ s->sysv_remain_after_exit_heuristic = false;
+ s->remain_after_exit = false;
+ } else if (startswith_no_case(t, "X-Systemd-RemainAfterExit:")) {
+ char *j;
+
+ state = LSB;
+ if ((j = strstrip(t+26)) && *j) {
+ s->remain_after_exit = parse_boolean(j);
+ s->sysv_remain_after_exit_heuristic = false;
+ }
} else if (state == LSB_DESCRIPTION) {
if (startswith(l, "#\t") || startswith(l, "# ")) {
@@ -925,7 +954,8 @@ static int service_load_sysv_path(Service *s, const char *path) {
/* Special setting for all SysV services */
s->type = SERVICE_FORKING;
- s->remain_after_exit = !s->pid_file;
+ if (s->sysv_remain_after_exit_heuristic)
+ s->remain_after_exit = !s->pid_file;
s->guess_main_pid = false;
s->restart = SERVICE_RESTART_NO;
s->exec_context.ignore_sigpipe = false;
@@ -2077,7 +2107,7 @@ static void service_enter_running(Service *s, ServiceResult f) {
if ((main_pid_ok > 0 || (main_pid_ok < 0 && cgroup_ok != 0)) &&
(s->bus_name_good || s->type != SERVICE_DBUS)) {
#ifdef HAVE_SYSV_COMPAT
- if (s->sysv_enabled && !s->pid_file)
+ if (s->sysv_enabled && !s->pid_file && s->sysv_remain_after_exit_heuristic)
s->remain_after_exit = false;
#endif
service_set_state(s, SERVICE_RUNNING);
diff --git a/src/core/service.h b/src/core/service.h
index 703d3fa..dc52e8c 100644
--- a/src/core/service.h
+++ b/src/core/service.h
@@ -176,6 +176,7 @@ struct Service {
bool is_sysv:1;
bool sysv_has_lsb:1;
bool sysv_enabled:1;
+ bool sysv_remain_after_exit_heuristic:1;
int sysv_start_priority_from_rcnd;
int sysv_start_priority;

View File

@ -0,0 +1,89 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Mon, 29 Oct 2012 13:01:20 +0000
Subject: restore /var/run and /var/lock bind mount if they aren't symlink
---
Makefile.am | 9 +++++++++
units/var-lock.mount | 19 +++++++++++++++++++
units/var-run.mount | 19 +++++++++++++++++++
3 files changed, 47 insertions(+)
create mode 100644 units/var-lock.mount
create mode 100644 units/var-run.mount
diff --git a/Makefile.am b/Makefile.am
index 8730f66..b8cf696 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -409,6 +409,12 @@ dist_systemunit_DATA = \
units/system-update.target \
units/initrd-switch-root.target
+if HAVE_SYSV_COMPAT
+dist_systemunit_DATA += \
+ units/var-run.mount \
+ units/var-lock.mount
+endif
+
nodist_systemunit_DATA = \
units/getty@.service \
units/serial-getty@.service \
@@ -4058,6 +4064,9 @@ RUNLEVEL4_TARGET_WANTS += \
systemd-update-utmp-runlevel.service
RUNLEVEL5_TARGET_WANTS += \
systemd-update-utmp-runlevel.service
+LOCAL_FS_TARGET_WANTS += \
+ var-run.mount \
+ var-lock.mount
endif
SHUTDOWN_TARGET_WANTS += \
systemd-update-utmp-shutdown.service
diff --git a/units/var-lock.mount b/units/var-lock.mount
new file mode 100644
index 0000000..07277ad
--- /dev/null
+++ b/units/var-lock.mount
@@ -0,0 +1,19 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Lock Directory
+Before=local-fs.target
+# skip mounting if the directory does not exist or is a symlink
+ConditionPathIsDirectory=/var/lock
+ConditionPathIsSymbolicLink=!/var/lock
+
+[Mount]
+What=/run/lock
+Where=/var/lock
+Type=bind
+Options=bind
diff --git a/units/var-run.mount b/units/var-run.mount
new file mode 100644
index 0000000..ab4da42
--- /dev/null
+++ b/units/var-run.mount
@@ -0,0 +1,19 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Runtime Directory
+Before=local-fs.target
+# skip mounting if the directory does not exist or is a symlink
+ConditionPathIsDirectory=/var/run
+ConditionPathIsSymbolicLink=!/var/run
+
+[Mount]
+What=/run
+Where=/var/run
+Type=bind
+Options=bind

View File

@ -0,0 +1,20 @@
From: Robert Schweikert <rjschwei@suse.com>
Date: Fri, 12 Apr 2013 12:08:16 -0400
Subject: rules: add lid switch of ARM based Chromebook as a power switch to
logind
---
src/login/70-power-switch.rules | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/login/70-power-switch.rules b/src/login/70-power-switch.rules
index 36fb827..d925ab7 100644
--- a/src/login/70-power-switch.rules
+++ b/src/login/70-power-switch.rules
@@ -9,5 +9,6 @@ ACTION=="remove", GOTO="power_switch_end"
SUBSYSTEM=="input", KERNEL=="event*", SUBSYSTEMS=="acpi", TAG+="power-switch"
SUBSYSTEM=="input", KERNEL=="event*", KERNELS=="thinkpad_acpi", TAG+="power-switch"
+SUBSYSTEM=="input", KERNEL=="event*", KERNELS=="gpio-keys.8", TAG+="power-switch"
LABEL="power_switch_end"

View File

@ -0,0 +1,33 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Fri, 30 Sep 2011 12:58:17 +0200
Subject: service: flags sysv service with detected pid as
RemainAfterExit=false
LSB header doesn't give pidfile, so all LSB initscripts have
RemainAfterExit=false, causing daemon termination to not be reported as
such by systemd. Checking at startup if daemon is still running for
sysv initscript to disable RemainAfterExit helps a lot.
Fixes https://bugzilla.novell.com/show_bug.cgi?id=721426
---
src/core/service.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Index: systemd-204/src/core/service.c
===================================================================
--- systemd-204.orig/src/core/service.c
+++ systemd-204/src/core/service.c
@@ -2075,8 +2075,13 @@ static void service_enter_running(Servic
cgroup_ok = cgroup_good(s);
if ((main_pid_ok > 0 || (main_pid_ok < 0 && cgroup_ok != 0)) &&
- (s->bus_name_good || s->type != SERVICE_DBUS))
+ (s->bus_name_good || s->type != SERVICE_DBUS)) {
+#ifdef HAVE_SYSV_COMPAT
+ if (s->sysv_enabled && !s->pid_file)
+ s->remain_after_exit = false;
+#endif
service_set_state(s, SERVICE_RUNNING);
+ }
else if (s->remain_after_exit)
service_set_state(s, SERVICE_EXITED);
else

View File

@ -0,0 +1,50 @@
From 752a4370ecb5643a432ad73b1e22c80cd304948f Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Fri, 17 May 2013 13:31:46 +0200
Subject: [PATCH] sysctl: handle /boot/sysctl.conf-<kernel_release>
Add support for kernel release sysctl.conf files (for per-flavor
configuration), needed by openSUSE (bnc#809420).
---
src/sysctl/sysctl.c | 8 ++++++++
units/systemd-sysctl.service.in | 1 +
2 files changed, 9 insertions(+)
Index: systemd-204/src/sysctl/sysctl.c
===================================================================
--- systemd-204.orig/src/sysctl/sysctl.c
+++ systemd-204/src/sysctl/sysctl.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <limits.h>
#include <getopt.h>
+#include <sys/utsname.h>
#include "log.h"
#include "strv.h"
@@ -297,6 +298,13 @@ int main(int argc, char *argv[]) {
} else {
_cleanup_strv_free_ char **files = NULL;
char **f;
+ char kernel_sysctl[PATH_MAX];
+ struct utsname uts;
+
+ assert_se(uname(&uts) >= 0);
+
+ snprintf(kernel_sysctl, sizeof(kernel_sysctl), "/boot/sysctl.conf-%s", uts.release);
+ r = parse_file(sysctl_options, kernel_sysctl, true);
r = conf_files_list_nulstr(&files, ".conf", NULL, conf_file_dirs);
if (r < 0) {
Index: systemd-204/units/systemd-sysctl.service.in
===================================================================
--- systemd-204.orig/units/systemd-sysctl.service.in
+++ systemd-204/units/systemd-sysctl.service.in
@@ -20,6 +20,7 @@ ConditionDirectoryNotEmpty=|/usr/lib/sys
ConditionDirectoryNotEmpty=|/usr/local/lib/sysctl.d
ConditionDirectoryNotEmpty=|/etc/sysctl.d
ConditionDirectoryNotEmpty=|/run/sysctl.d
+ConditionPathExistsGlob=|/boot/sysctl.conf-*
[Service]
Type=oneshot

View File

@ -0,0 +1,27 @@
From 9541fe6adff9941e487084c718ff2d46ed2929c6 Mon Sep 17 00:00:00 2001
From: Auke Kok <auke-jan.h.kok@intel.com>
Date: Thu, 9 May 2013 09:39:15 -0700
Subject: [PATCH] systemctl does not expand %u, so revert back to %I
The description field is only displayed by systemctl, and
it can't expand %u properly (it will always display "root").
---
units/user@.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/units/user@.service.in b/units/user@.service.in
index 3cf1347..ece671d 100644
--- a/units/user@.service.in
+++ b/units/user@.service.in
@@ -6,7 +6,7 @@
# (at your option) any later version.
[Unit]
-Description=User Manager for %u
+Description=User Manager for %I
After=systemd-user-sessions.service
[Service]
--
1.8.1.4

3
systemd-204.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:072c393503c7c1e55ca7acf3db659cbd28c7fe5fa94fab3db95360bafd96731b
size 2186264

34
systemd-insserv_conf Normal file
View File

@ -0,0 +1,34 @@
#!/bin/bash
[ -r /etc/insserv.conf ] || exit 0
declare -A facilities
facilities["local_fs"]="local-fs.target"
facilities["localfs"]="local-fs.target"
facilities["named"]="nss-lookup.target"
facilities["network"]="network.target"
# done in systemd code
#facilities["portmap"]="rpcbind.target"
facilities["remote_fs"]="remote-fs.target"
facilities["syslog"]="syslog.target"
facilities["time"]="time-sync.target"
while read line ; do
case "$line" in
\#*|"" ) continue;;
\<* ) continue;;
\$*) t=${line%% *}
target=${facilities[${t:1}]}
[ -z $target ] && continue
mkdir -p $1/$target.{requires,wants}
for dep in ${line##* } ; do
stripped_dep=${dep/boot./}
case "$stripped_dep" in
+*) ln -s -f /lib/systemd/system/${facilities[${stripped_dep:2}]:-${stripped_dep:1}.service} $1/$target.wants/ ;;
*) ln -s -f /lib/systemd/system/${facilities[${stripped_dep:1}]:-${stripped_dep}.service} $1/$target.requires/ ;;
esac
done
;;
esac
done < /etc/insserv.conf

33
systemd-journald.init Normal file
View File

@ -0,0 +1,33 @@
#! /bin/sh
#
# Copyright (c) 2001-2002 SuSE Linux AG, Nuernberg, Germany.
# All rights reserved.
#
# /etc/init.d/systemd-journald
#
### BEGIN INIT INFO
# Provides: syslog
# Required-Start: $null
# Required-Stop: $null
# Default-Start: 2 3 5
# Default-Stop:
# Short-Description: compat wrapper for journald
# Description: compat wrapper for journald
### END INIT INFO
. /etc/rc.status
rc_reset
case "$1" in
start|stop|restart)
rc_failed 3
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
rc_exit

18
systemd-mini-rpmlintrc Normal file
View File

@ -0,0 +1,18 @@
addFilter(".*dangling-symlink /sbin/(halt|init|poweroff|telinit|shutdown|runlevel|reboot).*")
addFilter(".*dangling-symlink .* /dev/null.*")
addFilter(".*files-duplicate .*/reboot.8.*")
addFilter(".*files-duplicate .*/sd_is_socket.3.*")
addFilter("non-conffile-in-etc /etc/bash_completion.d/systemd-bash-completion.sh")
addFilter("non-conffile-in-etc /etc/rpm/macros.systemd")
addFilter(".*dbus-policy-allow-receive")
addFilter(".*dangling-symlink /lib/udev/devices/std(in|out|err).*")
addFilter(".*dangling-symlink /lib/udev/devices/core.*")
addFilter(".*dangling-symlink /lib/udev/devices/fd.*")
addFilter(".*incoherent-init-script-name boot.udev.*")
addFilter(".init-script-without-%stop_on_removal-preun /etc/init.d/boot.udev")
addFilter(".init-script-without-%restart_on_update-postun /etc/init.d/boot.udev")
addFilter(".*devel-file-in-non-devel-package.*udev.pc.*")
addFilter(".*libgudev-.*shlib-fixed-dependency.*")
addFilter(".*suse-filelist-forbidden-systemd-userdirs.*")
addFilter("libudev-mini.*shlib-policy-name-error.*")
addFilter("nss-myhostname.*shlib-policy-name-error.*")

3118
systemd-mini.changes Normal file

File diff suppressed because it is too large Load Diff

1076
systemd-mini.spec Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
-------------------------------------------------------------------
Mon Jun 17 10:49:50 UTC 2013 - mhrusecky@suse.com
- New package with systemd rpm macros to avoid unnecessary build time
dependencies

57
systemd-rpm-macros.spec Normal file
View File

@ -0,0 +1,57 @@
#
# spec file for package systemd-rpm-macros
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
#!BuildIgnore: util-linux
Name: systemd-rpm-macros
Version: 1
Release: 0
Summary: RPM macros for systemd
License: LGPL-2.1+
Group: System/Base
Url: http://en.opensuse.org/openSUSE:Systemd_packaging_guidelines
Source0: macros.systemd
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%description
Starting with openSUSE 12.1, several RPM macros must be used to package systemd
services files. This package provides these macros.
%prep
%build
%install
mkdir -p %{buildroot}%{_sysconfdir}/rpm
install -m644 %{S:0} %{buildroot}%{_sysconfdir}/rpm
UNITDIR="`cat %{S:0} | sed -n 's|.*_unitdir[[:blank:]]*||p'`"
for i in $UNITDIR `dirname $UNITDIR`; do
mkdir -p %{buildroot}$i
echo $i >> unitdir
done
%post
%postun
%files -f unitdir
%defattr(-,root,root)
%{_sysconfdir}/rpm/macros.systemd
%changelog

18
systemd-rpmlintrc Normal file
View File

@ -0,0 +1,18 @@
addFilter(".*dangling-symlink /sbin/(halt|init|poweroff|telinit|shutdown|runlevel|reboot).*")
addFilter(".*dangling-symlink .* /dev/null.*")
addFilter(".*files-duplicate .*/reboot.8.*")
addFilter(".*files-duplicate .*/sd_is_socket.3.*")
addFilter("non-conffile-in-etc /etc/bash_completion.d/systemd-bash-completion.sh")
addFilter("non-conffile-in-etc /etc/rpm/macros.systemd")
addFilter(".*dbus-policy-allow-receive")
addFilter(".*dangling-symlink /lib/udev/devices/std(in|out|err).*")
addFilter(".*dangling-symlink /lib/udev/devices/core.*")
addFilter(".*dangling-symlink /lib/udev/devices/fd.*")
addFilter(".*incoherent-init-script-name boot.udev.*")
addFilter(".init-script-without-%stop_on_removal-preun /etc/init.d/boot.udev")
addFilter(".init-script-without-%restart_on_update-postun /etc/init.d/boot.udev")
addFilter(".*devel-file-in-non-devel-package.*udev.pc.*")
addFilter(".*libgudev-.*shlib-fixed-dependency.*")
addFilter(".*suse-filelist-forbidden-systemd-userdirs.*")
addFilter("libudev-mini.*shlib-policy-name-error.*")
addFilter("nss-myhostname.*shlib-policy-name-error.*")

179
systemd-sysv-convert Normal file
View File

@ -0,0 +1,179 @@
#!/bin/bash
if [ "$UID" != "0" ]; then
echo Need to be root.
exit 1
fi
declare -A results_runlevel
declare -A results_priority
usage() {
cat << EOF
usage: systemd-sysv-convert [-h] [--save] [--show] [--apply]
SERVICE [SERVICE ...]
EOF
}
help() {
usage
cat << EOF
Save and Restore SysV Service Runlevel Information
positional arguments:
SERVICE Service names
optional arguments:
-h, --help show this help message and exit
--save Save SysV runlevel information for one or more services
--show Show saved SysV runlevel information for one or more services
--apply Apply saved SysV runlevel information for one or more services
to systemd counterparts
EOF
}
find_service() {
local service
local runlevel
declare -i priority
service=$1
runlevel=$2
priority=-1
for l in $(ls /etc/rc.d/rc$runlevel.d/) ; do
initscript=$(basename $l)
if [ ${initscript:0:1} != "S" -o ${initscript:3} != "$service" ]; then
continue
fi
if [ ${initscript:1:2} -ge 0 -a ${initscript:1:2} -le 99 -a ${initscript:1:2} -ge $priority ]; then
if [ ${initscript:1:1} == 0 ]; then
priority=${initscript:2:1}
else
priority=${initscript:1:2}
fi
fi
done
if [ $priority -ge 0 ]; then
return $priority
else
return 255
fi
}
lookup_database() {
local services
local service
local service_file
local runlevel
local priority
local -i k
declare -a parsed
services=$@
k=0
results_runlevel=()
results_priority=()
while read line ; do
k+=1
parsed=($line)
service=${parsed[0]}
runlevel=${parsed[1]}
priority=${parsed[2]}
if [ $runlevel -lt 2 -o $runlevel -gt 5 ]; then
echo "Runlevel out of bounds in database line $k. Ignoring" >/dev/stderr
continue
fi
if [ $priority -lt 0 -o $priority -gt 99 ]; then
echo "Priority out of bounds in database line $k. Ignoring" >/dev/stderr
continue
fi
declare -i found
found=0
for s in $services ; do
if [ $s == $service ]; then
found=1
continue
fi
done
if [ $found -eq 0 ]; then
continue
fi
results_runlevel[$service]+=" $runlevel"
results_priority[$service]+=" $priority"
done < /var/lib/systemd/sysv-convert/database
}
case "$1" in
-h|--help)
help
exit 0
;;
--save)
shift
for service in $@ ; do
if [ ! -r "/etc/init.d/$service" ]; then
echo "SysV service $service does not exist" >/dev/stderr
exit 1
fi
for runlevel in 2 3 4 5; do
find_service $service $runlevel
priority=$?
if [ $priority -lt 255 ]; then
echo "$service $runlevel $priority" >> /var/lib/systemd/sysv-convert/database
fi
done
done
;;
--show)
shift
services=$@
lookup_database $services
fail=0
for service in $services; do
if [ -z "${results_runlevel[$service]}" ]; then
echo No information found about service $service found. >/dev/stderr
fail=1
continue
fi
declare -i count
count=0
priority=(${results_priority[$service]})
for runlevel in ${results_runlevel[$service]}; do
echo SysV service $service enabled in runlevel $runlevel at priority ${priority[$count]}
count+=1
done
done
exit $fail
;;
--apply)
shift
services=$@
for service in $services; do
if [ ! -f "/lib/systemd/system/$service.service" -a ! -f "/usr/lib/systemd/system/$service.service" ]; then
echo systemd service $service.service does not exist. >/dev/stderr
exit 1
fi
done
lookup_database $services
for service in $services; do
[ -f "/lib/systemd/system/$service.service" ] && service_file="/lib/systemd/system/$service.service"
[ -f "/usr/lib/systemd/system/$service.service" ] && service_file="/usr/lib/systemd/system/$service.service"
if [ -z "${results_runlevel[$service]}" ]; then
echo No information found about service $service found. >/dev/stderr
fail=1
continue
fi
for runlevel in ${results_runlevel[$service]}; do
echo ln -sf $service_file /etc/systemd/system/runlevel$runlevel.target.wants/$service.service >/dev/stderr
mkdir -p "/etc/systemd/system/runlevel$runlevel.target.wants"
/bin/ln -sf $service_file /etc/systemd/system/runlevel$runlevel.target.wants/$service.service
done
done
;;
*) usage
exit 2;;
esac

View File

@ -0,0 +1,26 @@
From: Reinhard Max <max@suse.de>
Date: Fri, 19 Apr 2013 16:12:28 +0200
Subject: systemd tmp safe defaults
Fix regression in the default for tmp auto-deletion (FATE#314974).
SUSE policy is to not clean /tmp by default.
---
tmpfiles.d/tmp.conf | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tmpfiles.d/tmp.conf b/tmpfiles.d/tmp.conf
index 3b534a1..99eb6f2 100644
--- a/tmpfiles.d/tmp.conf
+++ b/tmpfiles.d/tmp.conf
@@ -8,8 +8,9 @@
# See tmpfiles.d(5) for details
# Clear tmp directories separately, to make them easier to override
-d /tmp 1777 root root 10d
-d /var/tmp 1777 root root 30d
+# SUSE policy: we don't clean those directories
+d /tmp 1777 root root -
+d /var/tmp 1777 root root -
# Exclude namespace mountpoints created with PrivateTmp=yes
x /tmp/systemd-private-*

View File

@ -0,0 +1,9 @@
[Unit]
Description=Create dynamic rule for /dev/root link
Before=udev.service
DefaultDependencies=no
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=@@PREFIX@@/write_dev_root_rule

3118
systemd.changes Normal file

File diff suppressed because it is too large Load Diff

1071
systemd.spec Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Tue, 14 Aug 2012 14:26:16 +0200
Subject: timedate: add support for openSUSE version of /etc/sysconfig/clock
---
src/timedate/timedated.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index cdb6e5b..7246452 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -182,6 +182,13 @@ static int read_data(void) {
goto have_timezone;
}
}
+#ifdef HAVE_SYSV_COMPAT
+ r = parse_env_file("/etc/sysconfig/clock", NEWLINE,
+ "TIMEZONE", &tz.zone,
+ NULL);
+ if (r < 0 && r != -ENOENT)
+ log_warning("Failed to read /etc/sysconfig/clock: %s", strerror(-r));
+#endif
have_timezone:
if (isempty(tz.zone)) {

13
write_dev_root_rule Normal file
View File

@ -0,0 +1,13 @@
#!/bin/sh
eval $(@@PREFIX@@/udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/)
[ "$ROOT_MAJOR" -gt 0 ] || return
mkdir -m 0755 -p /run/udev/rules.d >/dev/null 2>&1
ln -sf /run/udev /dev/.udev 2>/dev/null || :
echo "ACTION==\"add|change\", SUBSYSTEM==\"block\", \
ENV{MAJOR}==\"$ROOT_MAJOR\", ENV{MINOR}==\"$ROOT_MINOR\", \
SYMLINK+=\"root\"" > /run/udev/rules.d/10-root-symlink.rules
exit 0