SHA256
1
0
forked from pool/systemd

Accepting request 81718 from Base:System

- Add revert_insserv_conf_parsing.patch and systemd-insserv_conf:
  remove insserv.conf parsing from systemd and use generator
  instead.
- put back default.target creation at package install and remove
  inittab generator, Yast2 is now able to create it.

- Add revert_insserv_conf_parsing.patch and systemd-insserv_conf:
  remove insserv.conf parsing from systemd and use generator
  instead.
- put back default.target creation at package install and remove
  inittab generator, Yast2 is now able to create it. (forwarded request 81717 from fcrozat)

OBS-URL: https://build.opensuse.org/request/show/81718
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=65
This commit is contained in:
Sascha Peilicke 2011-09-11 17:42:54 +00:00 committed by Git OBS Bridge
parent 46e2c8a613
commit 27ab9ee58f
6 changed files with 165 additions and 11 deletions

View File

@ -0,0 +1,103 @@
From b0ff66c6e92ca9d9458f3236ee37397635bb0f0e Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Fri, 9 Sep 2011 11:19:26 +0200
Subject: [PATCH] Revert "service: parse insserv.conf and plugs its system facilities into systemd."
Let's use a generator instead
This reverts commit de3910a324aefcb15c26be27033d6917494e5946.
---
src/service.c | 70 ---------------------------------------------------------
1 files changed, 0 insertions(+), 70 deletions(-)
diff --git a/src/service.c b/src/service.c
index abd8f36..37cb0bc 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2969,72 +2969,6 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
}
#ifdef HAVE_SYSV_COMPAT
-
-#ifdef TARGET_SUSE
-static void sysv_facility_in_insserv_conf(Manager *mgr) {
- FILE *f=NULL;
- int r;
-
- if (!(f = fopen("/etc/insserv.conf", "re"))) {
- 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 '/etc/insserv.conf': %s", 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 ((u = manager_get_unit(mgr, facility)) && (u->meta.type == UNIT_TARGET)) {
- UnitDependency e;
- char *dep = NULL, *name, **j;
-
- STRV_FOREACH (j, parsed+1) {
- if (*j[0]=='+') {
- e = UNIT_WANTS;
- name = *j+1;
- }
- else {
- e = UNIT_REQUIRES;
- name = *j;
- }
- if (sysv_translate_facility(name, NULL, &dep) < 0)
- continue;
-
- r = unit_add_two_dependencies_by_name(u, UNIT_BEFORE, e, dep, NULL, true);
- free(dep);
- }
- }
- free(facility);
- }
- strv_free(parsed);
- }
-finish:
- if (f)
- fclose(f);
-
-}
-#endif
-
static int service_enumerate(Manager *m) {
char **p;
unsigned i;
@@ -3183,10 +3117,6 @@ static int service_enumerate(Manager *m) {
r = 0;
-#ifdef TARGET_SUSE
- sysv_facility_in_insserv_conf (m);
-#endif
-
finish:
free(path);
free(fpath);
--
1.7.3.4

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Fri Sep 9 09:28:54 UTC 2011 - fcrozat@suse.com
- Add revert_insserv_conf_parsing.patch and systemd-insserv_conf:
remove insserv.conf parsing from systemd and use generator
instead.
- put back default.target creation at package install and remove
inittab generator, Yast2 is now able to create it.
-------------------------------------------------------------------
Thu Sep 1 09:25:40 UTC 2011 - fcrozat@novell.com

View File

@ -1,8 +0,0 @@
#!/bin/bash
# Try to read default runlevel from the old inittab if it exists
runlevel=$(/bin/awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' /etc/inittab 2> /dev/null)
if [ -n "$runlevel" -a -e /lib/systemd/system/runlevel$runlevel.target ] ; then
/bin/ln -sf /lib/systemd/system/runlevel$runlevel.target $1/default.target 2>&1 && exit 0
fi
#failsafe
/bin/ln -sf /lib/systemd/system/graphical.target $1/default.target

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.wants/ ;;
esac
done
;;
esac
done < /etc/insserv.conf

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Fri Sep 9 09:28:54 UTC 2011 - fcrozat@suse.com
- Add revert_insserv_conf_parsing.patch and systemd-insserv_conf:
remove insserv.conf parsing from systemd and use generator
instead.
- put back default.target creation at package install and remove
inittab generator, Yast2 is now able to create it.
-------------------------------------------------------------------
Thu Sep 1 09:25:40 UTC 2011 - fcrozat@novell.com

View File

@ -51,12 +51,13 @@ Source1: systemd-rpmlintrc
Source2: localfs.service
Source3: systemd-sysv-convert
Source4: macros.systemd
Source5: systemd-inittab
Source5: systemd-insserv_conf
Patch1: 0001-Add-bootsplash-handling-for-password-dialogs.patch
# handle SUSE specific kbd settings
Patch6: 0001-handle-disable_caplock-and-compose_table-and-kbd_rat.patch
# don't start getty on tty1 until all password request are done
Patch8: tty1.patch
Patch10: revert_insserv_conf_parsing.patch
# Upstream First - Policy:
# Never add any patches to this package without the upstream commit id
@ -100,7 +101,6 @@ Drop-in replacement of System V init tools.
%package plymouth
License: GPLv2+
Group: System/Base
Summary: Plymouth support for systemd
@ -117,6 +117,7 @@ Plymouth integration for systemd
%patch6 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%build
autoreconf -fiv
@ -149,7 +150,6 @@ ln -s ../bin/systemctl %{buildroot}/sbin/telinit
ln -s ../bin/systemctl %{buildroot}/sbin/runlevel
rm -rf %{buildroot}/etc/systemd/system/*.target.wants
rm -f %{buildroot}/etc/systemd/system/default.target
rm -f %{buildroot}/lib/systemd/system/default.target
%if !%{build_plymouth}
rm -f %{buildroot}/lib/systemd/system/plymouth-*.service
rm -f %{buildroot}/lib/systemd/system/*.wants/plymouth-*.service
@ -186,6 +186,13 @@ ln -s systemd-random-seed-load.service %{buildroot}/lib/systemd/system/random.se
/bin/systemd-machine-id-setup >/dev/null 2>&1 || :
/bin/systemctl daemon-reexec >/dev/null 2>&1 || :
# Try to read default runlevel from the old inittab if it exists
if [ ! -e /etc/systemd/system/default.target ]; then
runlevel=$(awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' /etc/inittab 2> /dev/null)
if [ -n "$runlevel" ] ; then
/bin/ln -sf /lib/systemd/system/runlevel$runlevel.target /etc/systemd/system/default.target 2>&1 || :
fi
fi
# Create default config in /etc at first install.
# Later package updates should not overwrite these settings.
if [ "$1" -eq 1 ]; then