Accepting request 87532 from Base:System

- Shadow single sysv service, it was breaking runlevel 1.
- Add modules_on_boot.patch to handle /etc/sysconfig/kernel
  MODULES_ON_BOOT variable (bnc#721662). (forwarded request 87530 from fcrozat)

OBS-URL: https://build.opensuse.org/request/show/87532
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=75
This commit is contained in:
Lars Vogdt 2011-10-12 22:02:20 +00:00 committed by Git OBS Bridge
commit c92fbc8802
10 changed files with 305 additions and 211 deletions

View File

@ -1,30 +0,0 @@
From 8185a5090a34531b9ef0a65ed3e948e7b6839754 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 29 Sep 2011 15:31:53 +0200
Subject: [PATCH] systemctl: fix detection whether the dbus connection is available
---
src/systemctl.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/systemctl.c b/src/systemctl.c
index 848d6a8..7af0f73 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -4989,6 +4989,13 @@ static int systemctl_main(DBusConnection *bus, int argc, char *argv[], DBusError
return 0;
}
+ if (!bus) {
+ log_error("Failed to get D-Bus connection: %s", error->message);
+ return -EIO;
+ }
+
+ } else {
+
if (!bus && !avoid_bus()) {
log_error("Failed to get D-Bus connection: %s", error->message);
return -EIO;
--
1.7.3.4

View File

@ -1,35 +0,0 @@
From 3887b5abcb3870db9ed53de3875a465c230ddd3f Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 4 Oct 2011 01:38:13 +0200
Subject: [PATCH] logind: properly generate session creation response on dbus
This fixes the various reported issues with dbus message parsing when
running su.
---
src/logind-dbus.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/logind-dbus.c b/src/logind-dbus.c
index b33a096..bc1e49d 100644
--- a/src/logind-dbus.c
+++ b/src/logind-dbus.c
@@ -405,12 +405,16 @@ static int bus_manager_create_session(Manager *m, DBusMessage *message, DBusMess
goto fail;
}
+ seat = session->seat ? session->seat->id : "";
+ vtnr = session->vtnr;
b = dbus_message_append_args(
reply,
DBUS_TYPE_STRING, &session->id,
DBUS_TYPE_OBJECT_PATH, &p,
DBUS_TYPE_STRING, &session->user->runtime_path,
DBUS_TYPE_UNIX_FD, &fifo_fd,
+ DBUS_TYPE_STRING, &seat,
+ DBUS_TYPE_UINT32, &vtnr,
DBUS_TYPE_INVALID);
free(p);
--
1.7.3.4

79
modules_on_boot.patch Normal file
View File

@ -0,0 +1,79 @@
From 051e407e1af70e779c092c81733a98832c29d6b4 Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Wed, 12 Oct 2011 15:18:29 +0200
Subject: [PATCH] module-load: handle SUSE /etc/sysconfig/kernel module list
---
src/modules-load.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/src/modules-load.c b/src/modules-load.c
index 8dd98f7..73ef5f5 100644
--- a/src/modules-load.c
+++ b/src/modules-load.c
@@ -36,6 +36,9 @@ int main(int argc, char *argv[]) {
char **arguments = NULL;
unsigned n_arguments = 0, n_allocated = 0;
char **files, **fn;
+#if defined(TARGET_SUSE)
+ char *modules_on_boot = NULL;
+#endif
if (argc > 1) {
log_error("This program takes no argument.");
@@ -126,6 +129,42 @@ int main(int argc, char *argv[]) {
}
strv_free(files);
+#if defined(TARGET_SUSE)
+ 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));
+ }
+ if (modules_on_boot) {
+ char **modules = strv_split(modules_on_boot,WHITESPACE);
+ char **module;
+ if (modules) {
+ STRV_FOREACH(module, modules) {
+ if (n_arguments >= n_allocated) {
+ char **a;
+ unsigned m;
+
+ m = MAX(16U, n_arguments*2);
+
+ if (!(a = realloc(arguments, sizeof(char*) * (m+1)))) {
+ log_error("Failed to increase module array size.");
+ free(*module);
+ r = EXIT_FAILURE;
+ continue;
+ }
+
+ arguments = a;
+ n_allocated = m;
+ }
+ log_debug("adding module: %s\n", *module);
+ arguments[n_arguments++] = strdup(*module);
+ }
+ }
+ strv_free(modules);
+ }
+#endif
+
finish:
if (n_arguments > 3) {
@@ -138,6 +177,9 @@ finish:
}
strv_free(arguments);
+#if defined(TARGET_SUSE)
+ free(modules_on_boot);
+#endif
return r;
}
--
1.7.3.4

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:693cd0a8ad63c5e22c0fc45115e05180f0d33f60118972c0d5d080957fc69774
size 921952

3
systemd-37.tar.bz2 Normal file
View File

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

View File

