Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 695137 Details for
Bug 868005
install_initd/remove_initd does not work in a systemd world
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
chkconfig patch
0001-systemd-deps.patch (text/plain), 7.96 KB, created by
Lukáš Nykrýn
on 2013-02-08 15:53:38 UTC
(
hide
)
Description:
chkconfig patch
Filename:
MIME Type:
Creator:
Lukáš Nykrýn
Created:
2013-02-08 15:53:38 UTC
Size:
7.96 KB
patch
obsolete
>From 2110e8ce06bdff21a19d2e97d1549928b7088173 Mon Sep 17 00:00:00 2001 >From: Lukas Nykryn <lnykryn@redhat.com> >Date: Tue, 5 Feb 2013 15:36:02 +0100 >Subject: [PATCH] systemd deps > >--- > chkconfig.c | 14 ++++++ > leveldb.c | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ > leveldb.h | 1 + > po/chkconfig.pot | 22 ++++----- > 4 files changed, 173 insertions(+), 11 deletions(-) > >diff --git a/chkconfig.c b/chkconfig.c >index 378579a..9517835 100644 >--- a/chkconfig.c >+++ b/chkconfig.c >@@ -193,6 +193,16 @@ static void checkDeps(struct service *s, struct dep *deps, struct service *serv, > } > } > >+static void systemdCheckDeps(struct service *s, struct dep *deps) { >+ int j; >+ for (j = 0; deps[j].name ; j++) >+ if (isOverriddenBySystemd(deps[j].name)) { >+ if ((s->currentLevels & systemdWhichLevel(deps[j].name)) == s->currentLevels) >+ deps[j].handled = 1; >+ return; >+ } >+} >+ > static int frobOneDependencies(struct service *s, struct service *servs, int numservs, int target, int depfail) { > int i; > int s0 = s->sPriority; >@@ -200,6 +210,10 @@ static int frobOneDependencies(struct service *s, struct service *servs, int num > > if (s->sPriority < 0) s->sPriority = 50; > if (s->kPriority > 99) s->kPriority = 50; >+ if (s->startDeps) >+ systemdCheckDeps(s, s->startDeps); >+ if (s->stopDeps) >+ systemdCheckDeps(s, s->stopDeps); > for (i = 0; i < numservs ; i++) { > if (s->startDeps) { > checkDeps(s, s->startDeps, &servs[i], 1); >diff --git a/leveldb.c b/leveldb.c >index 23c3c58..1579d68 100644 >--- a/leveldb.c >+++ b/leveldb.c >@@ -881,3 +881,150 @@ int isEnabledInSystemd(const char *service) { > > return r == 0 ? 1 : 0; > } >+ >+#define RUNLEVEL(x) (1<<(x)) >+int targetToRunlevel(const char *target){ >+//TODO: Obtain target -> runlevel transitions according to actual settings >+ if(!strcmp(target, "runlevel0.target") || !strcmp(target, "poweroff.target")) >+ return(RUNLEVEL(0)); >+ >+ if(!strcmp(target, "runlevel1.target") || !strcmp(target, "rescue.target")) >+ return(RUNLEVEL(1)); >+ >+ if(!strcmp(target, "runlevel2.target") || !strcmp(target, "runlevel3.target") || >+ !strcmp(target, "runlevel4.target") || !strcmp(target, "multi-user.target")) >+ return(RUNLEVEL(2) | RUNLEVEL(3) | RUNLEVEL(4) | RUNLEVEL(5)); >+ >+ if(!strcmp(target, "runlevel5.target") || !strcmp(target, "graphical.target")) >+ return(RUNLEVEL(5)); >+ >+ if(!strcmp(target, "runlevel6.target") || !strcmp(target, "reboot.target")) >+ return(RUNLEVEL(6)); >+ >+ if(!strcmp(target, "basic.target") || !strcmp(target, "sockets.target")) >+ return(RUNLEVEL(1) | RUNLEVEL(2) | RUNLEVEL(3) | RUNLEVEL(4) | RUNLEVEL(5)); >+ >+ return(0); >+} >+ >+int readSystemdUnitProperty(char *name, char *property, char **value) { >+ FILE *sys = NULL; >+ char *cmd = NULL; >+ char *line = NULL; >+ char *t = NULL; >+ int i; >+ int r = 0; >+ int c; >+ >+ if(value == NULL) >+ return -1; >+ >+ r = asprintf(&cmd, "systemctl show %s -p %s", name, property); >+ if(r < 0) >+ goto finish; >+ else >+ r = 0; >+ >+ sys = popen(cmd, "r"); >+ if(!sys) { >+ r=-1; >+ goto finish; >+ } >+ >+ for(i=0; (c=fgetc(sys))!=EOF; i++){ >+ t = realloc(line, i+2); >+ if(t==NULL){ >+ r = -ENOMEM; >+ goto finish; >+ } >+ line = t; >+ line[i] = (char) c; >+ line[i+1] = 0; >+ } >+ >+ if(line == NULL){ >+ r=-ENOENT; >+ goto finish; >+ } >+ t = strchr(line, '\n'); >+ if(t) >+ *t=0; >+ >+ t = strchr(line, '='); >+ if(t==NULL){ >+ r=-1; >+ goto finish; >+ } >+ >+ *value=strdup(t+1); >+ if(value == NULL) >+ r = -ENOMEM; >+ >+finish: >+ >+ >+ if(sys) >+ pclose(sys); >+ if(cmd) >+ free(cmd); >+ if(line) >+ free(line); >+ >+ return r; >+} >+ >+int readSystemdUnitPropertyList(char *name, char *property, char ***values){ >+ int r=0; >+ int i; >+ int num=0; >+ char *value = NULL; >+ char **ret = NULL; >+ char **t; >+ char *c; >+ >+ r = readSystemdUnitProperty(name, property, &value); >+ if(r) >+ goto finish; >+ >+ c = strtok(value, " "); >+ while(c){ >+ num++; >+ t = realloc(ret, ((num+1) * sizeof(char *))); >+ if(t == NULL) { >+ r = -ENOMEM; >+ goto finish; >+ } >+ ret = t; >+ ret[num-1] = strdup(c); >+ ret[num] = 0; >+ if(ret[num-1] == NULL){ >+ r = -ENOMEM; >+ goto finish; >+ } >+ c = strtok(NULL, " "); >+ } >+finish: >+ if(value) >+ free(value); >+ if(r == 0) >+ *values = ret; >+ else >+ if(ret){ >+ for(i = 0; ret[i]; i++) >+ free(ret[i]); >+ free(ret); >+ } >+ >+ return r; >+} >+ >+int systemdWhichLevel(char *service) { >+ char **wantedby = NULL; >+ int r=0, i; >+ int runlevel = 0; >+ r = readSystemdUnitPropertyList(service, "WantedBy", &wantedby); >+ if(r == 0) >+ for(i=0;wantedby[i];i++) >+ runlevel |= targetToRunlevel(wantedby[i]); >+ return runlevel; >+} >\ No newline at end of file >diff --git a/leveldb.h b/leveldb.h >index 1211b4b..b845ef5 100644 >--- a/leveldb.h >+++ b/leveldb.h >@@ -73,4 +73,5 @@ int systemdIsInit(); > int systemdActive(); > int isOverriddenBySystemd(const char *service); > int isEnabledInSystemd(const char *service); >+int systemdWhichLevel(char *service); > #endif >diff --git a/po/chkconfig.pot b/po/chkconfig.pot >index 33287db..0125841 100644 >--- a/po/chkconfig.pot >+++ b/po/chkconfig.pot >@@ -8,7 +8,7 @@ msgid "" > msgstr "" > "Project-Id-Version: PACKAGE VERSION\n" > "Report-Msgid-Bugs-To: \n" >-"POT-Creation-Date: 2013-02-01 14:51+0100\n" >+"POT-Creation-Date: 2013-02-05 15:30+0100\n" > "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" > "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" > "Language-Team: LANGUAGE <LL@li.org>\n" >@@ -91,50 +91,50 @@ msgstr "" > msgid "You do not have enough privileges to perform this operation.\n" > msgstr "" > >-#: ../chkconfig.c:411 ../chkconfig.c:416 ../chkconfig.c:535 >+#: ../chkconfig.c:425 ../chkconfig.c:430 ../chkconfig.c:551 > msgid "on" > msgstr "" > >-#: ../chkconfig.c:411 ../chkconfig.c:416 ../chkconfig.c:535 >+#: ../chkconfig.c:425 ../chkconfig.c:430 ../chkconfig.c:551 > msgid "off" > msgstr "" > >-#: ../chkconfig.c:497 >+#: ../chkconfig.c:513 > #, c-format > msgid "xinetd based services:\n" > msgstr "" > >-#: ../chkconfig.c:499 >+#: ../chkconfig.c:515 > #, c-format > msgid "failed to open directory %s: %s\n" > msgstr "" > >-#: ../chkconfig.c:623 >+#: ../chkconfig.c:639 > #, c-format > msgid "Note: Forwarding request to 'systemctl %s %s'.\n" > msgstr "" > >-#: ../chkconfig.c:628 >+#: ../chkconfig.c:644 > #, c-format > msgid "Failed to forward service request to systemctl: %m\n" > msgstr "" > >-#: ../chkconfig.c:684 >+#: ../chkconfig.c:700 > #, c-format > msgid "%s version %s\n" > msgstr "" > >-#: ../chkconfig.c:696 >+#: ../chkconfig.c:712 > #, c-format > msgid "--type must be 'sysv' or 'xinetd'\n" > msgstr "" > >-#: ../chkconfig.c:703 >+#: ../chkconfig.c:719 > #, c-format > msgid "only one of --list, --add, --del, or --override may be specified\n" > msgstr "" > >-#: ../chkconfig.c:788 >+#: ../chkconfig.c:804 > #, c-format > msgid "only one runlevel may be specified for a chkconfig query\n" > msgstr "" >-- >1.7.11.7 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 868005
: 695137