[projects/rc-scripts] Drop all Upstart support

jajcus jajcus at pld-linux.org
Wed Apr 22 15:35:07 CEST 2015


commit f7943bf696b39d5b4ce4280b67f2274a0b7e0fd6
Author: Jacek Konieczny <j.konieczny at eggsoft.pl>
Date:   Wed Apr 22 08:44:41 2015 +0200

    Drop all Upstart support
    
    – it was ugly
    – it was not maintained
    – Upstart has not been usable in Th for some time anyway

 Makefile.am             |   2 +-
 TODO                    |  14 ---
 configure.ac            |   1 -
 doc/Makefile.am         |   3 +-
 doc/make-html           |   1 -
 doc/upstart.txt         | 289 ------------------------------------------------
 init/Makefile.am        |   9 --
 init/allowlogin.conf    |  40 -------
 init/cpusets.conf       |  25 -----
 init/cryptsetup.conf    |  11 --
 init/local.conf         |  15 ---
 init/modules.conf       |  38 -------
 init/random.conf        |  26 -----
 init/rc.conf            |  28 -----
 init/rcS-sulogin.conf   |  27 -----
 init/rcS.conf           |  32 ------
 init/sys-chroots.conf   |  23 ----
 init/udev.conf          |   6 -
 lib/functions           | 230 ++------------------------------------
 lib/functions.network   |   2 -
 rc.d/init.d/allowlogin  |   2 -
 rc.d/init.d/local       |   2 -
 rc.d/init.d/network     |  17 ---
 rc.d/init.d/random      |   6 -
 rc.d/init.d/sys-chroots |   2 -
 rc.d/rc                 |   3 -
 rc.d/rc.shutdown        |   8 --
 rc.d/rc.sysinit         |  43 ++-----
 service                 |  28 +----
 29 files changed, 24 insertions(+), 909 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 2ef5b36..aabcb6f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
 #
 #
 
-SUBDIRS = src lib ppp isapnp sysconfig rc.d doc man po init
+SUBDIRS = src lib ppp isapnp sysconfig rc.d doc man po
 
 sysconf_DATA = \
 	adjtime \
diff --git a/TODO b/TODO
index 6b1bc6b..2504da4 100644
--- a/TODO
+++ b/TODO
@@ -19,17 +19,3 @@ Other:
 - maybe merge ATM rc scripts
 
 We are waiting for suggestions.
-
-upstart:
-+upstart_controlled --except reload
-+
-+# return true if service is considered "up"
-+# with upstart, upstart is consulted
-+# otherwise lockfile in subsys must exist
-+is_service_up() {
-+	use_upstart && is_upstart_running "$1" || [ -f /var/lock/subsys/"$1" ]
-+}
-+
-
-from nscd.init
-
diff --git a/configure.ac b/configure.ac
index 1633b64..3b4e9ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -224,6 +224,5 @@ AC_CONFIG_FILES([Makefile \
 	sysconfig/interfaces/down.d/tnl/Makefile \
 	rc.d/Makefile rc.d/init.d/Makefile \
 	po/Makefile \
-	init/Makefile \
 	])
 AC_OUTPUT
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 25a721c..6218f40 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -7,7 +7,6 @@ noinst_DATA = \
 	template.init \
 	net-scripts.txt \
 	sysconfig.txt \
-	sysvinitfiles \
-	upstart.txt
+	sysvinitfiles
 
 EXTRA_DIST = $(doc_DATA) $(noinst_DATA)
diff --git a/doc/make-html b/doc/make-html
index 8cb55c3..fa3f11f 100755
--- a/doc/make-html
+++ b/doc/make-html
@@ -2,4 +2,3 @@
 
 jade -t sgml -d polski.dsl rc-scripts.docb
 #jade -t sgml -d polski.dsl test-ogonki.docb
