[libvirt] [PATCH v2 4/6] Drop support for "Red Hat" init scripts

Andrea Bolognani abologna at redhat.com
Fri Mar 15 17:27:41 UTC 2019


Despite the misleading name, these were supposed to be used
with a System V style init; however, none of the platforms we
target is using that kind of init anymore: almost all Linux
distributions have switched to systemd, those that haven't
(such as Gentoo and Alpine) are mostly using OpenRC with
custom init scripts, and the BSDs have been doing their own
thing all along.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 .gitignore                    |   1 -
 m4/virt-init-script.m4        |  16 +----
 src/Makefile.am               |  32 ---------
 src/locking/Makefile.inc.am   |   9 ---
 src/locking/virtlockd.init.in |  98 ---------------------------
 src/logging/Makefile.inc.am   |  11 ---
 src/logging/virtlogd.init.in  |  98 ---------------------------
 src/remote/Makefile.inc.am    |   2 -
 src/remote/libvirtd.init.in   | 122 ----------------------------------
 tools/Makefile.am             |  33 +--------
 tools/libvirt-guests.init.in  |  30 ---------
 11 files changed, 5 insertions(+), 447 deletions(-)
 delete mode 100644 src/locking/virtlockd.init.in
 delete mode 100644 src/logging/virtlogd.init.in
 delete mode 100644 src/remote/libvirtd.init.in
 delete mode 100644 tools/libvirt-guests.init.in

diff --git a/.gitignore b/.gitignore
index 3303eed411..3223cf1b76 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,7 +11,6 @@
 *.gcov
 *.html
 *.i
-*.init
 *.la
 *.lo
 *.loT
diff --git a/m4/virt-init-script.m4 b/m4/virt-init-script.m4
index 7094e29f46..8045fc06bb 100644
--- a/m4/virt-init-script.m4
+++ b/m4/virt-init-script.m4
@@ -19,14 +19,13 @@ dnl
 
 AC_DEFUN([LIBVIRT_ARG_INIT_SCRIPT],[
     LIBVIRT_ARG_WITH([INIT_SCRIPT],
-                     [Style of init script to install: redhat, systemd,
-                      systemd+redhat, check, none], [check])
+                     [Style of init script to install: systemd, check, none],
+                     [check])
 ])
 
 AC_DEFUN([LIBVIRT_CHECK_INIT_SCRIPT],[
     AC_MSG_CHECKING([for init script type])
 
-    init_redhat=no
     init_systemd=no
 
     if test "$with_init_script" = check && test "$cross_compiling" = yes; then
@@ -35,31 +34,20 @@ AC_DEFUN([LIBVIRT_CHECK_INIT_SCRIPT],[
     if test "$with_init_script" = check && type systemctl >/dev/null 2>&1; then
         with_init_script=systemd
     fi
-    if test "$with_init_script" = check && test -f /etc/redhat-release; then
-        with_init_script=redhat
-    fi
     if test "$with_init_script" = check; then
         with_init_script=none
     fi
 
     AS_CASE([$with_init_script],
-        [systemd+redhat],[
-            init_redhat=yes
-            init_systemd=yes
-        ],
         [systemd],[
             init_systemd=yes
         ],
-        [redhat],[
-            init_redhat=yes
-        ],
         [none],[],
         [*],[
             AC_MSG_ERROR([Unknown initscript flavour $with_init_script])
         ]
     )
 
-    AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_RED_HAT], test "$init_redhat" = "yes")
     AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_SYSTEMD], test "$init_systemd" = "yes")
 
     AC_MSG_RESULT($with_init_script)
diff --git a/src/Makefile.am b/src/Makefile.am
index 94a9a7c27d..a73f43c483 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -84,7 +84,6 @@ LOGROTATE_FILES_IN =
 PODFILES =
 MANINFILES =
 SYSTEMD_UNIT_FILES_IN =
-SYSVINIT_FILES_IN =
 SYSCONF_FILES =
 sbin_PROGRAMS =
 man8_MANS =
@@ -765,14 +764,6 @@ uninstall-sysconfig:
 	done
 	rmdir $(DESTDIR)$(sysconfdir)/sysconfig || :
 
-SYSVINIT_FILES_IN += \
-	locking/virtlockd.init.in \
-	$(NULL)
-
-SYSVINIT_FILES = $(notdir $(SYSVINIT_FILES_IN:%.in=%))
-
-EXTRA_DIST += $(SYSVINIT_FILES_IN)
-
 LOGROTATE_FILES := $(LOGROTATE_FILES_IN:remote/%.in=%)
 
 EXTRA_DIST += $(LOGROTATE_FILES_IN)
