Drop support for "Red Hat" init scripts

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@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Andrea Bolognani 2019-03-15 16:47:27 +01:00
parent b8cfdee42b
commit 912fe2df9d
11 changed files with 5 additions and 447 deletions

1
.gitignore vendored
View File

@ -11,7 +11,6 @@
*.gcov
*.html
*.i
*.init
*.la
*.lo
*.loT

View File

@ -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)

View File

@ -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 \

View File

@ -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 && \

View File

@ -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

View File

@ -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 && \

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 "$@"