]> git.pld-linux.org Git - packages/chkconfig.git/blame_incremental - chkconfig-add.patch
up to 1.6 (fixes systemd<->sysv "ping-pong" issue)
[packages/chkconfig.git] / chkconfig-add.patch
... / ...
CommitLineData
1--- chkconfig-1.3.58/chkconfig.c~ 2012-12-04 15:41:14.000000000 +0200
2+++ chkconfig-1.3.58/chkconfig.c 2012-12-04 15:42:06.080488828 +0200
3@@ -27,6 +27,7 @@
4 #include <unistd.h>
5
6 static char *progname;
7+extern int addItem;
8
9 #define _(String) gettext((String))
10
11@@ -243,12 +244,10 @@
12 frobDependencies(&s);
13 else
14 for (i = 0; i < 7; i++) {
15- if (!isConfigured(name, i, NULL, NULL)) {
16 if ((1 << i) & s.levels)
17 doSetService(s, i, 1);
18 else
19 doSetService(s, i, 0);
20- }
21 }
22
23 return 0;
24@@ -626,7 +626,7 @@
25 }
26
27 int main(int argc, const char ** argv) {
28- int listItem = 0, addItem = 0, delItem = 0, overrideItem = 0, noRedirectItem = 0;
29+ int listItem = 0, delItem = 0, overrideItem = 0, noRedirectItem = 0;
30 int type = TYPE_ANY;
31 int rc, i, x;
32 char * levels = NULL;
33--- chkconfig-1.4/leveldb.c~ 2015-04-25 12:18:41.000000000 +0300
34+++ chkconfig-1.4/leveldb.c 2015-04-25 12:19:52.959858162 +0300
35@@ -22,6 +22,7 @@
36 #include <libintl.h>
37 #include <locale.h>
38 #include <sys/mman.h>
39+#include <sys/types.h>
40 #include <sys/stat.h>
41 #include <stdlib.h>
42 #include <stdio.h>
43@@ -41,6 +42,8 @@
44
45 #include "leveldb.h"
46
47+int addItem = 0;
48+
49 int selinux_restore(const char *name) {
50 struct selabel_handle *hnd = NULL;
51 struct stat buf;
52@@ -563,6 +567,25 @@
53 serv.provides[1] = NULL;
54 }
55
56+ if (addItem) {
57+ DIR *dir;
58+ struct dirent *dirent;
59+ int i;
60+
61+ strcpy(levelbuf,"/etc/rc.d/rc0.d");
62+ for(i=0;i<7;i++,levelbuf[12]++) {
63+ dir=opendir(levelbuf);
64+ if (!dir) return 1;
65+ while ((dirent=readdir(dir))) {
66+ if (strlen(dirent->d_name)<4) continue;
67+ if (strcmp(dirent->d_name+3,name)) continue;
68+ if (*dirent->d_name=='K') serv.levels &= ~(1<<i);
69+ else if (*dirent->d_name=='S') serv.levels |= 1<<i;
70+ }
71+ closedir(dir);
72+ }
73+ }
74+
75 *service = serv;
76 return 0;
77 }
This page took 0.021698 seconds and 4 git commands to generate.