Browse code

Fixing service script to start services using systemctl by default

Change-Id: I7e0d385c565b73e40a4d2b066d9297c70125013d
Reviewed-on: http://photon-jenkins.eng.vmware.com/532
Tested-by: jenkins-photon <wangnan2015@hotmail.com>
Reviewed-by: Sharath George

dthaluru authored on 2016/02/14 05:54:51
Showing 2 changed files
... ...
@@ -7,11 +7,14 @@ Release:	1%{?dist}
7 7
 URL:		http://fedorahosted.org/releases/i/n/initscripts/
8 8
 Source0:	https://fedorahosted.org/releases/i/n/initscripts/initscripts-9.65.tar.bz2
9 9
 %define sha1 initscripts=0a231ab94ce7ef050a7c2c35a5183450abe58a39
10
+Patch0:     service.patch
10 11
 Vendor:     	VMware, Inc.
11 12
 Distribution:   Photon
12 13
 Requires:	systemd
13 14
 Requires:	iproute2
14 15
 BuildRequires:	glib-devel 
16
+BuildRequires:	python2
17
+BuildRequires:	python2-libs
15 18
 BuildRequires:	popt-devel 
16 19
 BuildRequires:	gettext 
17 20
 BuildRequires:	pkg-config 
... ...
@@ -42,6 +45,7 @@ Binaries of init network
42 42
 
43 43
 %prep
44 44
 %setup -q
45
+%patch0 -p1
45 46
 
46 47
 %build
47 48
 make
... ...
@@ -156,6 +160,8 @@ rm -rf %{buildroot}%{_prefix}/lib/systemd
156 156
 %{_sysconfdir}/profile.d/debug*
157 157
 
158 158
 %changelog
159
+* Fri Feb 12 2016 Divya Thaluru <dthaluru@vmware.com> 9.65-2
160
+- Fixing service script to start services using systemctl by default
159 161
 *   Tue Jan 26 2016 Xiaolin Li <xiaolinl@vmware.com> 9.65-1
160 162
 -   Updated to version 9.65
161 163
 * Mon Jul 20 2015 Divya Thaluru <dthaluru@vmware.com> 9.63-1
162 164
new file mode 100644
... ...
@@ -0,0 +1,23 @@
0
+--- a/service	2016-02-12 17:59:01.467528900 -0800
1
+@@ -70,7 +70,9 @@
2
+    esac
3
+ done
4
+ 
5
+-if [ -f "${SERVICEDIR}/${SERVICE}" ]; then
6
++if `echo $ACTION | egrep -qw "start|stop|restart|try-restart|reload|force-reload|status|condrestart"` ; then
7
++   exec /bin/systemctl ${ACTION} ${OPTIONS} ${SERVICE}.service
8
++elif [ -f "${SERVICEDIR}/${SERVICE}" ]; then
9
+    # LSB daemons that dies abnormally in systemd looks alive in systemd's eyes due to RemainAfterExit=yes
10
+    # lets reap them before next start
11
+    if [ "${ACTION}" = "start" ] && \
12
+@@ -81,9 +83,6 @@
13
+    env -i PATH="$PATH" TERM="$TERM" SYSTEMCTL_IGNORE_DEPENDENCIES=${SYSTEMCTL_IGNORE_DEPENDENCIES} SYSTEMCTL_SKIP_REDIRECT=${SYSTEMCTL_SKIP_REDIRECT} "${SERVICEDIR}/${SERVICE}" ${ACTION} ${OPTIONS}
14
+ elif [ -x "${ACTIONDIR}/${SERVICE}/${ACTION}" -a -n "${ACTION}" ]; then
15
+    env -i PATH="$PATH" TERM="$TERM" SYSTEMCTL_IGNORE_DEPENDENCIES=${SYSTEMCTL_IGNORE_DEPENDENCIES} SYSTEMCTL_SKIP_REDIRECT=${SYSTEMCTL_SKIP_REDIRECT} "${ACTIONDIR}/${SERVICE}/${ACTION}" ${OPTIONS}
16
+-elif `echo $ACTION | egrep -qw "start|stop|restart|try-restart|reload|force-reload|status|condrestart"` ; then
17
+-   echo $"Redirecting to /bin/systemctl ${ACTION} ${OPTIONS} ${SERVICE}.service" >&2
18
+-   exec /bin/systemctl ${ACTION} ${OPTIONS} ${SERVICE}.service
19
+ else
20
+    echo $"The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl." >&2
21
+    exit 2