Skip to content

Commit d4cc475

Browse files
committed
CA-405864: Drop usage of init.d functions
init.d are from initscripts which are legacy and removed from XS9 This commit drop the usage of the scripts Signed-off-by: Lin Liu <[email protected]>
1 parent 38d1595 commit d4cc475

File tree

8 files changed

+24
-155
lines changed

8 files changed

+24
-155
lines changed

ocaml/squeezed/scripts/init.d-squeezed

-106
This file was deleted.

ocaml/xcp-rrdd/bin/rrdp-scripts/rrdd-plugins-init

+8-14
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
# chkconfig: 2345 23 82
66
# description: XCP RRD daemon plugins
77

8-
# Source function library.
9-
. /etc/init.d/functions
10-
118
# names
129
NAME="xcp-rrdd-plugins"
1310
FULL_NAME="the XCP RRDD daemon plugins"
@@ -37,9 +34,8 @@ start() {
3734

3835
if [ -e ${SUBSYS_FILE} ]; then
3936
if [ -e ${PID_FILE} ] && [ -e /proc/`cat ${PID_FILE}` ]; then
40-
echo -n $"cannot start ${NAME}: already running."
41-
failure $"cannot start ${NAME}: already running."
42-
echo
37+
echo $"cannot start ${NAME}: already running."
38+
logger $"cannot start ${NAME}: already running."
4339
WORST_RETVAL=1
4440
continue
4541
fi
@@ -59,8 +55,8 @@ start() {
5955
if [ $? -eq 0 ]; then
6056
touch ${SUBSYS_FILE}
6157
SUCCESS=1
62-
success
63-
echo
58+
logger $"[ OK ]"
59+
echo -e $"\t[ OK ]"
6460
break
6561
fi
6662
sleep 1
@@ -70,11 +66,10 @@ start() {
7066
if [ ${SUCCESS} -eq 1 ]; then
7167
continue
7268
fi
73-
echo -n $"failed to start ${NAME}."
74-
failure $"failed to start ${NAME}."
69+
echo $"failed to start ${NAME}."
70+
logger $"failed to start ${NAME}."
7571
killproc ${NAME}
7672
rm -f ${SUBSYS_FILE} ${PID_FILE}
77-
echo
7873
done
7974
return $WORST_RETVAL
8075
}
@@ -87,9 +82,8 @@ stop() {
8782
local SUBSYS_FILE=${SUBSYS_PREFIX}${NAME}
8883

8984
if [ ! -e ${SUBSYS_FILE} ]; then
90-
echo -n $"cannot stop ${NAME}: daemon is not running."
91-
failure $"cannot stop ${NAME}: daemon is not running."
92-
echo
85+
echo $"cannot stop ${NAME}: daemon is not running."
86+
logger $"cannot stop ${NAME}: daemon is not running."
9387
continue
9488
fi
9589

scripts/Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ install:
4646
$(IDATA) xapi.conf $(DESTDIR)$(XAPICONF)
4747
$(IPROG) db.conf.skel $(DESTDIR)$(ETCXENDIR)/db.conf
4848
$(IPROG) rio.db.conf.skel $(DESTDIR)$(ETCXENDIR)/db.conf.rio
49-
$(IPROG) init.d-xapi $(DESTDIR)$(LIBEXECDIR)/xapi-init
50-
$(IPROG) init.d-save-boot-info $(DESTDIR)$(LIBEXECDIR)/save-boot-info
51-
$(IPROG) init.d-attach-static-vdis $(DESTDIR)$(LIBEXECDIR)/attach-static-vdis
49+
$(IPROG) xapi-init $(DESTDIR)$(LIBEXECDIR)/xapi-init
50+
$(IPROG) save-boot-info $(DESTDIR)$(LIBEXECDIR)/save-boot-info
51+
$(IPROG) attach-static-vdis $(DESTDIR)$(LIBEXECDIR)/attach-static-vdis
5252
$(IPROG) generate-iscsi-iqn $(DESTDIR)$(LIBEXECDIR)/generate-iscsi-iqn
5353
$(IPROG) network-init $(DESTDIR)$(LIBEXECDIR)/network-init
5454
$(IPROG) control-domain-params-init $(DESTDIR)$(LIBEXECDIR)/control-domain-params-init

scripts/init.d-attach-static-vdis renamed to scripts/attach-static-vdis

-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ STATE_DIR=/etc/xensource/static-vdis
77
[ -d ${STATE_DIR} ] || exit 0
88
[ -e /opt/xensource/bin/static-vdis ] || exit 0
99

10-
# Source function library.
11-
. /etc/init.d/functions
12-
1310
clear_stale_state(){
1411
for i in $(ls -1 ${STATE_DIR}); do
1512
# Clear the now-stale symlink to the attached disk. From this point the disk will

scripts/on-master-start

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
#!/bin/sh
22

33
# Example on-master-start script
4-
5-
# Source function library.
6-
. /etc/init.d/functions
7-
4+
#
85
start() {
96
echo -n $"Assuming role of master: "
107
touch /tmp/master
11-
echo -n $"OK"
12-
success $"OK"
13-
echo
8+
echo $"OK"
149
return 0
1510
}
1611

1712
stop() {
18-
echo -n $"Dropping role of master: "
13+
echo $"Dropping role of master: "
1914
rm -f /tmp/master
20-
echo
2115
return 0
2216
}
2317

File renamed without changes.

scripts/init.d-xapi renamed to scripts/xapi-init

+10-19
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#! /bin/bash
22

3-
# Source function library.
4-
. /etc/init.d/functions
5-
63
if [ -f /etc/sysconfig/xapi ]; then
74
. /etc/sysconfig/xapi
85
fi
@@ -23,9 +20,8 @@ start() {
2320

2421
if [ -e /var/lock/subsys/xapi ]; then
2522
if [ -e /var/run/xapi.pid ] && [ -e /proc/`cat /var/run/xapi.pid` ]; then
26-
echo -n $"cannot start xapi: already running.";
27-
failure $"cannot start xapi: already running.";
28-
echo
23+
echo $"cannot start xapi: already running.";
24+
logger "cannot start xapi: already running.";
2925
return 1
3026
fi
3127
fi
@@ -39,9 +35,8 @@ start() {
3935
if [ -e ${XAPI_BLOCK_STARTUP_COOKIE} ]; then
4036
if [ -e ${XAPI_BOOT_TIME_INFO_UPDATED} ]; then
4137
logger "Aborting xapi startup because ${XAPI_BLOCK_STARTUP_COOKIE} is present and the system has just booted. Remove file and try again";
42-
echo -n $"startup blocked."
43-
failure $"startup blocked."
44-
echo
38+
echo $"startup blocked."
39+
logger $"startup blocked."
4540
return 1
4641
fi
4742
fi
@@ -69,9 +64,8 @@ start() {
6964
stop() {
7065
echo -n $"Stopping xapi: "
7166
if [ ! -e /var/lock/subsys/xapi ]; then
72-
echo -n $"cannot stop xapi: xapi is not running."
73-
failure $"cannot stop xapi: xapi is not running."
74-
echo
67+
echo $"cannot stop xapi: xapi is not running."
68+
logger $"cannot stop xapi: xapi is not running."
7569
return 1;
7670
fi
7771
rm -f ${XAPI_STARTUP_COOKIE}
@@ -88,10 +82,9 @@ stop() {
8882
# Finish if all xapis have gone
8983
xapi_pids=$(pidof xapi)
9084
if [ -z "$xapi_pids" ]; then
91-
logger "xapi stopped successfully"
85+
echo $"xapi stopped successfully"
9286
rm -f /var/run/xapi.pid /var/lock/subsys/xapi
93-
success $"xapi stopped successfully"
94-
echo
87+
logger $"xapi stopped successfully"
9588
return 0
9689
fi
9790
sleep 1
@@ -103,13 +96,11 @@ stop() {
10396
RETVAL=$?
10497
if [ $RETVAL -eq 0 ]; then
10598
logger "xapi stopped forcibly"
106-
success $"xapi stopped successfully"
107-
echo
99+
echo $"xapi stopped successfully"
108100
rm -f /var/run/xapi.pid /var/lock/subsys/xapi
109101
else
110102
logger "failed to stop xapi"
111-
failure $"failed to stop xapi"
112-
echo
103+
echo $"failed to stop xapi"
113104
fi
114105

115106
return $RETVAL

scripts/xe-toolstack-restart

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1212
# GNU Lesser General Public License for more details.
1313
#
14-
test -f /etc/init.d/functions && source /etc/init.d/functions
1514

1615
FILENAME=`basename $0`
1716
LOCKFILE='/dev/shm/xe_toolstack_restart.lock'

0 commit comments

Comments
 (0)