From d0c5a8ee8cd9c135998b179b3469f8e9b39da6ca Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 25 Sep 2017 14:50:16 +0100 Subject: [PATCH] Remove distribution-specific init-scripts LSB-style (SysV-style) init scripts have not historically been portable between distributions, as evidenced by the presence of both "Red Hat" and "Slackware" init scripts in dbus. Many distributors prefer to maintain them downstream, as is done in Debian (and its derivatives) and in Slackware, so that the init script can follow OS conventions (for example regarding boot messages) and make use of OS-provided facilities (for example, the Debian init script uses dpkg's start-stop-daemon utility). The Slackware and Red Hat init scripts removed by this commit are not tested or maintained in practice, and so are likely to have bugs. The Slackware init-script provided here is not used on actual Slackware systems, which provide a different implementation of rc.messagebus in their packaging, while the Red Hat init script has been superseded by the systemd unit in current Fedora, CentOS and RHEL versions. The Cgywin messagebus-config provided here does appear to be used in production in cygwin-ports, but it's full of Cygwin-specifics with which the dbus maintainers are not familiar, so it is probably more appropriate for it to be tracked downstream as part of the Cygwin packaging. The systemd unit is not removed, since it is used on multiple Linux distributions with little or no modification, and receives regular testing and maintenance; this makes it appropriate to maintain upstream. Signed-off-by: Simon McVittie Bug: https://bugs.freedesktop.org/101706 --- NEWS | 27 +++++++ bus/Makefile.am | 46 +----------- bus/messagebus-config.in | 178 ----------------------------------------------- bus/messagebus.in | 92 ------------------------ bus/rc.messagebus.in | 79 --------------------- configure.ac | 36 ---------- 6 files changed, 30 insertions(+), 428 deletions(-) delete mode 100644 bus/messagebus-config.in delete mode 100755 bus/messagebus.in delete mode 100644 bus/rc.messagebus.in diff --git a/NEWS b/NEWS index e0a7c270..e88ec2db 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,33 @@ D-Bus 1.11.18 (UNRELEASED) == +Build-time configuration changes: + +• LSB-style init scripts for Red Hat and Slackware, and a non-LSB init + script for Cygwin, are no longer provided in the upstream dbus + source. We recommend that distributors who support non-systemd service + management should maintain their own init scripts or other service + manager integration as part of their downstream packaging, similar to + the way Debian distributes a Debian-specific LSB init script for dbus. + + The systemd unit continues to be maintained as part of the upstream + dbus source, because it receives regular testing and maintenance. + + (fd.o #101706, Simon McVittie) + +• The process ID file created by the system bus is no longer influenced + by the --with-init-scripts=redhat configure option or the presence of + /etc/redhat-release at build time. If your OS's init script or other + service management relies on the Red Hat-style pid file, it can be + restored by specifying --with-system-pid-file=/run/messagebus.pid at + configure time or using the directive in bus configuration. + + Note that the upstream-supplied systemd unit runs dbus-daemon with + the --nopidfile option, so it does not normally write a pid file, + regardless of whether the OS is Red-Hat-derived or not. + + (fd.o #101706, Simon McVittie) + Enhancements: • and rules in dbus-daemon configuration can now diff --git a/bus/Makefile.am b/bus/Makefile.am index 271887ca..9ae30716 100644 --- a/bus/Makefile.am +++ b/bus/Makefile.am @@ -41,7 +41,7 @@ AM_CFLAGS = \ EFENCE= -CONFIG_IN_FILES= \ +EXTRA_DIST = \ session.conf.in \ system.conf.in \ legacy-config/session.conf.in \ @@ -276,44 +276,7 @@ install-exec-hook: fi endif -#### Init scripts fun -SCRIPT_IN_FILES=messagebus.in \ - messagebus-config.in \ - rc.messagebus.in - -## Red Hat start -if DBUS_INIT_SCRIPTS_RED_HAT - -initddir=$(sysconfdir)/rc.d/init.d - -initd_SCRIPTS= \ - messagebus - -endif - ## Red Hat end - -## Slackware start -if DBUS_INIT_SCRIPTS_SLACKWARE - -initddir=$(sysconfdir)/rc.d/ - -initd_SCRIPTS= \ - rc.messagebus - -endif -## Slackware end - -## Cygwin start -if DBUS_INIT_SCRIPTS_CYGWIN - -bin_SCRIPTS= \ - messagebus-config - -endif -## Cygwin end - -if HAVE_SYSTEMD -SCRIPT_IN_FILES += \ +EXTRA_DIST += \ dbus.service.in \ dbus.socket.in \ systemd-user/dbus.service.in \ @@ -322,6 +285,7 @@ SCRIPT_IN_FILES += \ tmpfiles.d/dbus.conf.in \ $(NULL) +if HAVE_SYSTEMD systemdsystemunit_DATA = \ dbus.service \ dbus.socket @@ -343,7 +307,3 @@ endif # Add rules for code-coverage testing, as defined by AX_CODE_COVERAGE @CODE_COVERAGE_RULES@ - -#### Extra dist - -EXTRA_DIST=$(CONFIG_IN_FILES) $(SCRIPT_IN_FILES) diff --git a/bus/messagebus-config.in b/bus/messagebus-config.in deleted file mode 100644 index 39459dcb..00000000 --- a/bus/messagebus-config.in +++ /dev/null @@ -1,178 +0,0 @@ -#!/bin/sh -# -# messagebus-config, Copyright 2009 Yaakov Selkowitz -# -# This file is part of the Cygwin port of dbus. - -# ====================================================================== -# Initialization -# ====================================================================== -PROGNAME=$(basename $0) -_tdir=$(dirname $0) -PROGDIR=$(cd $_tdir && pwd) - -CSIH_SCRIPT=/usr/share/csih/cygwin-service-installation-helper.sh - -# Subdirectory where the new package is being installed -PREFIX=@prefix@ - -# Directory where the config files are stored -SYSCONFDIR=@sysconfdir@/dbus-1 -DEVDIR=/dev -LOGDIR=/var/log -RUNDIR=$(dirname @DBUS_SYSTEM_PID_FILE@) -SOCKDIR=$(dirname @DBUS_SYSTEM_SOCKET@) - -source ${CSIH_SCRIPT} - -# ====================================================================== -# Routine: install_service -# Install messagebus as a service -# ====================================================================== -install_service() { - - if csih_is_nt - then - - # Check if messagebus is installed and remove on user request. - if cygrunsrv -Q messagebus > /dev/null 2>&1 - then - csih_warning "The messagebus service is already installed." - echo - if csih_request "Do you want to reinstall it with different args?" - then - cygrunsrv -E messagebus - cygrunsrv -R messagebus - fi - fi - - # Install messagebus service if it is not already installed - if ! cygrunsrv -Q messagebus > /dev/null 2>&1 - then - echo - csih_warning "The following function requires administrator privileges!" - if csih_request "Do you want to install messagebus as service?" - then - if cygrunsrv -I messagebus -d "CYGWIN D-Bus system service" -p @EXPANDED_BINDIR@/dbus-daemon -a "--nofork --system" - then - echo - csih_inform "The messagebus service has been installed under the LocalSystem" - csih_inform "account (also known as SYSTEM). To start the service now, call" - csih_inform "\`net start messagebus' or \`cygrunsrv -S messagebus'. Otherwise, it" - csih_inform "will start automatically after the next reboot." - echo - csih_inform "Check ${SYSCONFDIR}/system.conf first, if it suits your needs." - fi - fi # user allowed us to install messagebus - fi # messagebus already installed - fi # csih_is_nt -} # --- End of install_service --- # - - -# ====================================================================== -# Main Entry Point -# ====================================================================== - - -# Check how the script has been started. If -# (1) it has been started by giving the full path and -# that path is /etc/postinstall, OR -# (2) Otherwise, if the environment variable -# CONFIG_AUTO_ANSWER_NO is set -# then set auto_answer to "no". This allows automatic -# creation of the config files in /etc w/o overwriting -# them if they already exist. In both cases, color -# escape sequences are suppressed, so as to prevent -# cluttering setup's logfiles. -if [ "$PROGDIR" = "/etc/postinstall" ] -then - csih_auto_answer="no" - csih_disable_color -fi -if [ -n "${CONFIG_AUTO_ANSWER_NO}" ] -then - csih_auto_answer="no" - csih_disable_color -fi - - -# ====================================================================== -# Parse options -# ====================================================================== -while : -do - case $# in - 0) - break - ;; - esac - - option=$1 - shift - - case "$option" in - -d | --debug ) - set -x - csih_trace_on - ;; - - -y | --yes ) - csih_auto_answer=yes - ;; - - -n | --no ) - csih_auto_answer=no - ;; - - *) - echo "usage: ${PROGNAME} [OPTION]..." - echo - echo "This script creates a basic messagebus configuration." - echo - echo "Options:" - echo " --debug -d Enable shell's debug output." - echo " --yes -y Answer all questions with \"yes\" automatically." - echo " --no -n Answer all questions with \"no\" automatically." - echo - exit 1 - ;; - - esac -done - -# ====================================================================== -# Action! -# ====================================================================== - -# Check for ${SYSCONFDIR} directory -csih_make_dir "${SYSCONFDIR}" "Cannot create global configuration files." -chmod 775 "${SYSCONFDIR}" -setfacl -m u:system:rwx "${SYSCONFDIR}" - -# Check for ${DEVDIR} directory -csih_make_dir "${DEVDIR}" "Syslogging using messagebus will not work." -chmod 775 "${DEVDIR}" -setfacl -m u:system:rwx "${DEVDIR}" - -# Check for ${LOGDIR} directory -csih_make_dir "${LOGDIR}" "Syslogging using messagebus will not work." -chmod 775 "${LOGDIR}" -setfacl -m u:system:rwx "${LOGDIR}" - -# Check for ${RUNDIR} directory -csih_make_dir "${RUNDIR}" "PID files of running processes will not be created." -chmod 775 "${RUNDIR}" -setfacl -m u:system:rwx "${RUNDIR}" - -# Check for ${SOCKDIR} directory -csih_make_dir "${SOCKDIR}" "SOCKET files of running processes will not be created." -chmod 775 "${SOCKDIR}" -setfacl -m u:system:rwx "${SOCKDIR}" - -# maybe: csih_auto_answer=no will skip, -# interactive user will get a chance to override -install_service - - -echo -echo "Configuration finished. Have fun!" diff --git a/bus/messagebus.in b/bus/messagebus.in deleted file mode 100755 index 3e2ee07a..00000000 --- a/bus/messagebus.in +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/sh -# -# messagebus: The D-BUS systemwide message bus -# -# chkconfig: 345 22 85 -# description: This is a daemon which broadcasts notifications of system events \ -# and other messages. See http://www.freedesktop.org/software/dbus/ -# -# processname: dbus-daemon -# pidfile: @DBUS_SYSTEM_PID_FILE@ -# -### BEGIN INIT INFO -# Provides: messagebus -# Required-Start: $syslog $local_fs -# Required-Stop: $syslog $local_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: The D-Bus systemwide message bus -# Description: This is a daemon which broadcasts notifications of system -# events and other messages. See http://www.freedesktop.org/software/dbus -### END INIT INFO - -# Sanity checks. -[ -x @EXPANDED_BINDIR@/dbus-daemon ] || exit 0 - -# Source function library. -. @EXPANDED_SYSCONFDIR@/rc.d/init.d/functions - -# so we can rearrange this easily -processname=dbus-daemon -servicename=messagebus - -RETVAL=0 - -start() { - echo -n $"Starting system message bus: " - if [ -x @EXPANDED_BINDIR@/dbus-uuidgen ] ; then - @EXPANDED_BINDIR@/dbus-uuidgen --ensure - fi - - daemon --check $servicename $processname --system - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch @EXPANDED_LOCALSTATEDIR@/lock/subsys/$servicename -} - -stop() { - echo -n $"Stopping system message bus: " - - ## we don't want to kill all the per-user $processname, we want - ## to use the pid file *only*; because we use the fake nonexistent - ## program name "$servicename" that should be safe-ish - killproc $servicename -TERM - RETVAL=$? - echo - if [ $RETVAL -eq 0 ]; then - rm -f @EXPANDED_LOCALSTATEDIR@/lock/subsys/$servicename - rm -f @DBUS_SYSTEM_PID_FILE@ - fi -} - -# See how we were called. -case "$1" in - start) - start - ;; - stop) - stop - ;; - status) - status $servicename - RETVAL=$? - ;; - restart) - stop - start - ;; - condrestart) - if [ -f @EXPANDED_LOCALSTATEDIR@/lock/subsys/$servicename ]; then - stop - start - fi - ;; - reload) - echo "Message bus can't reload its configuration, you have to restart it" - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}" - ;; -esac -exit $RETVAL diff --git a/bus/rc.messagebus.in b/bus/rc.messagebus.in deleted file mode 100644 index c52ca777..00000000 --- a/bus/rc.messagebus.in +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh -# -# messagebus: The D-BUS systemwide message bus -# -# chkconfig: 345 97 03 -# description: This is a daemon which broadcasts notifications of system events \ -# and other messages. See http://www.freedesktop.org/software/dbus/ -# -# processname: dbus-daemon -# pidfile: @DBUS_SYSTEM_PID_FILE@ -# - -# Sanity checks. -#[ -x @EXPANDED_BINDIR@/dbus-daemon ] || exit 0 - -# Source function library. -#. @EXPANDED_SYSCONFDIR@/rc.d/init.d/functions - -# so we can rearrange this easily -#processname=dbus-daemon -#servicename=messagebus - -#RETVAL=0 - -start() { - echo "Starting system message bus" - if [ -x @EXPANDED_BINDIR@/dbus-uuidgen ] ; then - @EXPANDED_BINDIR@/dbus-uuidgen --ensure - fi - - if [ -x @EXPANDED_BINDIR@/dbus-daemon ];then - @EXPANDED_BINDIR@/dbus-daemon --system - fi - #daemon --check $servicename $processname --system - #RETVAL=$? - #echo - #[ $RETVAL -eq 0 ] && touch @EXPANDED_LOCALSTATEDIR@/lock/subsys/$servicename -} - -stop() { - echo "Stopping system message bus" - - ## we don't want to kill all the per-user $processname, we want - ## to use the pid file *only*; because we use the fake nonexistent - ## program name "$servicename" that should be safe-ish - killall dbus-daemon - #RETVAL=$? - #echo - #if [ $RETVAL -eq 0 ]; then - # rm -f @EXPANDED_LOCALSTATEDIR@/lock/subsys/$servicename - # rm -f @DBUS_SYSTEM_PID_FILE@ - #fi -} - -# See how we were called. -case "$1" in - start) - start - ;; - stop) - stop - ;; - status) - status $servicename - RETVAL=$? - ;; - restart) - stop - start - ;; - reload) - echo "Message bus can't reload its configuration, you have to restart it" - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|reload}" - ;; -esac -exit $RETVAL diff --git a/configure.ac b/configure.ac index 05182d1f..e26941a9 100644 --- a/configure.ac +++ b/configure.ac @@ -211,7 +211,6 @@ AC_ARG_ENABLE(console-owner-file, AS_HELP_STRING([--enable-console-owner-file],[ AC_ARG_ENABLE(launchd, AS_HELP_STRING([--enable-launchd],[build with launchd auto-launch support]),enable_launchd=$enableval,enable_launchd=auto) AC_ARG_ENABLE(systemd, AS_HELP_STRING([--enable-systemd],[build with systemd at_console support]),enable_systemd=$enableval,enable_systemd=auto) -AC_ARG_WITH(init-scripts, AS_HELP_STRING([--with-init-scripts=[redhat]],[Style of init scripts to install])) AC_ARG_WITH(session-socket-dir, AS_HELP_STRING([--with-session-socket-dir=[dirname]],[Where to put sockets for the per-login-session message bus])) AC_ARG_WITH(test-socket-dir, AS_HELP_STRING([--with-test-socket-dir=[dirname]],[Where to put sockets for make check])) AC_ARG_WITH(system-pid-file, AS_HELP_STRING([--with-system-pid-file=[pidfile]],[PID file for systemwide daemon])) @@ -1513,35 +1512,6 @@ AS_AC_EXPAND(EXPANDED_LIBEXECDIR, "$libexecdir") AS_AC_EXPAND(EXPANDED_DATADIR, "$datadir") AS_AC_EXPAND(EXPANDED_RUNSTATEDIR, "$runstatedir") -#### Check our operating system -operating_system=unknown -if test -f /etc/redhat-release || test -f $EXPANDED_SYSCONFDIR/redhat-release ; then - operating_system=redhat -fi - -if test -f /etc/slackware-version || test -f $EXPANDED_SYSCONFDIR/slackware-version ; then - operating_system=slackware -fi - -if test -f /usr/bin/cygwin1.dll || test -f $EXPANDED_BINDIR/cygwin1.dll ; then - operating_system=cygwin -fi - -#### Sort out init scripts - -if test x$with_init_scripts = x; then - case x$operating_system in - xredhat) with_init_scripts=redhat ;; - xslackware) with_init_scripts=slackware ;; - xcygwin) with_init_scripts=cygwin ;; - *) with_init_scripts=none ;; - esac -fi - -AM_CONDITIONAL(DBUS_INIT_SCRIPTS_RED_HAT, test x$with_init_scripts = xredhat) -AM_CONDITIONAL(DBUS_INIT_SCRIPTS_SLACKWARE, test x$with_init_scripts = xslackware) -AM_CONDITIONAL(DBUS_INIT_SCRIPTS_CYGWIN, test x$with_init_scripts = xcygwin) - ##### systemd unit files AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), @@ -1597,8 +1567,6 @@ AC_DEFINE_UNQUOTED(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS, "$DBUS_SYSTEM_BUS_DEFAULT_AD #### Set up the pid file if ! test -z "$with_system_pid_file"; then DBUS_SYSTEM_PID_FILE=$with_system_pid_file -elif test x$with_init_scripts = xredhat ; then - DBUS_SYSTEM_PID_FILE="${EXPANDED_RUNSTATEDIR}/messagebus.pid" else DBUS_SYSTEM_PID_FILE="${EXPANDED_RUNSTATEDIR}/dbus/pid" fi @@ -1893,10 +1861,7 @@ bus/legacy-config/system.conf bus/legacy-config/session.conf bus/example-system-enable-stats.conf bus/example-session-disable-stats.conf -bus/messagebus -bus/messagebus-config bus/org.freedesktop.dbus-session.plist -bus/rc.messagebus bus/dbus.service bus/dbus.socket bus/systemd-user/dbus.service @@ -1975,7 +1940,6 @@ echo " Building Ducktype docs: ${enable_ducktype_docs} Building XML docs: ${enable_xml_docs} Building launchd support: ${have_launchd} - Init scripts style: ${with_init_scripts} Abstract socket names: ${ac_cv_have_abstract_sockets} System bus socket: ${DBUS_SYSTEM_SOCKET} System bus address: ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS} -- 2.14.1