]> git.pld-linux.org Git - packages/chkconfig.git/blame - chkconfig-add.patch
unbreak systemd-sysv-install symlink; rel 2
[packages/chkconfig.git] / chkconfig-add.patch
CommitLineData
6a99f366
MK
1diff -urNpa chkconfig-1.15.orig/chkconfig.c chkconfig-1.15/chkconfig.c
2--- chkconfig-1.15.orig/chkconfig.c 2021-01-21 09:19:06.000000000 +0100
3+++ chkconfig-1.15/chkconfig.c 2021-05-03 16:44:13.175185842 +0200
4@@ -29,6 +29,7 @@
82df657c 5 #include <unistd.h>
09a63b21 6
82df657c
ER
7 static char *progname;
8+extern int addItem;
82df657c 9
6a99f366 10 #define _(String) gettext((String))
09a63b21 11
6a99f366
MK
12@@ -347,12 +348,10 @@ static int addService(char *name, int ty
13 rc = frobDependencies(&s);
14 } else
15 for (i = 0; i < 7; i++) {
16- if (!isConfigured(name, i, NULL, NULL)) {
17 if ((1 << i) & s.levels)
18 doSetService(s, i, 1);
19 else
20 doSetService(s, i, 0);
21- }
22 }
82df657c 23
6a99f366
MK
24 return rc;
25@@ -690,7 +689,7 @@ void forwardSystemd(const char *name, in
09a63b21 26 }
82df657c 27
6a99f366
MK
28 int main(int argc, const char **argv) {
29- int listItem = 0, addItem = 0, delItem = 0, overrideItem = 0,
30+ int listItem = 0, delItem = 0, overrideItem = 0,
31 noRedirectItem = 0;
12254151 32 int type = TYPE_ANY;
82df657c 33 int rc, i, x;
6a99f366
MK
34diff -urNpa chkconfig-1.15.orig/leveldb.c chkconfig-1.15/leveldb.c
35--- chkconfig-1.15.orig/leveldb.c 2021-01-21 09:19:06.000000000 +0100
36+++ chkconfig-1.15/leveldb.c 2021-05-03 16:40:14.588185842 +0200
37@@ -28,6 +28,7 @@
38 #include <stdlib.h>
39 #include <string.h>
5edaa756 40 #include <sys/mman.h>
82df657c 41+#include <sys/types.h>
5edaa756 42 #include <sys/stat.h>
6a99f366
MK
43 #include <unistd.h>
44
5edaa756
ER
45@@ -41,6 +42,8 @@
46
47 #include "leveldb.h"
82df657c 48
5edaa756
ER
49+int addItem = 0;
50+
51 int selinux_restore(const char *name) {
6a99f366
MK
52 struct selabel_handle *hnd = NULL;
53 struct stat buf;
54@@ -729,6 +732,25 @@ int parseServiceInfo(int fd, char *name,
55 serv.provides[1] = NULL;
09a63b21 56 }
82df657c
ER
57
58+ if (addItem) {
09a63b21
AM
59+ DIR *dir;
60+ struct dirent *dirent;
61+ int i;
62+
63+ strcpy(levelbuf,"/etc/rc.d/rc0.d");
64+ for(i=0;i<7;i++,levelbuf[12]++) {
65+ dir=opendir(levelbuf);
66+ if (!dir) return 1;
67+ while ((dirent=readdir(dir))) {
68+ if (strlen(dirent->d_name)<4) continue;
69+ if (strcmp(dirent->d_name+3,name)) continue;
70+ if (*dirent->d_name=='K') serv.levels &= ~(1<<i);
71+ else if (*dirent->d_name=='S') serv.levels |= 1<<i;
72+ }
73+ closedir(dir);
82df657c 74+ }
82df657c
ER
75+ }
76+
77 *service = serv;
78 return 0;
79 }
This page took 0.159815 seconds and 4 git commands to generate.