-rst2html upstart.txt upstart.html
diff --git a/doc/upstart.txt b/doc/upstart.txt
deleted file mode 100644
index 4f3a791..0000000
--- a/doc/upstart.txt
+++ /dev/null
@@ -1,289 +0,0 @@
-===================================
-Upstart event-based service startup
-===================================
-
-This version of rc-scripts support Upstart event-based service startup. This
-can co-exist with old-style startup scripts.
-
-Enabling/disabling event-base service startup
----------------------------------------------
-
-Upstart event-based service startup may be disabled on boot time
-by using a ``pld.no-upstart`` kernel command-line option.
-
-An init script may be called with ``USE_UPSTART=no`` environment variable
-to disable special upstart-related processing – this way one may use
-``/etc/rc.d/init.d/$service start`` to start a service even if upstart job
-for that service is present. The ``/sbin/service`` script has two new options
-``--upstart`` and ``--no-upstart`` to force new- or old-style service control.
-
-``USE_UPSTART=no`` can also be places in ``/etc/sysconfig/system``
-configuration file, though it can break ``*-upstart`` packages
-installation/removal a bit.
-
-Available events
-----------------
-
-Ubuntu-compatible system events
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-all-swaps
-        when swaps from ``/etc/fstab`` are activated
-
-filesystem
-        when basic filesystem hierarchy (FHS) is mounted
-        NOTE: currently it doesn't wait for network filesystems!
-
-local-filesystems
-        when all local filesystems are mounted and initialized
-
-root-filesystem
-        when root filesystem is mounted r/w and initialized
-
-virtual-filesystems
-        when virtual filesystems (/proc, /sys, etc.) are mounted
-
-PLD-specific system events:
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-pld.sysinit-done
-        when rc.sysinit finished its job
-
-pld.shutdown-started
-starting shutdown
-started shutdown
-        when rc.shutdown starts
-
-pld.network-starting
-starting network
-        just before network initialization is started
-
-pld.network-started
-started network
-        when network is initialized
-
-pld.network-stopping
-stopping network
-        just before network shutdown is started
-
-pld.network-stopped
-stopped network
-        when network configuration is shut down
-
-Jobs
-~~~~
-
-The standard Upstart events are available for job control:
-starting(7) started(7) stopping(7) stopped(7)  (see man pages)
-
-As relying on job name is not good enough when several alternative
-implementations of a service are available. In such case
-each of the alternative jobs should have an extra 'SERVICE_syslog=y'
-variable exported. In van then be used like this::
-
-  start on started SERVICE_syslog=y
-
-Please note that using 'SERVICE=something' will not work, as the value
-will be inherited by any other job with 'export SERVICE'.
-
-Job events and enabling/disabling event-base service startup
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Please note that relying on events not raised by PLD service jobs
-or scripts (like 'startup') will make job ignore the 'pld.no-upstart'
-setting.
-
-
-Writing Upstart job descriptions
---------------------------------
-
-Job description files in ``/etc/init`` are not only the recipes to start
-a service, but also configuration files for that service. Keep that in mind
-when writing the ``*.conf`` files. No complicated logic, that can change from
-a release to a release, should be implemented there, the script should be
-readable, basic configuration settings easy to find and no upstart-controlled
-settings (like resource limit)  reimplemented in the script or started daemon
-arguments.
-
-The syntax of the ``/etc/init/*.conf`` files is described in the init(5) man
-page.
-
-Instead of using ``/etc/sysconfig/$service`` files put the service
-configuration directly into the ``*.conf`` file. When 'env' stanza is used for
-that, the value may be overridden when starting the job with initctl.
-
-Simple example, the job description for syslog-ng::
-
-  start on pld.network-started
-  stop on pld.shutdown-started
-
-  env SERVICE=syslog
-  export SERVICE
-
-  respawn
-
-  console output
-
-  exec /usr/sbin/syslog-ng -F -f /etc/syslog-ng/syslog-ng.conf
-
-Checking upstart configuration
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Since Upstart 1.3 one can check current configuration with::
-
-  initctl check-config
-
-Also, with an 'initctl2dot' tool the configuration may be visualised in
-a graphical diagram.
-
-Tracking startup progress
-~~~~~~~~~~~~~~~~~~~~~~~~~
-
-The easiest way to run a program from an upstart job is to ``exec`` it
-the way it will stay in foreground (that is what is the ``-F`` option in the
-example above for). However, when process is started this way Upstart cannot
-differentiate before the ``program starting failed`` and ``program has
-terminated`` cases. It will also assumed the job has started as soon as the
-command has been executed and that may be not what other jobs wait for.
-
-A 'proper daemon' first checks command line arguments and configuration, then
-forks two times and returns with success only when the child process is ready.
-Upstart can handle such daemons with ``expect daemon`` stanza. So, to manage
-such daemon via Upstart, exec so it daemonize and use ``expect daemon``
-directive to tell Upstart what happens. Unfortunately, when ``expect daemon``
-is used and the process forks only once or does some more weird thing, Upstart
-job may lock up. Also, libdaemon-based daemons don't play well with ``expect
-daemon``.
-
-When the service forks once ``expect fork`` should be used instead.
-
-There is also an ``expect stop`` option, probably the most elegant way to
-track process startup. The process doesn't have to fork in this case and
-Upstart doesn't have to track that forking. The process should raise SIGSTOP
-when it is ready – only then Upstart will emit the job's ``started`` event and
-let the process continue. Unfortunately, currently hardly anything supports
-this interface.
-
-When no ``expect`` stanza will help and we need to properly wait for process
-startup, then ``post-start`` script must be used. See the init(5) man page for
-details.
-
-Debuging jobs
-~~~~~~~~~~~~~
-
-Making sure job description is correct and Upstart will properly manage the
-process may be tricky. One way to check if the job was described and started
-properly is to use ``pstree -p`` command and compare it to ``initctl status``
-output. Example::
-
-  # initctl status cherokee
-  cherokee start/running, process 22419
-
-  # pstree -p
-  init(1)─┬─Terminal(19446)─┬─bash(8983)───console(9003)
-        ....
-          |-bacula-sd(3514)---{bacula-sd}(3520)
-          |-cherokee(22419)-+-cherokee-worker(22423)-+-rrdtool(22425)
-          |                 |                        |-{cherokee-worker}(22424)
-          |                 |                        |-{cherokee-worker}(22426)
-          |                 |                        |-{cherokee-worker}(22427)
-          |                 |                        |-{cherokee-worker}(22428)
-          |                 |                        |-{cherokee-worker}(22429)
-          |                 |                        |-{cherokee-worker}(22430)
-          |                 |                        |-{cherokee-worker}(22431)
-          |                 |                        |-{cherokee-worker}(22432)
-          |                 |                        |-{cherokee-worker}(22433)
-          |                 |                        `-{cherokee-worker}(22434)
-          |                 `-{cherokee}(22422)
-          |-conserver(3471)---conserver(3477)
-        ....
-
-
-As you can see, Upstart thinks the main process of 'cherokee' is '22419',
-and indeed this is the only 'cherokee' child of init. So this state is correct.
-
-Common problem that may appear in pstree output:
-
-  1. The main process pid differs from what Upstart thinks. That usually
-     happens when bad 'expect fork' or 'expect daemon' is used. May cause
-     Upstart lock-up when the PID reported by ``initctl status`` does not exist
-     at all.
-
-  2. Init has multiple children processes for one job instance. It may happen
-     when previously running job was not properly killed, when bad 'expect' was
-     used or when the daemon does weird forking on startup.
-
-See also http://upstart.ubuntu.com/wiki/Debugging
-
-Updating init scripts
----------------------
-
-Parts of the system will still expect ``service $name`` or even, directly,
-``/etc/rc.d/init.d/$name`` scripts working. Also, LSB expects compatible
-init scripts in /etc/init.d. For this still to work, an upstart-controlled
-service is expected to have its ``/etc/rc.d/init.d/$name`` script also present.
-It must also be named exactly as the main upstart job for the service.
-
-The script must be a bit modified (in comparison to the traditional init
-scripts) to make use of the upstart features.
-
-For the start/stop/status/reload commands to work the script should include a
-``upstart_controlled`` command placed before commands are handled (and after
-``/etc/rc.d/init.d/function`` was included). This command (shell alias actually)
-will be ignored when upstart boot control is disabled or no upstart job is
-available for the service. Otherwise it will implement the basic LSB commands
-and exit.
-
-Sometimes some commands must be implemented in a special way (not all services
-may understand SIGHUP as a signal to reload their configuration) or extra
-commands are provided (like 'configtest'). In such case ``upstart_controlled``
-should be given a list of commands to implement or, preferrably, ``--except``
-and the list of commands which stay implemented in the script. If the first
-argument of the script is one to be of the 'not upstart_controlled' commands,
-processing will continue past 'upstart_controlled' call and the commands may
-be handled by the init script.
-
-When ``configtest`` is includes in the ``upstart_controlled --except`` list
-then ``$script configtest`` will be called before each restart/reload attempt,
-but only when done by ``/sbin/service`` or call to the script. Direct initctl
-calls are not affected.
-
-The minimal init script, for a service which will be controlled by upstart
-only would be::
-
-  #!/bin/sh
-
-  . /etc/rc.d/init.d/functions
-
-  upstart_controlled
-
-  echo "Service available only via upstart boot"
-  exit 3
-
-Minimal change to an existing PLD script to handle upstart control is to add::
-
-  upstart_controlled
-
-before the usual::
-
-  RETVAL=0
-  # See how we were called.
-  case "$1" in
-    start)
-
-Sometimes other upstart jobs will rely on a service started by the traditional
-init script. In such case, the script should emit appropriate events.
-
-e.g.::
-
-	msg_starting "syslog-ng"
-	emit starting JOB=syslog-ng SERVICE=syslog
-	daemon /usr/sbin/syslog-ng -f /etc/syslog-ng/syslog-ng.conf $OPTIONS
-	emit started JOB=syslog-ng SERVICE=syslog
-	RETVAL=$?
-
-The ``emit`` function does nothing when upstart-controlled boot is disabled (not
-to trigger any upstart jobs), otherwise it calls ``/sbin/initctl emit``
-
-..
- vi: tw=78 ft=rst spl=en
diff --git a/init/Makefile.am b/init/Makefile.am
deleted file mode 100644
index 8467c93..0000000
--- a/init/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
- at SET_MAKE@
-
-initdir = @initdir@
-
-init_DATA = random.conf rc.conf rcS-sulogin.conf rcS.conf udev.conf \
-	allowlogin.conf sys-chroots.conf cpusets.conf cryptsetup.conf local.conf \
-	modules.conf
-
-EXTRA_DIST = $(init_DATA)
diff --git a/init/allowlogin.conf b/init/allowlogin.conf
deleted file mode 100644
index 368011a..0000000
--- a/init/allowlogin.conf
+++ /dev/null
@@ -1,40 +0,0 @@
-description	"Allow users to login"
-
-start on pld.sysinit-done
-stop on pld.shutdown-started
-
-console output
-
-pre-start script
-	[ -f /etc/sysconfig/system ] && . /etc/sysconfig/system
-
-	# exit early without loading big init.d functions
-	case "$DELAY_LOGIN" in
-		yes|Yes|YES|true|True|TRUE|on|On|ON|Y|y|1)
-		;;
-	*)
-		/sbin/initctl -q stop
-		;;
-	esac
-end script
-
-script
-	# Source function library.
-	. /etc/rc.d/init.d/functions
-
-	if is_yes "$DELAY_LOGIN" && [ -f /etc/nologin.boot ]; then
-		run_cmd "Allowing users to login" rm -f /etc/nologin /etc/nologin.boot
-	fi
-	end script
-
-pre-stop script
-	# Source function library.
-	. /etc/rc.d/init.d/functions
-
-	# /etc/nologin when shutting down system
-	if is_yes "$DELAY_LOGIN" && [ ! -f /etc/nologin ]; then
-		nls "System shutdown in progress\n" > /etc/nologin
-		chmod 644 /etc/nologin
-		cp -fp /etc/nologin /etc/nologin.boot
-	fi
-end script
diff --git a/init/cpusets.conf b/init/cpusets.conf
deleted file mode 100644
index a1c616a..0000000
--- a/init/cpusets.conf
+++ /dev/null
@@ -1,25 +0,0 @@
-description "Creates/Removes all cpu sets configured to start at boot time."
-
-start on pld.sysinit-done
-stop on pld.shutdown-started
-
-console output
-task
-
-pre-start script
-	# test that cpusets are configured
-	. /etc/sysconfig/system
-	if [ "${CPUSETS:-no}" = "no" ]; then
-		/sbin/initctl -q stop
-	fi
-end script
-
-script
-	export USE_UPSTART=no
-	exec /etc/rc.d/init.d/cpusets start
-end script
-
-pre-stop script
-	export USE_UPSTART=no
-	exec /etc/rc.d/init.d/cpusets stop
-end script
diff --git a/init/cryptsetup.conf b/init/cryptsetup.conf
deleted file mode 100644
index 6b54819..0000000
--- a/init/cryptsetup.conf
+++ /dev/null
@@ -1,11 +0,0 @@
-description "Disk encryption via cryptsetup"
-
-start on pld.sysinit-done
-stop on pld.shutdown-started
-
-task
-
-script
-	. /etc/rc.d/init.d/cryptsetup
-	init_crypto
-end script
diff --git a/init/local.conf b/init/local.conf
deleted file mode 100644
index c2093db..0000000
--- a/init/local.conf
+++ /dev/null
@@ -1,15 +0,0 @@
-description "This script will be executed *after* all the other SysV style init scripts."
-
-# start when runlevel is reached (except 0 and 6)
-start on stopped rc RUNLEVEL=[!06]
-
-console output
-task
-
-pre-start script
-	test -f /etc/rc.d/rc.local
-end script
-
-script
-	. /etc/rc.d/rc.local
-end script
diff --git a/init/modules.conf b/init/modules.conf
deleted file mode 100644
index f516ace..0000000
--- a/init/modules.conf
+++ /dev/null
@@ -1,38 +0,0 @@
-# module-init-tools - load modules from /etc/modules
-#
-# This task loads the kernel modules specified in the /etc/modules file
-
-description "load modules from /etc/modules"
-
-start on (startup
-      and started udev)
-
-task
-
-script
-	{
-		read _x _y v _z
-		old_IFS=$IFS
-		# strip _* or -* from versions like: "2.6.25_vanilla-1", "2.6.25-1"
-		IFS='_-'
-		set -- $v
-		v1=${1}
-		IFS='.'
-		set -- $v1
-		IFS=$old_IFS
-
-		kernel="$1.$2"
-		kerneleq="$1.$2.$3"
-	} < /proc/version
-
-	# Loop over every line in modules file
-	( \
-		grep -hvE '^(#|[[:blank:]]*$)' /etc/modules /etc/modules.$kernel /etc/modules.$kerneleq 2>/dev/null
-		echo '' # make sure there is a LF at the end
-	) | while read module args; do
-		[ -z "$module" ] && continue
-		# strip comments
-		args=${args%%#*}
-		modprobe -s $module -- $args
-	done
-end script
diff --git a/init/random.conf b/init/random.conf
deleted file mode 100644
index 8575a49..0000000
--- a/init/random.conf
+++ /dev/null
@@ -1,26 +0,0 @@
-description "Save random entropy on shutdown and restore it at boot time"
-
-start on pld.sysinit-done
-stop on pld.shutdown-started
-
-env SEED_FILE=/var/run/random-seed
-
-pre-start script
-	poolfile=/proc/sys/kernel/random/poolsize
-	[ -r $poolfile ] && bytes="$(cat $poolfile)" || bytes=512
-	if [ -f $SEED_FILE ]; then
-		cat $SEED_FILE >/dev/urandom
-	else
-		touch $SEED_FILE
-	fi
-	chmod 600 $SEED_FILE
-	dd if=/dev/urandom of=$SEED_FILE count=1 bs=$bytes 2>/dev/null
-end script
-
-post-stop script
-	poolfile=/proc/sys/kernel/random/poolsize
-	[ -r $poolfile ] && bytes="$(cat $poolfile)" || bytes=512
-	touch $SEED_FILE
-	chmod 600 $SEED_FILE
-	dd if=/dev/urandom of=$SEED_FILE count=1 bs=$bytes 2>/dev/null
-end script
diff --git a/init/rc.conf b/init/rc.conf
deleted file mode 100644
index aa11ac2..0000000
--- a/init/rc.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-description "rc - System V runlevel compatibility\
-             \
-             This task runs the old sysv-rc runlevel scripts.  It \
-             is usually started by the telinit compatibility wrapper."
-
-start on runlevel [0123456]
-stop on runlevel [!$RUNLEVEL]
-
-emits shutdown
-emits network
-
-# rc.sysinit
-emits pld.sysinit-done
-
-# rc.shutdown
-emits pld.shutdown-started
-
-# /etc/rc.d/init.d/network
-emits pld.network-starting
-emits pld.network-started
-emits pld.network-stopping
-emits pld.network-stopped
-
-task
-
-export RUNLEVEL
-console output
-exec /etc/rc.d/rc $RUNLEVEL
diff --git a/init/rcS-sulogin.conf b/init/rcS-sulogin.conf
deleted file mode 100644
index cac14d7..0000000
--- a/init/rcS-sulogin.conf
+++ /dev/null
@@ -1,27 +0,0 @@
-description "rcS-sulogin - 'single-user' runlevel compatibility \
-\
-This task runs /bin/sh during 'single-user' mode, \
-then continues to the default runlevel."
-
-start on runlevel S
-stop on runlevel [!S]
-
-emits runlevel
-
-console owner
-script
-	. /etc/rc.d/init.d/functions
-	if ! is_no "$RUN_SULOGIN_ON_ERR"; then
-		exec /sbin/sulogin
-	else
-		exec /bin/sh
-	fi
-end script
-
-post-stop script
-	if [ "$RUNLEVEL" = "S" ]; then
-		runlevel=$(/bin/awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' /etc/inittab)
-		[ -z "$runlevel" ] && runlevel="3"
-		exec telinit $runlevel
-	fi
-end script
diff --git a/init/rcS.conf b/init/rcS.conf
deleted file mode 100644
index 570a288..0000000
--- a/init/rcS.conf
+++ /dev/null
@@ -1,32 +0,0 @@
-description "rcS - runlevel compatibility \
-\
-This task runs the old sysv-rc startup scripts."
-
-start on startup
-
-stop on runlevel
-
-emits all-swaps filesystem local-filesystems root-filesystem virtual-filesystems runlevel
-emits pld.sysinit-done
-
-task
-
-# Note: there can be no previous runlevel here, if we have one it's bad
-# information (we enter rc1 not rcS for maintenance).  Run /etc/rc.d/rc
-# without information so that it defaults to previous=N runlevel=S.
-console output
-exec /etc/rc.d/rc.sysinit
-
-post-stop script
-	if [ "$UPSTART_EVENTS" = "startup" ]; then
-		runlevel=$(/bin/awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' /etc/inittab)
-		[ -z "$runlevel" ] && runlevel="3"
-		for t in $(cat /proc/cmdline); do
-			case $t in
-				-s|single|S|s) runlevel="S" ;;
-				[1-9])       runlevel="$t" ;;
-			esac
-		done
-		exec telinit $runlevel
-	fi
-end script
diff --git a/init/sys-chroots.conf b/init/sys-chroots.conf
deleted file mode 100644
index 1d7e29e..0000000
--- a/init/sys-chroots.conf
+++ /dev/null
@@ -1,23 +0,0 @@
-description "Starts and stops services in chroots"
-
-start on runlevel [0123456] and pld.sysinit-done
-stop on runlevel [!$RUNLEVEL]
-
-console output
-task
-
-pre-start script
-	# test that chroots are configured
-	. /etc/sysconfig/system
-	test -n "$SYSTEM_CHROOTS" || /sbin/initctl -q stop
-end script
-
-script
-	export USE_UPSTART=no
-	exec /etc/rc.d/init.d/sys-chroots start
-end script
-
-pre-stop script
-	export USE_UPSTART=no
-	exec /etc/rc.d/init.d/sys-chroots stop
-end script
diff --git a/init/udev.conf b/init/udev.conf
deleted file mode 100644
index eeada65..0000000
--- a/init/udev.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-description "dummy job"
-
-# Dummy job so, the 'udev' dependecies are satisfied although udev is not
-# started by upstart"
-
-# vi: ft=upstart
diff --git a/lib/functions b/lib/functions
index 1b1b972..f74eb3e 100644
--- a/lib/functions
+++ b/lib/functions
@@ -53,9 +53,6 @@ CRESMAN="$GREEN"	# "Resource Manager" color
 CHARS=""		# Characters displayed on the beginning of show line
 CCHARS="$NORMAL"	# Color of these characters (look at /etc/sysconfig/init-colors.gentoo example)
 
-# save from env, set by /sbin/service
-env_upstart=$USE_UPSTART
-
 # Source configuration if available - may override default values
 [ -r /etc/sysconfig/init-colors ] && . /etc/sysconfig/init-colors
 [ -r /etc/sysconfig/system ] && . /etc/sysconfig/system
@@ -72,8 +69,6 @@ else
 	unset RC_FEDORA || :
 fi
 
-[ "$env_upstart" ] && USE_UPSTART=$env_upstart
-
 if [ -z "$VSERVER" -o "$VSERVER" = "detect" ]; then
 	{
 		while read _f _ctx; do
@@ -1309,239 +1304,32 @@ rc_gettext_init() {
 }
 
 use_upstart () {
-	# True when upstart-event-based boot should be used
-	is_yes "$USE_UPSTART" && return 0
-	is_no "$USE_UPSTART" && return 1
-	if [ ! -x /sbin/initctl ] ; then
-		USE_UPSTART="no"
-		return 1
-	fi
-	local cmdline=$(cat /proc/cmdline 2>/dev/null)
-	if strstr "$cmdline" "pld.no-upstart" ; then
-		USE_UPSTART="no"
-		return 1
-	else
-		USE_UPSTART="yes"
-		return 0
-	fi
+	return 1
 }
-
 emit () {
-	# emit upstart signal
-	# only when 'upstart' boot is enabled
-	use_upstart || return 0
-	/sbin/initctl emit "$@"
+	return 0
 }
-
 is_upstart_task() {
-	# Return 0 if the given service is an upstart task.
-	grep -q '^task' "/etc/init/$1.conf"
+	return 1
 }
 is_upstart_running() {
-	# Return 0 if the given service is running via upstart
-	initctl status "$1" 2>/dev/null | grep -q running
+	return 1
 }
 upstart_start() {
-	local service=$1
-	if is_upstart_running "${service}"; then
-		msg_already_running "$service"
-		return 0
-	fi
-
-	msg_starting "${service}"
-	if errors=$(/sbin/initctl start ${service} 2>&1) ; then
-		ok
-		return 0
-	else
-		fail
-		echo "$errors" >&2
-		return 1
-	fi
+	return 1
 }
 upstart_stop() {
-	local service=$1
-	if ! is_upstart_running "${service}"; then
-		msg_not_running "$name"
-		return 0
-	fi
-	msg_stopping "${service}"
-	if errors=$(/sbin/initctl stop ${service}) ; then
-		ok
-		return 0
-	else
-		fail
-		echo "$errors" >&2
-		return 1
-	fi
+	return 1
 }
 upstart_reload() {
-	local service=$1
-	if ! is_upstart_running "${service}" && ! is_upstart_task "${service}" ; then
-		return 0
-	fi
-	msg_reloading "${service}"
-	if errors=$(/sbin/initctl reload ${service}) ; then
-		ok
-		return 0
-	else
-		fail
-		echo "$errors" >&2
-		return 1
-	fi
+	return 0
 }
 upstart_status() {
-	# get service status
-	# should be compliant with
-	# http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
-	local service=$1
-	local status
-	if is_upstart_task "${service}" ; then
-		# we probably should have a way to handle task status
-		return 0
-	fi
-	if ! status=$(/sbin/initctl status "${service}") ; then
-		# program or service status is not known
-		return 4
-	fi
-	if strstr "$status" "running" ; then
-		# program is running or service is OK
-		echo "$status"
-		return 0
-	else
-		# program is not running
-		echo "$status"
-		return 3
-	fi
-	# TODO: other statuses
+	return 1
 }
-
 _upstart_controlled() {
-	# If the service is to be handled by upstart
-	# execute the start/stop/etc. commands the upstart way
-	if ! use_upstart; then
-		return 0
-	fi
-	local script=$1
-	shift
-	local command=$1
-	[ $# -gt 0 ] && shift
-	local name=$(basename "$script")
-	if [ ! -f /etc/init/${name}.conf ] ; then
-		return 0
-	fi
-	local commands
-	local extra_commands
-	local has_configtest
-	if [ "$1" = "--except" ] ; then
-		shift
-		commands="$*"
-		for cmd in $commands ; do
-			if [ "$command" = "$cmd" ] ; then
-				return 0
-			fi
-			case "$cmd" in
-				start|stop|status|reload|restart|try-restart|force-reload)
-					;;
-				configtest)
-					has_configtest=yes
-					extra_commands="|$cmd"
-					;;
-				*)
-					extra_commands="|$cmd"
-					;;
-			esac
-		done
-	elif [ -n "$*" ] ; then
-		commands="$*"
-		local cmd
-		local found=0
-		# is there a better way
-		for cmd in $commands ; do
-			if [ "$command" = "$cmd" ] ; then
-				found=1
-				break;
-			fi
-		done
-		if [ $found = 0 ] ; then
-			# let the script handle it
-			return 0
-		fi
-	fi
-	case "$command" in
-		start)
-			upstart_start $name
-			exit $?
-			;;
-		stop)
-			upstart_stop $name
-			exit $?
-			;;
-		status)
-			upstart_status $name
-			exit $?
-			;;
-		restart)
-			if is_yes "$has_configtest" ; then
-				"$script" configtest || exit 1
-			fi
-			upstart_stop $name
-			upstart_start $name
-			exit $?
-			;;
-		try-restart)
-			if ! is_upstart_running "$name" ; then
-				exit 0
-			fi
-			if is_yes "$has_configtest" ; then
-				"$script" configtest || exit 1
-			fi
-			upstart_stop $name
-			upstart_start $name
-			exit $?
-			;;
-		reload)
-			if is_yes "$has_configtest" ; then
-				"$script" configtest || exit 1
-			fi
-			if is_upstart_task "$name" ; then
-				nls "$command not implemented for $name"
-				exit 3
-			else
-				upstart_reload "$name"
-				exit $?
-			fi
-			;;
-		force-reload)
-			if is_yes "$has_configtest" ; then
-				"$script" configtest || exit 1
-			fi
-			if is_upstart_task "$name" ; then
-				upstart_stop "$name"
-				upstart_start "$name"
-				exit $?
-			else
-				upstart_reload "$name"
-				exit $?
-			fi
-			;;
-		*)
-			msg_usage "$0 {start|stop|restart|reload|force-reload|status$extra_commands}"
-			exit 3
-			;;
-	esac
-	return 1 # should not happen
+	return 0
 }
-
-# Usage:
-#	somewhere at the begining of init script:
-#     upstart_controlled
-#		- to pass implement all upstart commands via initctl
-#                 start, stop, status, restart, reload and force_reload
-#		  are implemented
-#     upstart_controlled command...
-#		- to pass handle only specific commands the upstart way
-#                 and leave the rest to the script
-#
 alias upstart_controlled='_upstart_controlled $0 "$@"'
 
 rc_gettext_init
diff --git a/lib/functions.network b/lib/functions.network
index 0543059..a68ed76 100644
--- a/lib/functions.network
+++ b/lib/functions.network
@@ -348,7 +348,6 @@ set_up_loopback()
 		ip addr add 127.0.0.1/8 dev lo
 	fi
 	ip link set dev lo up
-	emit net-device-up IFACE=lo
 
 	grep -E "^(lo|any)[[:blank:]]" /etc/sysconfig/static-routes | while read device args; do
 		if [[ "$args" = *:* ]]; then
@@ -662,7 +661,6 @@ check_link_down ()
 
 	if ! LC_ALL=C ip link show dev $device 2>/dev/null | grep -Fq UP; then
 		ip link set dev $device up >/dev/null 2>&1
-		emit net-device-up IFACE=$device
 	fi
 	timeout=0
 	while [ $timeout -le $max_timeout ]; do
diff --git a/rc.d/init.d/allowlogin b/rc.d/init.d/allowlogin
index 561b282..dcd789e 100755
--- a/rc.d/init.d/allowlogin
+++ b/rc.d/init.d/allowlogin
@@ -23,8 +23,6 @@ esac
 # Source function library.
 . /etc/rc.d/init.d/functions
 
-upstart_controlled
-
 start() {
 	if is_yes "$DELAY_LOGIN" && [ -f /etc/nologin.boot ]; then
 		run_cmd "Allowing users to login" rm -f /etc/nologin /etc/nologin.boot
diff --git a/rc.d/init.d/local b/rc.d/init.d/local
index 09d0834..9ded073 100755
--- a/rc.d/init.d/local
+++ b/rc.d/init.d/local
@@ -11,8 +11,6 @@
 # Source function library.
 . /etc/rc.d/init.d/functions
 
-upstart_controlled
-
 # See how we were called.
 case "$1" in
   start)
diff --git a/rc.d/init.d/network b/rc.d/init.d/network
index cec759f..3592a2b 100755
--- a/rc.d/init.d/network
+++ b/rc.d/init.d/network
@@ -223,9 +223,6 @@ find_boot_interfaces() {
 }
 
 start() {
-	emit pld.network-starting
-	emit starting JOB=network
-
 	rc_splash "bootnetwork start"
 	network_init
 
@@ -249,13 +246,9 @@ start() {
 	network_postinit
 
 	touch /var/lock/subsys/network
-	emit --no-wait pld.network-started
-	emit --no-wait started JOB=network
 }
 
 stop() {
-	emit pld.network-stopping
-	emit stopping JOB=network
 	# If we go to runlevel 0, 1 or 6 then umount all network fs
 	if [ "$RUNLEVEL" = "6" -o "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "1" ]; then
 		if [ -x /etc/rc.d/init.d/netfs -a -f /var/lock/subsys/netfs ];
@@ -284,8 +277,6 @@ stop() {
 	network_deinit
 
 	rm -f /var/lock/subsys/network >/dev/null 2>&1
-	emit --no-wait pld.network-stopped
-	emit --no-wait stopped JOB=network
 }
 
 # Reload all active interfaces
@@ -366,11 +357,7 @@ find_boot_interfaces
 case "$1" in
   start)
 	if is_yes "$VSERVER_ISOLATION_NET"; then
-		emit pld.network-starting
-		emit starting JOB=network
 		touch /var/lock/subsys/network
-		emit pld.network-started
-		emit --no-wait started JOB=network
 	else
 		start
 	fi
@@ -388,11 +375,7 @@ case "$1" in
 	;;
   stop)
 	if is_yes "$VSERVER_ISOLATION_NET"; then
-		emit pld.network-stopping
-		emit stopping JOB=network
 		rm -f /var/lock/subsys/network >/dev/null 2>&1
-		emit pld.network-stopped
-		emit --no-wait stopped JOB=network
 	else
 		stop
 	fi
diff --git a/rc.d/init.d/random b/rc.d/init.d/random
index de45e1b..342dcdc 100755
--- a/rc.d/init.d/random
+++ b/rc.d/init.d/random
@@ -16,8 +16,6 @@ if is_yes "$VSERVER"; then
 	return
 fi
 
-upstart_controlled start stop
-
 random_seed=/var/run/random-seed
 
 poolfile=/proc/sys/kernel/random/poolsize
@@ -29,7 +27,6 @@ start() {
 		return
 	fi
 
-	emit starting JOB=random
 	show "Initializing random number generator"
 	busy
 	# Carry a random seed from start-up to start-up
@@ -43,7 +40,6 @@ start() {
 	touch /var/lock/subsys/random
 	deltext
 	ok
-	emit --nowait started JOB=random
 }
 
 stop() {
@@ -52,7 +48,6 @@ stop() {
 	fi
 
 	# Carry a random seed from shut-down to start-up
-	emit stopping JOB=random
 	show "Saving random seed"
 	busy
 	touch $random_seed
@@ -62,7 +57,6 @@ stop() {
 	rm -f /var/lock/subsys/random >/dev/null 2>&1
 	deltext
 	ok
-	emit --no-wait stopped JOB=random
 }
 
 status() {
diff --git a/rc.d/init.d/sys-chroots b/rc.d/init.d/sys-chroots
index 6737300..b6e88ef 100755
--- a/rc.d/init.d/sys-chroots
+++ b/rc.d/init.d/sys-chroots
@@ -28,8 +28,6 @@ export runlevel previous
 # Source function library.
 . /etc/rc.d/init.d/functions
 
-upstart_controlled
-
 start() {
 	if [ "$previous" = "N" ]; then
 		runlevel=5
diff --git a/rc.d/rc b/rc.d/rc
index 3a37334..eba0652 100755
--- a/rc.d/rc
+++ b/rc.d/rc
@@ -195,9 +195,6 @@ if [ -d /etc/rc.d/rc$runlevel.d ]; then
 		[ -f /var/lock/subsys/$subsys ] || \
 		[ -f /var/lock/subsys/${subsys}.init ] && continue
 
-		# Check if it is managed by upstart
-		use_upstart && [ -f /etc/init/${subsys}.conf ] && continue
-
 		# If we're in confirmation mode, get user confirmation
 		[ -n "$CONFIRM" ] &&
 		{
diff --git a/rc.d/rc.shutdown b/rc.d/rc.shutdown
index b374bc9..d86f962 100755
--- a/rc.d/rc.shutdown
+++ b/rc.d/rc.shutdown
@@ -19,10 +19,6 @@ IN_SHUTDOWN=yes
 trap "echo" INT SEGV QUIT TERM
 set +e
 
-emit pld.shutdown-started
-emit starting JOB=shutdown
-emit started JOB=shutdown
-
 rc_splash "reboot"
 
 # Kill all processes.
@@ -178,10 +174,6 @@ else
 	   	show "On the next boot fsck will be skipped."; ok
 	fi
 
-	# not really sure where thse events should go
-	emit stopped JOB=shutdown
-	emit stopping JOB=shutdown
-
 	if [ -x /sbin/kexec ] && [ "$kexec_loaded" = "1" ]; then
 	   	show "Will now restart with kexec"
 		/sbin/kexec -e
diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit
index 6da0575..975336f 100755
--- a/rc.d/rc.sysinit
+++ b/rc.d/rc.sysinit
@@ -57,10 +57,6 @@ parse_cmdline() {
 
 	for arg in $cmdline; do
 		case "$arg" in
-		pld.no-upstart)
-			# default is set in /etc/sysconfig/system or detected in init.d/functions
-			USE_UPSTART=no
-		;;
 		noudev)
 			# default is set in /etc/sysconfig/system
 			START_UDEV=no
@@ -490,7 +486,6 @@ if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
 		is_fsmounted devtmpfs /dev || mount -n -t devtmpfs devtmpfs /dev
 		load_kernel_modules modules.preudev
 		/sbin/start_udev
-		use_upstart && [ -x /sbin/initctl ] && /sbin/initctl -q start udev
 	elif [ -x /lib/firmware/firmware-loader.sh ]; then
 		/sbin/sysctl -q -e -w kernel.hotplug=/lib/firmware/firmware-loader.sh
 	fi
@@ -703,9 +698,6 @@ if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
 		mount -f -t selinuxfs selinuxfs /selinux 2> /dev/null
 	fi
 
-	emit --no-wait root-filesystem
-	emit --no-wait virtual-filesystems
-
 	if [ ! -f /proc/modules ]; then
 		USEMODULES=
 	elif [ -z "$nomodules" ]; then
@@ -781,16 +773,14 @@ if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
 	fi
 
 	# Load modules
-	if ! use_upstart; then
-		load_kernel_modules modules
-		for f in /etc/modules-load.d/*.conf; do
-			# already loaded by implicit "modules" load
-			[ "${f##*/}" = "modules.conf" ] && continue
-
-			[ -r $f ] || continue
-			load_kernel_modules ${f##/etc/}
-		done
-	fi
+	load_kernel_modules modules
+	for f in /etc/modules-load.d/*.conf; do
+		# already loaded by implicit "modules" load
+		[ "${f##*/}" = "modules.conf" ] && continue
+
+		[ -r $f ] || continue
+		load_kernel_modules ${f##/etc/}
+	done
 
 	if ! is_no "$DM_MULTIPATH" && [ -x /sbin/multipath ]; then
 		modprobe -s dm-mod
@@ -945,12 +935,6 @@ if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
 		run_cmd "Turning on quotas for local filesystems" /sbin/quotaon -aug
 	fi
 
-	emit --no-wait local-filesystems
-
-	# FIXME: this should be delayed until remote filesystems are mounted,
-	#        especialy when /usr or other standard fs is remote
-	emit --no-wait filesystem
-
 	# Turn on process accounting
 	if [ -x /etc/rc.d/rc.acct ]; then
 		/etc/rc.d/rc.acct start
@@ -977,11 +961,6 @@ if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
 	# ... and here finish configuring parameters
 	apply_sysctl
 else
-	emit --no-wait root-filesystem
-	emit --no-wait virtual-filesystems
-	emit --no-wait local-filesystems
-	emit --no-wait filesystem
-
 	# /var/log should be writable now, so start saving the boot output
 	if [ "$RC_BOOTLOG" ]; then
 		echo > /var/log/boot.log
@@ -1047,7 +1026,6 @@ is_yes "$SELINUX" && restorecon /tmp/.ICE-unix >/dev/null 2>&1
 
 if ! is_yes "$VSERVER"; then
 	enable_swap
-	emit --no-wait all-swaps
 
 	# If a SCSI tape has been detected, load the st module unconditionally
 	# since many SCSI tapes don't deal well with st being loaded and unloaded
@@ -1076,8 +1054,6 @@ if ! is_yes "$VSERVER"; then
 		i=$(($i-1))
 	done
 	cp -pf /var/log/dmesg /var/log/dmesg.0
-else
-	emit --no-wait all-swaps
 fi
 
 if ! is_no "$RC_PROMPT"; then
@@ -1101,6 +1077,3 @@ if ! is_no "$RC_PROMPT"; then
 	rm -f /var/run/getkey_done
 fi
 echo
-
-emit --no-wait pld.sysinit-done
-
diff --git a/service b/service
index 2d5a3e5..f882bdb 100755
--- a/service
+++ b/service
@@ -72,7 +72,7 @@ is_systemd_service() {
 }
 
 status_all() {
-	local SERVICE TYPE has_systemd has_upstart
+	local SERVICE TYPE has_systemd
 
 	if [ "$USE_SYSTEMD" != "no" ] && [ -x /bin/systemd_booted ] && /bin/systemd_booted; then
 		has_systemd=1
@@ -80,12 +80,6 @@ status_all() {
 		unset has_systemd
 	fi
 
-	if [ "$USE_UPSTART" != "no" ] && [ -x /sbin/initctl ]; then
-		has_upstart=1
-	else
-		unset has_upstart
-	fi
-
 	cd ${SERVICEDIR}
 	for SERVICE in *; do
 		case "${SERVICE}" in
@@ -97,9 +91,6 @@ status_all() {
 			if [ "$has_systemd" ] && [ -f /lib/systemd/system/${SERVICE}.service ]; then
 				# D for SystemD
 				TYPE='D'
-			elif [ "$has_upstart" ] && [ -f /etc/init/${SERVICE}.conf ]; then
-				# U for upstart
-				TYPE='U'
 			else
 				# S for SysVinit
 				TYPE='S'
@@ -108,7 +99,7 @@ status_all() {
 				printf " %s %-60s %s\n" "$TYPE:[?]" "$SERVICE:" "unknown"
 				continue
 			else
-				out=$(env -i USE_UPSTART=$USE_UPSTART LANG="$LANG" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" status 2>&1)
+				out=$(env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" status 2>&1)
 				if [ "$?" = "0" -a -n "$out" ]; then
 					printf " %s %-60s %s\n" "$TYPE:[+]" "$SERVICE:" "running"
 					continue
@@ -128,7 +119,6 @@ USAGE="Usage: $(basename $0) < option > | --status-all | \
 [ service_name [ command | --full-restart ] ]"
 
 SERVICE=
-USE_UPSTART=
 USE_SYSTEMD=
 
 if [ -d /etc/rc.d/init.d ]; then
@@ -161,14 +151,6 @@ while [ $# -gt 0 ]; do
 		export SYSTEMCTL_SKIP_REDIRECT=1
 		shift
 		;;
-	--upstart)
-		USE_UPSTART=yes
-		shift
-		;;
-	--no-upstart)
-		USE_UPSTART=no
-		shift
-		;;
 	--no-systemd)
 		USE_SYSTEMD=no
 		shift
@@ -180,8 +162,8 @@ while [ $# -gt 0 ]; do
 		elif [ $# -eq 2 -a "${2}" = "--full-restart" ]; then
 			SERVICE="${1}"
 			if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
-				env -i USE_UPSTART=$USE_UPSTART LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" stop
-				env -i USE_UPSTART=$USE_UPSTART LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" start
+				env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" stop
+				env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" start
 				exit $?
 			fi
 		elif [ -z "${SERVICE}" ]; then
@@ -200,7 +182,7 @@ if is_systemd_service "${SERVICE}" "${ACTION}"; then
 	echo >&2 "Redirecting to /bin/systemctl --output=cat ${ACTION} ${SERVICE}.service ${OPTIONS}"
 	exec /bin/systemctl --output=cat ${ACTION} ${SERVICE}.service ${OPTIONS}
 elif [ -x "${SERVICEDIR}/${SERVICE}" ]; then
-	exec env -i USE_UPSTART=$USE_UPSTART LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" ${ACTION} ${OPTIONS}
+	exec env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" ${ACTION} ${OPTIONS}
 else
 	echo "${SERVICE}: unrecognized service" >&2
 	exit 1
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/rc-scripts.git/commitdiff/1373b503f11c453f6786faeac25c36ac458bd9f4




More information about the pld-cvs-commit mailing list