SHA256
1
0
forked from pool/systemd

- Add insserv-parsing.patch: read/parse insserv.conf.

- Add bash-completion-restart.patch: fix restart service list
  (bnc#704782).

OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=168
This commit is contained in:
Frederic Crozat 2011-08-02 08:31:42 +00:00 committed by Git OBS Bridge
parent db56d41e34
commit 45038fdaa6
4 changed files with 156 additions and 0 deletions

View File

@ -0,0 +1,43 @@
From 54a437057e83ca41f329f010e2a0e968ed3880b2 Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Mon, 1 Aug 2011 18:43:01 +0200
Subject: [PATCH] bash: Allow to restart already started service.
Allow to restart all services, not only inactive one.
https://bugzilla.novell.com/show_bug.cgi?id=704782
---
src/systemctl-bash-completion.sh | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/systemctl-bash-completion.sh b/src/systemctl-bash-completion.sh
index acdc086..6369a6c 100644
--- a/src/systemctl-bash-completion.sh
+++ b/src/systemctl-bash-completion.sh
@@ -79,10 +79,11 @@ _systemctl () {
local -A VERBS=(
[ALL_UNITS]='enable disable is-active is-enabled status show'
[FAILED_UNITS]='reset-failed'
- [STARTABLE_UNITS]='start restart reload-or-restart'
+ [STARTABLE_UNITS]='start'
[STOPPABLE_UNITS]='stop kill try-restart condrestart'
[ISOLATABLE_UNITS]='isolate'
[RELOADABLE_UNITS]='reload reload-or-try-restart force-reload'
+ [RESTARTABLE_UNITS]='restart reload-or-restart'
[JOBS]='cancel'
[SNAPSHOTS]='delete'
[ENVS]='set-environment unset-environment'
@@ -110,6 +111,10 @@ _systemctl () {
comps=$( __filter_units_by_property CanStart yes \
$( __get_inactive_units | grep -Ev '\.(device|snapshot)$' ))
+ elif __contains_word "$verb" ${VERBS[RESTARTABLE_UNITS]}; then
+ comps=$( __filter_units_by_property CanStart yes \
+ $( __get_all_units | grep -Ev '\.(device|snapshot|socket|timer)$' ))
+
elif __contains_word "$verb" ${VERBS[STOPPABLE_UNITS]}; then
comps=$( __filter_units_by_property CanStop yes \
$( __get_active_units ) )
--
1.7.3.4

100
insserv-parsing.patch Normal file
View File

@ -0,0 +1,100 @@
From de3910a324aefcb15c26be27033d6917494e5946 Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Wed, 29 Jun 2011 13:59:34 +0200
Subject: [PATCH] service: parse insserv.conf and plugs its system facilities into systemd.
---
src/service.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 70 insertions(+), 0 deletions(-)
diff --git a/src/service.c b/src/service.c
index 4e3b6e7..0464d1e 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2968,6 +2968,72 @@ 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;
@@ -3116,6 +3182,10 @@ 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,10 @@
-------------------------------------------------------------------
Tue Aug 2 08:29:30 UTC 2011 - fcrozat@suse.com
- Add insserv-parsing.patch: read/parse insserv.conf.
- Add bash-completion-restart.patch: fix restart service list
(bnc#704782).
-------------------------------------------------------------------
Mon Aug 1 09:04:53 UTC 2011 - aj@suse.de

View File

@ -52,6 +52,10 @@ Patch1: 0001-Add-bootsplash-handling-for-password-dialogs.patch
# 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.
# PATCH-FIX-UPSTREAM fcrozat@suse.com -- read/parse insserv.conf (git)
Patch2: insserv-parsing.patch
# PATCH-FIX-UPSTREAM fcrozat@suse.com bnc704782 -- fix bash completion for restart command (git)
Patch3: bash-completion-restart.patch
%description
Systemd is a system and service manager, compatible with SysV and LSB
@ -110,6 +114,8 @@ Plymouth integration for systemd
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
autoreconf -fiv