@@ -804,29 +795,6 @@ INSTALL_DATA_LOCAL += install-logrotate
 UNINSTALL_LOCAL += uninstall-logrotate
 endif WITH_LIBVIRTD
 
-if WITH_LIBVIRTD
-if LIBVIRT_INIT_SCRIPT_RED_HAT
-initdir = $(sysconfdir)/rc.d/init.d
-
-install-init: $(SYSVINIT_FILES) install-sysconfig
-	$(MKDIR_P) $(DESTDIR)$(initdir)
-	for f in $(SYSVINIT_FILES:%.init=%) ; \
-	do \
-	  $(INSTALL_SCRIPT) $$f.init $(DESTDIR)$(initdir)/$$f; \
-	done
-
-uninstall-init: uninstall-sysconfig
-	rm -f $(SYSVINIT_FILES:%.init=$(DESTDIR)$(initdir)/%)
-	rmdir $(DESTDIR)$(initdir) || :
-
-BUILT_SOURCES += $(SYSVINIT_FILES)
-DISTCLEANFILES += $(SYSVINIT_FILES)
-
-INSTALL_DATA_LOCAL += install-init
-UNINSTALL_LOCAL += uninstall-init
-endif LIBVIRT_INIT_SCRIPT_RED_HAT
-endif WITH_LIBVIRTD
-
 
 %.8: %.8.in $(top_srcdir)/configure.ac
 	$(AM_V_GEN)sed \
diff --git a/src/locking/Makefile.inc.am b/src/locking/Makefile.inc.am
index f2eb2efb7b..6de7f7bab8 100644
--- a/src/locking/Makefile.inc.am
+++ b/src/locking/Makefile.inc.am
@@ -305,15 +305,6 @@ virtlockd-admin.socket: locking/virtlockd-admin.socket.in \
 	    < $< > $@-t && \
 	    mv $@-t $@
 
-virtlockd.init: locking/virtlockd.init.in $(top_builddir)/config.status
-	$(AM_V_GEN)sed \
-	    -e 's|[@]localstatedir[@]|$(localstatedir)|g' \
-	    -e 's|[@]sbindir[@]|$(sbindir)|g' \
-	    -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
-	    < $< > $@-t && \
-	    chmod a+x $@-t && \
-	    mv $@-t $@
-
 virtlockd.8.in: locking/virtlockd.pod
 	$(AM_V_GEN)$(POD2MAN) --section=8 $< $@-t1 && \
 	if grep 'POD ERROR' $@-t1; then rm $@-t1; exit 1; fi && \
diff --git a/src/locking/virtlockd.init.in b/src/locking/virtlockd.init.in
deleted file mode 100644
index 0bf868ca7f..0000000000
--- a/src/locking/virtlockd.init.in
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/bin/sh
-
-# the following is the LSB init header see
-# http://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html
-#
-### BEGIN INIT INFO
-# Provides: virtlockd
-# Default-Start: 3 4 5
-# Default-Stop: 0 1 2 6
-# Required-Start:
-# Required-Stop:
-# Should-Start: $network $remote_fs
-# Should-Stop: $network $remote_fs
-# Short-Description: virtual machine lock manager
-# Description: This is a daemon for managing locks
-#              on virtual machine disk images
-### END INIT INFO
-
-# the following is chkconfig init header
-#
-# virtlockd:   virtual machine lock manager
-#
-# chkconfig: 345 96 04
-# description:  This is a daemon for managing locks \
-#               on virtual machine disk images
-#
-# processname: virtlockd
-# pidfile: @localstatedir@/run/virtlockd.pid
-#
-
-# Source function library.
-. @sysconfdir@/rc.d/init.d/functions
-
-SERVICE=virtlockd
-PROCESS=virtlockd
-PIDFILE=@localstatedir@/run/$SERVICE.pid
-
-VIRTLOCKD_ARGS=
-
-test -f @sysconfdir@/sysconfig/virtlockd && . @sysconfdir@/sysconfig/virtlockd
-
-RETVAL=0
-
-start() {
-    echo -n $"Starting $SERVICE daemon: "
-    daemon --pidfile $PIDFILE --check $SERVICE $PROCESS --daemon $VIRTLOCKD_ARGS
-    RETVAL=$?
-    echo
-    [ $RETVAL -eq 0 ] && touch @localstatedir@/lock/subsys/$SERVICE
-}
-
-stop() {
-    echo -n $"Stopping $SERVICE daemon: "
-
-    killproc -p $PIDFILE $PROCESS
-    RETVAL=$?
-    echo
-    if [ $RETVAL -eq 0 ]; then
-        rm -f @localstatedir@/lock/subsys/$SERVICE
-        rm -f $PIDFILE
-    fi
-}
-
-restart() {
-    stop
-    start
-}
-
-reload() {
-    echo -n $"Reloading $SERVICE configuration: "
-
-    killproc -p $PIDFILE $PROCESS -USR1
-    RETVAL=$?
-    echo
-    return $RETVAL
-}
-
-# See how we were called.
-case "$1" in
-    start|stop|restart|reload)
-        $1
-        ;;
-    status)
-        status -p $PIDFILE $PROCESS
-        RETVAL=$?
-        ;;
-    force-reload)
-        reload
-        ;;
-    condrestart|try-restart)
-        [ -f @localstatedir@/lock/subsys/$SERVICE ] && restart || :
-        ;;
-    *)
-        echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload|try-restart}"
-        exit 2
-        ;;
-esac
-exit $RETVAL
diff --git a/src/logging/Makefile.inc.am b/src/logging/Makefile.inc.am
index ae022ade0b..a4739b2d44 100644
--- a/src/logging/Makefile.inc.am
+++ b/src/logging/Makefile.inc.am
@@ -26,8 +26,6 @@ LOG_DAEMON_SOURCES = \
 
 LOG_PROTOCOL = $(srcdir)/logging/log_protocol.x
 
