Browse code

Chkconfig patch to return runlevel 3 for Photon

Change-Id: Ibda692b7ee06e049a2bb40cfe26dcfdbd86fcddd
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/1376
Reviewed-by: suezzelur <anishs@vmware.com>
Tested-by: suezzelur <anishs@vmware.com>
(cherry picked from commit f8f6d8078e5d3fe3efc75b6ad0fa238e93e4a986)
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/1377

suezzelur authored on 2016/09/13 14:43:16
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,29 @@
0
+diff -aur chkconfig-1.5/leveldb.c chkconfig-1.5-new/leveldb.c
1
+--- chkconfig-1.5/leveldb.c	2015-06-01 05:07:44.000000000 -0700
2
+@@ -674,23 +674,8 @@
3
+ 
4
+ /* returns -1 on error */
5
+ int currentRunlevel(void) {
6
+-    FILE * p;
7
+-    char response[50];
8
+-
9
+-    p = popen("/sbin/runlevel", "r");
10
+-    if (!p) return -1;
11
+-
12
+-    if (!fgets(response, sizeof(response), p)) {
13
+-	pclose(p);
14
+-	return -1;
15
+-    }
16
+-
17
+-    pclose(p);
18
+-
19
+-    if (response[1] != ' ' || !isdigit(response[2]) || response[3] != '\n')
20
+-	return -1;
21
+-
22
+-    return response[2] - '0';
23
++    // Photon OS only supports running chkconfig from runlevel 3
24
++    return 3;
25
+ }
26
+ 
27
+ int findServiceEntries(char * name, int level, glob_t * globresptr) {
... ...
@@ -1,7 +1,7 @@
1 1
 Summary: A system tool for maintaining the /etc/rc*.d hierarchy
2 2
 Name: chkconfig
3 3
 Version: 1.5
4
-Release: 5%{?dist}
4
+Release: 6%{?dist}
5 5
 License: GPLv2
6 6
 Group: System Environment/Base
7 7
 URL: https://git.fedorahosted.org/git/chkconfig.git
... ...
@@ -9,6 +9,7 @@ Source: http://fedorahosted.org/releases/c/h/chkconfig/%{name}-%{version}.tar.bz
9 9
 Patch0:chkconfig-shortopt.patch
10 10
 Patch1:print-service-on-off.patch
11 11
 Patch2:ignore-priorities.patch
12
+Patch3:chkconfig-runlevel.patch
12 13
 %define sha1 chkconfig=19a15a6690788686cc173b0d0626eaae01bec0c1
13 14
 Requires: libselinux
14 15
 Requires: libsepol
... ...
@@ -44,6 +45,7 @@ page), ntsysv configures the current runlevel (5 if you're using X).
44 44
 %patch0 -p1
45 45
 %patch1 -p1
46 46
 %patch2 -p1
47
+%patch3 -p1
47 48
 %build
48 49
 
49 50
 make RPM_OPT_FLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" %{?_smp_mflags}
... ...
@@ -91,8 +93,10 @@ rm -rf %{buildroot}
91 91
 %{_mandir}/*/ntsysv.8*
92 92
 
93 93
 %changelog
94
-*	Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.5-5
95
--	GA - Bump release of all rpms
94
+* Tue Sep 13 2016 Anish Swaminathan <anishs@vmware.com> 1.5-6
95
+- Chkconfig patch to return runlevel 3 on Photon OS
96
+* Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.5-5
97
+- GA - Bump release of all rpms
96 98
 * Mon Dec 07 2015 Mahmoud Bassiouny <mbassiouny@vmware.com>
97 99
 - Ability for chkconfig to ignore priorities.
98 100