@ -1,3 +1,38 @@
-------------------------------------------------------------------
Wed Oct 12 13:21:15 UTC 2011 - fcrozat@suse.com
- Shadow single sysv service, it was breaking runlevel 1.
- Add modules_on_boot.patch to handle /etc/sysconfig/kernel
MODULES_ON_BOOT variable (bnc#721662).
-------------------------------------------------------------------
Wed Oct 12 08:38:36 UTC 2011 - fcrozat@suse.com
- Update to release 37:
- many bugfixes
- ConditionCapability added, useful for containers.
- locale mechanism got extend to kbd configuration for
both X and the console
- don't try to guess PID for SysV services anymore (bnc#723194)
- Drop detect-non-running.patch, logind-warning.patch.
- Rewrite systemd-sysv-convert in bash (bnc#716939)
-------------------------------------------------------------------
Tue Oct 11 13:57:32 UTC 2011 - coolo@suse.com
- make sure updaters get in the /sbin/init from here - the sub package
of the split package will decide which init wins in update case
-------------------------------------------------------------------
Tue Oct 11 13:10:27 UTC 2011 - coolo@suse.com
- under openSUSE if it's not systemd, chances are good it's
sysvinit
-------------------------------------------------------------------
Tue Oct 11 11:07:02 UTC 2011 - coolo@suse.com
- do not list specific sbin_init providers
-------------------------------------------------------------------
Wed Oct 5 16:18:48 UTC 2011 - fcrozat@suse.com

View File

@ -20,7 +20,7 @@
Name: systemd-gtk
Url: http://www.freedesktop.org/wiki/Software/systemd
Version: 36
Version: 37
Release: 1
License: GPLv2+
Group: System/Base

View File

@ -1,148 +1,175 @@
#!/usr/bin/python
# -*- Mode: Python; python-indent: 8; indent-tabs-mode: t -*-
#!/bin/bash
import sys, os, argparse, errno
if [ "$UID" != "0" ]; then
echo Need to be root.
exit 1
fi
def find_service(service, runlevel):
priority = -1
declare -A results_runlevel
declare -A results_priority
for l in os.listdir("/etc/rc.d/rc%i.d" % runlevel):
if len(l) < 4:
usage() {
cat << EOF
usage: systemd-sysv-convert [-h] [--save] [--show] [--apply]
SERVICE [SERVICE ...]
EOF
}
help() {
usage
cat << EOF
Save and Restore SusV 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 /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 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
if l[0] != 'S' or l[3:] != service:
fi
if [ $priority -lt 0 -o $priority -gt 99 ]; then
echo "Priority out of bounds in database line $k. Ignoring" >/dev/stderr
continue
p = int(l[1:3])
if p >= 0 and p <= 99 and p >= priority:
priority = p;
return priority
def lookup_database(services):
try:
database = open("/var/lib/systemd/sysv-convert/database", "r")
except IOError, e:
if e.errno != errno.ENOENT:
raise e
return {}
found = {}
k = 0
for line in database:
service, r, p = line.strip().split("\t", 3)
k += 1
try:
runlevel = int(r)
priority = int(p)
except ValueError, e:
sys.stderr.write("Failed to parse database line %i. Ignoring." % k)
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
}
if runlevel not in (2, 3, 4, 5):
sys.stderr.write("Runlevel out of bounds in database line %i. Ignoring." % k)
continue
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" ]; then
echo systemd service $service.service does not exist. >/dev/stderr
exit 1
fi
done
lookup_database $services
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
for runlevel in ${results_runlevel[$service]}; do
echo ln -sf /lib/systemd/system/$service.service /etc/systemd/system/runlevel$runlevel.target.wants/$service.service >/dev/stderr
mkdir -p "/etc/systemd/system/runlevel$runlevel.target.wants"
/bin/ln -sf /lib/systemd/system/$service.service /etc/systemd/system/runlevel$runlevel.target.wants/$service.service
done
if priority < 0 or priority > 99:
sys.stderr.write("Priority out of bounds in database line %i. Ignoring." % k)
continue
done
;;
*) usage
exit 2;;
esac
if service not in services:
continue
if service not in found:
found[service] = {}
if runlevel not in found[service] or found[service][runlevel] < priority:
found[service][runlevel] = priority
return found
def mkdir_p(path):
try:
os.makedirs(path, 0755)
except OSError, e:
if e.errno != errno.EEXIST:
raise e
if os.geteuid() != 0:
sys.stderr.write("Need to be root.\n")
sys.exit(1)
parser = argparse.ArgumentParser(description='Save and Restore SysV Service Runlevel Information')
parser.add_argument('services', metavar='SERVICE', type=str, nargs='+',
help='Service names')
parser.add_argument('--save', dest='save', action='store_const',
const=True, default=False,
help='Save SysV runlevel information for one or more services')
parser.add_argument('--show', dest='show', action='store_const',
const=True, default=False,
help='Show saved SysV runlevel information for one or more services')
parser.add_argument('--apply', dest='apply', action='store_const',
const=True, default=False,
help='Apply saved SysV runlevel information for one or more services to systemd counterparts')
a = parser.parse_args()
if a.save:
for service in a.services:
if not os.access("/etc/init.d/%s" % service, os.F_OK):
sys.stderr.write("SysV service %s does not exist.\n" % service)
sys.exit(1)
mkdir_p("/var/lib/systemd/sysv-convert")
database = open("/var/lib/systemd/sysv-convert/database", "a")
for runlevel in (2, 3, 4, 5):
priority = find_service(service, runlevel)
if priority >= 0:
database.write("%s\t%s\t%s\n" % (service, runlevel, priority))
elif a.show:
found = lookup_database(a.services)
if len(found) <= 0:
sys.stderr.write("No information about passed services found.\n")
sys.exit(1)
for service, data in found.iteritems():
for runlevel, priority in data.iteritems():
sys.stdout.write("SysV service %s enabled in runlevel %s at priority %s\n" % (service, runlevel, priority))
elif a.apply:
for service in a.services:
if not os.access("/lib/systemd/system/%s.service" % service, os.F_OK):
sys.stderr.write("systemd service %s.service does not exist.\n" % service)
sys.exit(1)
found = lookup_database(a.services)
if len(found) <= 0:
sys.stderr.write("No information about passed services found.\n")
sys.exit(1)
for service, data in found.iteritems():
for runlevel in data.iterkeys():
sys.stderr.write("ln -sf /lib/systemd/system/%s.service /etc/systemd/system/runlevel%i.target.wants/%s.service\n" % (service, runlevel, service))
mkdir_p("/etc/systemd/system/runlevel%i.target.wants" % runlevel)
try:
os.symlink("/lib/systemd/system/%s.service" % service,
"/etc/systemd/system/runlevel%i.target.wants/%s.service" % (runlevel, service))
except OSError, e:
if e.errno != errno.EEXIST:
raise e
else:
parser.print_help()

View File

@ -1,4 +1,22 @@
-------------------------------------------------------------------
Wed Oct 12 13:21:15 UTC 2011 - fcrozat@suse.com
- Shadow single sysv service, it was breaking runlevel 1.
- Add modules_on_boot.patch to handle /etc/sysconfig/kernel
MODULES_ON_BOOT variable (bnc#721662).
-------------------------------------------------------------------
Wed Oct 12 08:38:36 UTC 2011 - fcrozat@suse.com
- Update to release 37:
- many bugfixes
- ConditionCapability added, useful for containers.
- locale mechanism got extend to kbd configuration for
both X and the console
- don't try to guess PID for SysV services anymore (bnc#723194)
- Drop detect-non-running.patch, logind-warning.patch.
- Rewrite systemd-sysv-convert in bash (bnc#716939)
-------------------------------------------------------------------
Tue Oct 11 13:57:32 UTC 2011 - coolo@suse.com
- make sure updaters get in the /sbin/init from here - the sub package

View File

@ -21,7 +21,7 @@
Name: systemd
Url: http://www.freedesktop.org/wiki/Software/systemd
Version: 36
Version: 37
Release: 1
License: GPLv2+
Group: System/Base
@ -66,13 +66,12 @@ Patch8: tty1.patch
Patch10: 0001-service-Fix-dependencies-added-when-parsing-insserv..patch
Patch13: 0001-service-flags-sysv-service-with-detected-pid-as-Rema.patch
Patch15: support-sysvinit.patch
Patch16: modules_on_boot.patch
# Upstream First - Policy:
# Never add any patches to this package without the upstream commit id
# in the patch. Any patches added here without a very good reason to make
# an exception will be silently removed with the next version update.
Patch12: detect-non-running.patch
Patch14: logind-warning.patch
%description
Systemd is a system and service manager, compatible with SysV and LSB
@ -120,10 +119,9 @@ Plymouth integration for systemd
%patch6 -p1
%patch8 -p1
%patch10 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%build
autoreconf -fiv
@ -184,6 +182,7 @@ install -m644 %{S:2} %{buildroot}/lib/systemd/system/localfs.service
#ln -s /dev/null %{buildroot}/lib/systemd/system/localnet.service
ln -s /dev/null %{buildroot}/lib/systemd/system/proc.service
ln -s fsck-root.service %{buildroot}/lib/systemd/system/rootfsck.service
ln -s /dev/null %{buildroot}/lib/systemd/system/single.service
ln -s /dev/null %{buildroot}/lib/systemd/system/swap.service
ln -s /dev/null %{buildroot}/lib/systemd/system/startpreload.service
ln -s /dev/null %{buildroot}/lib/systemd/system/stoppreload.service
@ -298,6 +297,7 @@ rm -rf %{buildroot}
%{_datadir}/polkit-1
%{_datadir}/polkit-1/actions
%{_datadir}/polkit-1/actions/org.freedesktop.systemd1.policy
%{_datadir}/systemd
%if %{build_plymouth}
# Packaged in plymouth subpackage
%exclude /lib/systemd/system/plymouth-*.service