Merge lp:~smoser/ubuntu/precise/sysvinit/rc.local.d into lp:ubuntu/precise/sysvinit

Proposed by Scott Moser
Status: Work in progress
Proposed branch: lp:~smoser/ubuntu/precise/sysvinit/rc.local.d
Merge into: lp:ubuntu/precise/sysvinit
Diff against target: 100 lines (+55/-0)
5 files modified
debian/changelog (+8/-0)
debian/initscripts.conffiles (+1/-0)
debian/initscripts.postinst (+1/-0)
debian/initscripts.postrm (+1/-0)
debian/src/initscripts/etc/init.d/rc.local.d (+44/-0)
To merge this branch: bzr merge lp:~smoser/ubuntu/precise/sysvinit/rc.local.d
Reviewer Review Type Date Requested Status
Scott Moser Needs Resubmitting
Clint Byrum (community) Needs Information
Ubuntu branches Pending
Review via email: mp+88323@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Scott Moser (smoser) wrote :

This adds an additional rc.sysv script named 'rc.local.d' which will executable programs in /etc/rc.local.d via run-parts.

If run-parts is not available, or the directory /etc/rc.local.d does not exist, it will exit silently with success.

Revision history for this message
Scott Moser (smoser) wrote :

2 other thoughts:
 * I chose adding rc.local.d versus modifying /etc/init.d/rc.local to add 'rc.local.d' support, because I felt that would have been more difficult to reliably detect if rc.local.d support was present. This seems less surprising.
 * I had implemented this as an upstart job also, but felt sysv script fit better with the 'initscripts' package, which is where rc.local was provided.

Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Scott this is pretty cool! However, I actually think rc.local *should* be moved to be run by an upstart job rather than rc2.d links. It should be:

# /etc/init/rc-local.conf
start on stopped rc RUNLEVEL=[2345]
task

description "/etc/rc.local"

exec /etc/rc.local start

This would put it pretty much as late as possible in the boot, though it still does not address the fact that some things may be starting in parallel still if they have something like:

start on runlevel [2345]

But that is an issue with the current one as well.

Anyway, that should become part of upstart, and then the update-rc.d removed from initscripts. Then your job gets simpler:

# /etc/init/rc-local-d.conf
start on stopped rc-local
task

description "local boot scripts (/etc/rc.local.d)"

pre-start script
  [ -d /etc/rc.local.d ] || stop
  command -v run-parts >/dev/null 2>&1 || stop
end script

exec run-parts /etc/rc.local.d

I like the idea of having two separate jobs because the user will get messages in noquiet boot (default for servers) that show

* Starting /etc/rc.local
* Stopping /etc/rc.local
* Starting local boot scripts (/etc/rc.local.d)
* Stopping local boot scripts (/etc/rc.local.d)

Would you be willing to move it over to upstart?

review: Needs Information
Revision history for this message
Scott Moser (smoser) wrote :

>
> I like the idea of having two separate jobs because the user will get messages
> in noquiet boot (default for servers) that show
>
> * Starting /etc/rc.local
> * Stopping /etc/rc.local
> * Starting local boot scripts (/etc/rc.local.d)
> * Stopping local boot scripts (/etc/rc.local.d)
>
> Would you be willing to move it over to upstart?

I have no objections to rc.local being a upstart job, but having the "sysvinit" package lay down a upstart job just seems strange at best to me. Thats why I stuck with sysvinit style start script.

If we think that rc.local should be an upstart job (and then, rc.local.d following that), I think thats a different bug. I really don't have a strong feeling.

review: Needs Resubmitting
Revision history for this message
Scott Moser (smoser) wrote :

I've updated bug 915215 in comment 7 with a summary of the state of this bug/feature.

Unmerged revisions

168. By Scott Moser