-SYSVINIT_FILES_IN += logging/virtlogd.init.in
-
 EXTRA_DIST += \
 	$(LOG_PROTOCOL) \
 	$(LOG_PROTOCOL_GENERATED) \
@@ -116,15 +114,6 @@ logging/log_daemon_dispatch_stubs.h: $(LOG_PROTOCOL) \
 	    virLogManagerProtocol VIR_LOG_MANAGER_PROTOCOL \
 	    $(LOG_PROTOCOL) > $(srcdir)/logging/log_daemon_dispatch_stubs.h
 
-virtlogd.init: logging/virtlogd.init.in $(top_builddir)/config.status
-	$(AM_V_GEN)sed \
-	    -e 's|[@]localstatedir[@]|$(localstatedir)|g' \
-	    -e 's|[@]sbindir[@]|$(sbindir)|g' \
-	    -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
-	    < $< > $@-t && \
-	    chmod a+x $@-t && \
-	    mv $@-t $@
-
 virtlogd.8.in: logging/virtlogd.pod
 	$(AM_V_GEN)$(POD2MAN) --section=8 $< $@-t1 && \
 	if grep 'POD ERROR' $@-t1; then rm $@-t1; exit 1; fi && \
diff --git a/src/logging/virtlogd.init.in b/src/logging/virtlogd.init.in
deleted file mode 100644
index 6aa8815046..0000000000
--- a/src/logging/virtlogd.init.in
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/bin/sh
-
-# the following is the LSB init header see
-# http://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html
-#
-### BEGIN INIT INFO
-# Provides: virtlogd
-# Default-Start: 3 4 5
-# Default-Stop: 0 1 2 6
-# Required-Start:
-# Required-Stop:
-# Should-Start: $network $remote_fs
-# Should-Stop: $network $remote_fs
-# Short-Description: virtual machine log manager
-# Description: This is a daemon for managing logs
-#              of virtual machine consoles
-### END INIT INFO
-
-# the following is chkconfig init header
-#
-# virtlogd:   virtual machine log manager
-#
-# chkconfig: 345 96 04
-# description:  This is a daemon for managing logs \
-#               of virtual machine consoles
-#
-# processname: virtlogd
-# pidfile: @localstatedir@/run/virtlogd.pid
-#
-
-# Source function library.
-. @sysconfdir@/rc.d/init.d/functions
-
-SERVICE=virtlogd
-PROCESS=virtlogd
-PIDFILE=@localstatedir@/run/$SERVICE.pid
-
-VIRTLOGD_ARGS=
-
-test -f @sysconfdir@/sysconfig/virtlogd && . @sysconfdir@/sysconfig/virtlogd
-
-RETVAL=0
-
-start() {
-    echo -n $"Starting $SERVICE daemon: "
-    daemon --pidfile $PIDFILE --check $SERVICE $PROCESS --daemon $VIRTLOGD_ARGS
-    RETVAL=$?
-    echo
-    [ $RETVAL -eq 0 ] && touch @localstatedir@/lock/subsys/$SERVICE
-}
-
-stop() {
-    echo -n $"Stopping $SERVICE daemon: "
-
-    killproc -p $PIDFILE $PROCESS
-    RETVAL=$?
-    echo
-    if [ $RETVAL -eq 0 ]; then
-        rm -f @localstatedir@/lock/subsys/$SERVICE
-        rm -f $PIDFILE
-    fi
-}
-
-restart() {
-    stop
-    start
-}
-
-reload() {
-    echo -n $"Reloading $SERVICE configuration: "
-
-    killproc -p $PIDFILE $PROCESS -USR1
-    RETVAL=$?
-    echo
-    return $RETVAL
-}
-
-# See how we were called.
-case "$1" in
-    start|stop|restart|reload)
-        $1
-        ;;
-    status)
-        status -p $PIDFILE $PROCESS
-        RETVAL=$?
-        ;;
-    force-reload)
-        reload
-        ;;
-    condrestart|try-restart)
-        [ -f @localstatedir@/lock/subsys/$SERVICE ] && restart || :
-        ;;
-    *)
-        echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload|try-restart}"
-        exit 2
-        ;;
-esac
-exit $RETVAL
diff --git a/src/remote/Makefile.inc.am b/src/remote/Makefile.inc.am
index bc1d7f462f..dccecf8cd3 100644
--- a/src/remote/Makefile.inc.am
+++ b/src/remote/Makefile.inc.am
@@ -42,8 +42,6 @@ LOGROTATE_FILES_IN += \
 	remote/libvirtd.logrotate.in \
 	$(NULL)
 
-SYSVINIT_FILES_IN += remote/libvirtd.init.in
-
 SYSCONF_FILES += remote/libvirtd.sysconf
 
 PODFILES += remote/libvirtd.pod
diff --git a/src/remote/libvirtd.init.in b/src/remote/libvirtd.init.in
deleted file mode 100644
index d81dca6f2e..0000000000
--- a/src/remote/libvirtd.init.in
+++ /dev/null
@@ -1,122 +0,0 @@
-#!/bin/sh
-
-# the following is the LSB init header see
-# http://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html
-#
-### BEGIN INIT INFO
-# Provides: libvirtd
-# Default-Start: 3 4 5
-# Default-Stop: 0 1 2 6
-# Required-Start: $network messagebus virtlogd
-# Required-Stop: $network messagebus
-# Should-Start: $named xend avahi-daemon virtlockd
-# Should-Stop: $named
-# Short-Description: daemon for libvirt virtualization API
-# Description: This is a daemon for managing guest instances
-#              and libvirt virtual networks
-#              See https://libvirt.org
-### END INIT INFO
-
-# the following is chkconfig init header
-#
-# libvirtd:   guest and virtual network management daemon
-#
-# chkconfig: 345 97 03
-# description:  This is a daemon for managing guest instances \
-#               and libvirt virtual networks \
-#               See https://libvirt.org
-#
-# processname: libvirtd
-# pidfile: @localstatedir@/run/libvirtd.pid
-#
-
-# Source function library.
-. @sysconfdir@/rc.d/init.d/functions
-
-SERVICE=libvirtd
-PROCESS=libvirtd
-PIDFILE=@localstatedir@/run/$SERVICE.pid
-
-LIBVIRTD_CONFIG=
-LIBVIRTD_ARGS=
-KRB5_KTNAME=/etc/libvirt/krb5.tab
-
-test -f @sysconfdir@/sysconfig/libvirtd && . @sysconfdir@/sysconfig/libvirtd
-
-export QEMU_AUDIO_DRV
-export SDL_AUDIODRIVER
-
-LIBVIRTD_CONFIG_ARGS=
-if [ -n "$LIBVIRTD_CONFIG" ]
-then
-    LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG"
-fi
-
-RETVAL=0
-
-start() {
-    echo -n $"Starting $SERVICE daemon: "
-    mkdir -p @localstatedir@/cache/libvirt
-    rm -rf @localstatedir@/cache/libvirt/*
-
-    # LIBVIRTD_NOFILES_LIMIT from /etc/sysconfig/libvirtd is not handled
-    # automatically
-    if [ -n "$LIBVIRTD_NOFILES_LIMIT" ]; then
-        ulimit -n "$LIBVIRTD_NOFILES_LIMIT"
-    fi
-
-    KRB5_KTNAME=$KRB5_KTNAME daemon --pidfile $PIDFILE --check $SERVICE $PROCESS --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
-    RETVAL=$?
-    echo
-    [ $RETVAL -eq 0 ] && touch @localstatedir@/lock/subsys/$SERVICE
-}
-
-stop() {
-    echo -n $"Stopping $SERVICE daemon: "
-
-    killproc -p $PIDFILE $PROCESS
-    RETVAL=$?
-    echo
-    if [ $RETVAL -eq 0 ]; then
-        rm -f @localstatedir@/lock/subsys/$SERVICE
-        rm -rf @localstatedir@/cache/libvirt/*
-    else
-        exit $RETVAL
-    fi
-}
-
-restart() {
-    stop
-    start
-}
-
-reload() {
-    echo -n $"Reloading $SERVICE configuration: "
-
-    killproc -p $PIDFILE $PROCESS -HUP
-    RETVAL=$?
-    echo
-    return $RETVAL
-}
-
-# See how we were called.
-case "$1" in
-    start|stop|restart|reload)
-        $1
-        ;;
-    status)
-        status -p $PIDFILE $PROCESS
-        RETVAL=$?
-        ;;
-    force-reload)
-        reload
-        ;;
-    condrestart|try-restart)
-        [ -f @localstatedir@/lock/subsys/$SERVICE ] && restart || :
-        ;;
-    *)
-        echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload|try-restart}"
-        exit 2
-        ;;
-esac
-exit $RETVAL
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 95025ced43..c6064dee08 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -327,10 +327,10 @@ POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)"
 		< $< > $@-t && \
 	mv $@-t $@
 
-install-data-local: install-init install-systemd install-nss \
+install-data-local: install-systemd install-nss \
 	install-bash-completion
 
-uninstall-local: uninstall-init uninstall-systemd uninstall-nss \
+uninstall-local: uninstall-systemd uninstall-nss \
 	uninstall-bash-completion
 
 install-sysconfig:
@@ -342,26 +342,7 @@ uninstall-sysconfig:
 	rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests
 	rmdir $(DESTDIR)$(sysconfdir)/sysconfig ||:
 
-EXTRA_DIST += libvirt-guests.sh.in libvirt-guests.init.in
-
-install-initscript: libvirt-guests.init
-	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/rc.d/init.d
-	$(INSTALL_SCRIPT) libvirt-guests.init \
-	  $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests
-
-uninstall-initscript:
-	rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests
-	rmdir $(DESTDIR)$(sysconfdir)/rc.d/init.d ||:
-
-
-if LIBVIRT_INIT_SCRIPT_RED_HAT
-BUILT_SOURCES += libvirt-guests.init
-install-init: install-sysconfig install-initscript
-uninstall-init: uninstall-sysconfig uninstall-initscript
-else ! LIBVIRT_INIT_SCRIPT_RED_HAT
-install-init:
-uninstall-init:
-endif ! LIBVIRT_INIT_SCRIPT_RED_HAT
+EXTRA_DIST += libvirt-guests.sh.in
 
 libvirt-guests.sh: libvirt-guests.sh.in $(top_builddir)/config.status
 	$(AM_V_GEN)sed \
@@ -376,14 +357,6 @@ libvirt-guests.sh: libvirt-guests.sh.in $(top_builddir)/config.status
 	    mv $@-t $@
 BUILT_SOURCES += libvirt-guests.sh
 
-libvirt-guests.init: libvirt-guests.init.in libvirt-guests.sh
-	$(AM_V_GEN)sed \
-		-e 's|[@]libexecdir[@]|$(libexecdir)|g' \
-	< $< > $@-t && \
-	chmod a+x $@-t && \
-	mv $@-t $@
-
-
 EXTRA_DIST += libvirt-guests.service.in
 SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
 
diff --git a/tools/libvirt-guests.init.in b/tools/libvirt-guests.init.in
deleted file mode 100644
index 495d4c7d1d..0000000000
--- a/tools/libvirt-guests.init.in
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-# the following is the LSB init header see
-# http://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html
-#
-### BEGIN INIT INFO
-# Provides: libvirt-guests
-# Default-Start: 3 4 5
-# Default-Stop: 0 1 2 6
-# Required-Start: libvirtd
-# Required-Stop: libvirtd
-# Should-Start:
-# Should-Stop:
-# Short-Description: suspend/resume libvirt guests on shutdown/boot
-# Description: This is a script for suspending active libvirt guests
-#              on shutdown and resuming them on next boot
-#              See https://libvirt.org
-### END INIT INFO
-
-# the following is chkconfig init header
-#
-# libvirt-guests:   suspend/resume libvirt guests on shutdown/boot
-#
-# chkconfig: 345 99 01
-# description:  This is a script for suspending active libvirt guests \
-#               on shutdown and resuming them on next boot \
-#               See https://libvirt.org
-#
-
-exec @libexecdir@/libvirt-guests.sh "$@"
-- 
2.20.1




More information about the libvir-list mailing list