Skip to content

CA-405864: Drop usage of init.d functions #6339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 0 additions & 106 deletions ocaml/squeezed/scripts/init.d-squeezed

This file was deleted.

126 changes: 0 additions & 126 deletions ocaml/xcp-rrdd/bin/rrdp-scripts/rrdd-plugins-init

This file was deleted.

6 changes: 3 additions & 3 deletions scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ install:
$(IDATA) xapi.conf $(DESTDIR)$(XAPICONF)
$(IPROG) db.conf.skel $(DESTDIR)$(ETCXENDIR)/db.conf
$(IPROG) rio.db.conf.skel $(DESTDIR)$(ETCXENDIR)/db.conf.rio
$(IPROG) init.d-xapi $(DESTDIR)$(LIBEXECDIR)/xapi-init
$(IPROG) init.d-save-boot-info $(DESTDIR)$(LIBEXECDIR)/save-boot-info
$(IPROG) init.d-attach-static-vdis $(DESTDIR)$(LIBEXECDIR)/attach-static-vdis
$(IPROG) xapi-init $(DESTDIR)$(LIBEXECDIR)/xapi-init
$(IPROG) save-boot-info $(DESTDIR)$(LIBEXECDIR)/save-boot-info
$(IPROG) attach-static-vdis $(DESTDIR)$(LIBEXECDIR)/attach-static-vdis
$(IPROG) generate-iscsi-iqn $(DESTDIR)$(LIBEXECDIR)/generate-iscsi-iqn
$(IPROG) network-init $(DESTDIR)$(LIBEXECDIR)/network-init
$(IPROG) control-domain-params-init $(DESTDIR)$(LIBEXECDIR)/control-domain-params-init
Expand Down
30 changes: 11 additions & 19 deletions scripts/init.d-attach-static-vdis → scripts/attach-static-vdis
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,28 @@ STATE_DIR=/etc/xensource/static-vdis
[ -d ${STATE_DIR} ] || exit 0
[ -e /opt/xensource/bin/static-vdis ] || exit 0

# Source function library.
. /etc/init.d/functions

clear_stale_state(){
for i in $(ls -1 ${STATE_DIR}); do
for i in "${STATE_DIR}"/*; do
# Clear the now-stale symlink to the attached disk. From this point the disk will
# be considered 'currently-attached=false'
rm -f ${STATE_DIR}/${i}/disk
rm -f "${i}"/disk

# If the disk was supposed to be deleted altogether on reboot then do it now
UUID=$(cat ${STATE_DIR}/${i}/vdi-uuid)
if [ -e ${STATE_DIR}/${i}/delete-next-boot ]; then
UUID=$(cat "${i}"/vdi-uuid)
if [ -e "${i}"/delete-next-boot ]; then
logger "Deleting stale static-configured state for VDI: ${UUID}"
rm -rf ${STATE_DIR}/${i}
rm -rf "${i}"
fi;
done
}

attach_all(){
RC=0
ALL=$(ls -1 ${STATE_DIR})

for i in ${ALL}; do
UUID=$(cat ${STATE_DIR}/${i}/vdi-uuid)
for i in "${STATE_DIR}"/*; do
UUID=$(cat "${i}"/vdi-uuid)
logger "Attempting to attach VDI: ${UUID}"
OUTPUT=$(/opt/xensource/bin/static-vdis attach ${UUID} 2>&1)
if [ $? -ne 0 ]; then
if ! OUTPUT=$(/opt/xensource/bin/static-vdis attach "${UUID}" 2>&1); then
RC=1
logger "Attempt to attach VDI: ${UUID} failed -- skipping (Error was: ${OUTPUT})"
return $RC
Expand All @@ -43,13 +38,10 @@ attach_all(){
}

detach_all(){
ALL=$(ls -1 ${STATE_DIR})

for i in ${ALL}; do
UUID=$(cat ${STATE_DIR}/${i}/vdi-uuid)
for i in "${STATE_DIR}"/*; do
UUID=$(cat "${i}"/vdi-uuid)
logger "Attempting to detach VDI: ${UUID}"
OUTPUT=$(/opt/xensource/bin/static-vdis detach ${UUID} 2>&1)
if [ $? -ne 0 ]; then
if ! OUTPUT=$(/opt/xensource/bin/static-vdis detach "${UUID}" 2>&1); then
logger "Attempt to detach VDI: ${UUID} failed -- skipping (Error was: ${OUTPUT})"
fi
done
Expand Down
16 changes: 5 additions & 11 deletions scripts/on-master-start
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
#!/bin/sh

# Example on-master-start script

# Source function library.
. /etc/init.d/functions

#
start() {
echo -n $"Assuming role of master: "
printf "%s" "Assuming role of master: "
touch /tmp/master
echo -n $"OK"
success $"OK"
echo
echo "OK"
return 0
}

stop() {
echo -n $"Dropping role of master: "
echo "Dropping role of master: "
rm -f /tmp/master
echo
return 0
}

Expand All @@ -37,6 +31,6 @@ case "$1" in
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
File renamed without changes.
Loading
Loading