d/src/initscripts/etc/init.d/rc.local.d: add rc.local.d
sysv-init script for executing things in /etc/rc.local.d
in run-parts style (LP: #915215)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-12-13 00:16:41 +0000
3+++ debian/changelog 2012-01-30 16:08:24 +0000
4@@ -1,3 +1,11 @@
5+sysvinit (2.88dsf-13.10ubuntu9) UNRELEASED; urgency=low
6+
7+ * d/src/initscripts/etc/init.d/rc.local.d: add rc.local.d
8+ sysv-init script for executing things in /etc/rc.local.d
9+ in run-parts style (LP: #915215)
10+
11+ -- Scott Moser <smoser@ubuntu.com> Mon, 30 Jan 2012 10:22:53 -0500
12+
13 sysvinit (2.88dsf-13.10ubuntu8) precise; urgency=low
14
15 * d/src/initscripts/etc/init.d/sendsigs: wait up to 300 extra
16
17=== modified file 'debian/initscripts.conffiles'
18--- debian/initscripts.conffiles 2011-07-12 17:08:08 +0000
19+++ debian/initscripts.conffiles 2012-01-30 16:08:24 +0000
20@@ -5,6 +5,7 @@
21 /etc/init.d/killprocs
22 /etc/init.d/ondemand
23 /etc/init.d/rc.local
24+/etc/init.d/rc.local.d
25 /etc/init.d/reboot
26 /etc/init.d/sendsigs
27 /etc/init.d/single
28
29=== modified file 'debian/initscripts.postinst'
30--- debian/initscripts.postinst 2011-07-13 20:44:04 +0000
31+++ debian/initscripts.postinst 2012-01-30 16:08:24 +0000
32@@ -181,6 +181,7 @@
33 update-rc.d single start 90 1 . >/dev/null || exit $?
34 update-rc.d ondemand start 99 2 3 4 5 . >/dev/null || exit $?
35 update-rc.d rc.local start 99 2 3 4 5 . >/dev/null || exit $?
36+update-rc.d rc.local.d start 99 2 3 4 5 . >/dev/null || exit $?
37 #update-rc.d stop-bootlogd-single start 99 S . >/dev/null || exit $?
38 #update-rc.d stop-bootlogd start 99 2 3 4 5 . >/dev/null || exit $?
39
40
41=== modified file 'debian/initscripts.postrm'
42--- debian/initscripts.postrm 2011-07-12 07:41:11 +0000
43+++ debian/initscripts.postrm 2012-01-30 16:08:24 +0000
44@@ -49,6 +49,7 @@
45 update-rc.d stop-bootlogd remove >/dev/null || exit $?
46 update-rc.d stop-bootlogd-single remove >/dev/null || exit $?
47 update-rc.d rc.local remove >/dev/null || exit $?
48+ update-rc.d rc.local.d remove >/dev/null || exit $?
49 update-rc.d single remove >/dev/null || exit $?
50 update-rc.d killprocs remove >/dev/null || exit $?
51 update-rc.d sendsigs remove >/dev/null || exit $?
52
53=== added file 'debian/src/initscripts/etc/init.d/rc.local.d'
54--- debian/src/initscripts/etc/init.d/rc.local.d 1970-01-01 00:00:00 +0000
55+++ debian/src/initscripts/etc/init.d/rc.local.d 2012-01-30 16:08:24 +0000
56@@ -0,0 +1,44 @@
57+#! /bin/sh
58+### BEGIN INIT INFO
59+# Provides: rc.local.d
60+# Required-Start: $remote_fs $syslog $all
61+# Required-Stop:
62+# Default-Start: 2 3 4 5
63+# Default-Stop:
64+# Short-Description: Run files in /etc/rc.local.d if they exist
65+### END INIT INFO
66+
67+
68+PATH=/sbin:/usr/sbin:/bin:/usr/bin
69+
70+. /lib/init/vars.sh
71+. /lib/lsb/init-functions
72+
73+do_start() {
74+ if [ -d /etc/rc.local.d ] && command -v run-parts >/dev/null; then
75+ [ "$VERBOSE" != no ] &&
76+ log_begin_msg "Running local boot scripts (/etc/rc.local.d)"
77+ run-parts /etc/rc.local.d
78+ ES=$?
79+ [ "$VERBOSE" != no ] && log_end_msg $ES
80+ return $ES
81+ fi
82+}
83+
84+case "$1" in
85+ start)
86+ do_start
87+ ;;
88+ restart|reload|force-reload)
89+ echo "Error: argument '$1' not supported" >&2
90+ exit 3
91+ ;;
92+ stop)
93+ ;;
94+ *)
95+ echo "Usage: $0 start|stop" >&2
96+ exit 3
97+ ;;
98+esac
99+
100+# vi: ts=4 syntax=sh noexpandtab

Subscribers

People subscribed via source and target branches

to all changes: