From b4104957b198b38aba609ed3889e7fa605012d19 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Wed, 1 Jul 2009 00:07:32 +0100 Subject: [PATCH] We should use -feature instead of nofeature. This matches the ifconfig and Gentoo USE flag syntax and is hopefully easier to read. Fixes #178. --- init.d.misc/wpa_supplicant.in | 2 +- init.d/adjkerntz.in | 2 +- init.d/bootmisc.in | 2 +- init.d/consolefont.in | 2 +- init.d/devd.in | 2 +- init.d/devfs.in | 2 +- init.d/dmesg.in | 2 +- init.d/dumpon.in | 2 +- init.d/fsck.in | 2 +- init.d/hostid.in | 2 +- init.d/hostname.in | 2 +- init.d/hwclock.in | 2 +- init.d/ipfw.in | 2 +- init.d/keymaps.in | 2 +- init.d/killprocs.in | 2 +- init.d/local.in | 2 +- init.d/localmount.in | 2 +- init.d/mixer.in | 2 +- init.d/modules.in | 2 +- init.d/mount-ro.in | 2 +- init.d/moused.in | 2 +- init.d/mtab.in | 2 +- init.d/net.lo.in | 2 +- init.d/netmount.in | 2 +- init.d/network.in | 2 +- init.d/newsyslog.in | 2 +- init.d/numlock.in | 2 +- init.d/pf.in | 2 +- init.d/powerd.in | 2 +- init.d/procfs.in | 2 +- init.d/rc-enabled.in | 2 +- init.d/root.in | 2 +- init.d/savecore.in | 2 +- init.d/swap-blk.in | 2 +- init.d/swap.in | 2 +- init.d/syscons.in | 2 +- init.d/sysctl.BSD.in | 2 +- init.d/sysctl.Linux.in | 2 +- init.d/sysfs.in | 2 +- init.d/syslogd.in | 2 +- init.d/termencoding.in | 2 +- init.d/ttys.in | 2 +- init.d/urandom.in | 2 +- init.d/wscons.in | 2 +- man/runscript.8 | 30 +++++++++++++++--------------- src/librc/librc-depend.c | 23 ++++++++++++++++------- src/rc/rc.c | 7 +++++-- src/rc/runscript.c | 3 ++- 48 files changed, 82 insertions(+), 69 deletions(-) diff --git a/init.d.misc/wpa_supplicant.in b/init.d.misc/wpa_supplicant.in index 5a83ef16..f678d459 100644 --- a/init.d.misc/wpa_supplicant.in +++ b/init.d.misc/wpa_supplicant.in @@ -14,7 +14,7 @@ depend() use logger after bootmisc modules before dns dhcpcd net - keyword noshutdown + keyword -shutdown } find_wireless() diff --git a/init.d/adjkerntz.in b/init.d/adjkerntz.in index fa0ddf2a..ee09ac8d 100644 --- a/init.d/adjkerntz.in +++ b/init.d/adjkerntz.in @@ -22,7 +22,7 @@ depend() [ "$clock" != "UTC" -a ! -e /etc/wall_cmos_clock ]; then need root fi - keyword nojail noprefix + keyword -jail -prefix } start() diff --git a/init.d/bootmisc.in b/init.d/bootmisc.in index a6dcd227..88004342 100644 --- a/init.d/bootmisc.in +++ b/init.d/bootmisc.in @@ -8,7 +8,7 @@ depend() need localmount before logger after clock sysctl - keyword noprefix + keyword -prefix } dir_writeable() diff --git a/init.d/consolefont.in b/init.d/consolefont.in index ecd36660..ded9b4ea 100644 --- a/init.d/consolefont.in +++ b/init.d/consolefont.in @@ -8,7 +8,7 @@ depend() { need localmount termencoding after hotplug bootmisc - keyword noopenvz noprefix nouml novserver noxenu + keyword -openvz -prefix -uml -vserver -xenu } start() diff --git a/init.d/devd.in b/init.d/devd.in index c0fc0ef6..34fcd4b0 100644 --- a/init.d/devd.in +++ b/init.d/devd.in @@ -10,7 +10,7 @@ depend() { need localmount after bootmisc before net.lo0 - keyword nojail noprefix + keyword -jail -prefix } start_pre() { diff --git a/init.d/devfs.in b/init.d/devfs.in index 43ab0a76..91fd3dd0 100644 --- a/init.d/devfs.in +++ b/init.d/devfs.in @@ -6,7 +6,7 @@ description="Mount system critical filesystems in /dev." depend() { use dev - keyword noprefix novserver + keyword -prefix -vserver } start() { diff --git a/init.d/dmesg.in b/init.d/dmesg.in index bdef9be6..ee4367e8 100644 --- a/init.d/dmesg.in +++ b/init.d/dmesg.in @@ -7,7 +7,7 @@ description="Set the dmesg level for a cleaner boot" depend() { before dev modules - keyword novserver + keyword -vserver } start() diff --git a/init.d/dumpon.in b/init.d/dumpon.in index 48cb036a..35c166f5 100644 --- a/init.d/dumpon.in +++ b/init.d/dumpon.in @@ -6,7 +6,7 @@ description="Configures a specific kernel dump device." depend() { need swap - keyword nojail noprefix + keyword -jail -prefix } start() { diff --git a/init.d/fsck.in b/init.d/fsck.in index 66e58931..5990509c 100644 --- a/init.d/fsck.in +++ b/init.d/fsck.in @@ -9,7 +9,7 @@ _IFS=" depend() { use dev clock modules - keyword nojail noopenvz noprefix notimeout novserver + keyword -jail -openvz -prefix -timeout -vserver } _abort() { diff --git a/init.d/hostid.in b/init.d/hostid.in index d4a86581..26ea9d6a 100644 --- a/init.d/hostid.in +++ b/init.d/hostid.in @@ -9,7 +9,7 @@ depend() { use root before devd net - keyword nojail noprefix + keyword -jail -prefix } _set() diff --git a/init.d/hostname.in b/init.d/hostname.in index 5ace4dd4..a7c54c80 100644 --- a/init.d/hostname.in +++ b/init.d/hostname.in @@ -5,7 +5,7 @@ description="Sets the hostname of the machine." depend() { - keyword noprefix + keyword -prefix } start() diff --git a/init.d/hwclock.in b/init.d/hwclock.in index 3bb75a2d..ea9fa348 100644 --- a/init.d/hwclock.in +++ b/init.d/hwclock.in @@ -28,7 +28,7 @@ depend() else before * fi - keyword noopenvz noprefix nouml novserver noxenu + keyword -openvz -prefix -uml -vserver -xenu } setupopts() diff --git a/init.d/ipfw.in b/init.d/ipfw.in index 80623aa7..9d6faa4f 100644 --- a/init.d/ipfw.in +++ b/init.d/ipfw.in @@ -13,7 +13,7 @@ opts="panic showstatus" depend() { before net provide firewall - keyword nojail + keyword -jail } ipfw() { diff --git a/init.d/keymaps.in b/init.d/keymaps.in index 4af5f94a..55fd868a 100644 --- a/init.d/keymaps.in +++ b/init.d/keymaps.in @@ -8,7 +8,7 @@ depend() { need localmount termencoding after bootmisc - keyword noopenvz noprefix nouml novserver noxenu + keyword -openvz -prefix -uml -vserver -xenu } start() diff --git a/init.d/killprocs.in b/init.d/killprocs.in index 4d7dc69d..d12f0f64 100644 --- a/init.d/killprocs.in +++ b/init.d/killprocs.in @@ -6,7 +6,7 @@ description="Kill all processes so we can unmount disks cleanly." depend() { - keyword noprefix + keyword -prefix } start() diff --git a/init.d/local.in b/init.d/local.in index c74d9bf7..9ad045b9 100644 --- a/init.d/local.in +++ b/init.d/local.in @@ -7,7 +7,7 @@ description="Executes user commands in /etc/conf.d/local" depend() { after * - keyword notimeout + keyword -timeout } start() diff --git a/init.d/localmount.in b/init.d/localmount.in index 02268222..89a4801c 100644 --- a/init.d/localmount.in +++ b/init.d/localmount.in @@ -8,7 +8,7 @@ depend() { need fsck use lvm modules mtab - keyword nojail noopenvz noprefix novserver + keyword -jail -openvz -prefix -vserver } start() diff --git a/init.d/mixer.in b/init.d/mixer.in index baa265ac..6304ae16 100644 --- a/init.d/mixer.in +++ b/init.d/mixer.in @@ -7,7 +7,7 @@ extra_commands="restore" depend() { need localmount - keyword nojail noprefix + keyword -jail -prefix } restore() diff --git a/init.d/modules.in b/init.d/modules.in index e4de60b1..c2270ffd 100644 --- a/init.d/modules.in +++ b/init.d/modules.in @@ -7,7 +7,7 @@ description="Loads a user defined list of kernel modules." depend() { use isapnp - keyword noopenvz noprefix novserver + keyword -openvz -prefix -vserver } start() diff --git a/init.d/mount-ro.in b/init.d/mount-ro.in index c6275bb6..45e0fab4 100644 --- a/init.d/mount-ro.in +++ b/init.d/mount-ro.in @@ -7,7 +7,7 @@ description="Re-mount filesytems read-only for a clean reboot." depend() { need killprocs savecache - keyword noprefix noopenvz novserver + keyword -prefix -openvz -vserver } start() diff --git a/init.d/moused.in b/init.d/moused.in index 2cf2db40..a3622284 100644 --- a/init.d/moused.in +++ b/init.d/moused.in @@ -16,7 +16,7 @@ depend() { need localmount after bootmisc - keyword nojail noprefix + keyword -jail -prefix } start() diff --git a/init.d/mtab.in b/init.d/mtab.in index 76bda180..eb9744d6 100644 --- a/init.d/mtab.in +++ b/init.d/mtab.in @@ -7,7 +7,7 @@ description="Update /etc/mtab to match what the kernel knows about" depend() { need root - keyword noprefix + keyword -prefix } start() diff --git a/init.d/net.lo.in b/init.d/net.lo.in index e2ac4e18..24039878 100644 --- a/init.d/net.lo.in +++ b/init.d/net.lo.in @@ -21,7 +21,7 @@ depend() need localmount after bootmisc provide net - keyword nojail noprefix novserver + keyword -jail -prefix -vserver case "${IFACE}" in lo|lo0);; diff --git a/init.d/netmount.in b/init.d/netmount.in index 39f542a4..3af1ad6a 100644 --- a/init.d/netmount.in +++ b/init.d/netmount.in @@ -35,7 +35,7 @@ depend() need net $pmap use afc-client amd autofs openvpn use dns nfs nfsmount portmap rpcbind rpc.statd rpc.lockd - keyword nojail noprefix novserver + keyword -jail -prefix -vserver } start() diff --git a/init.d/network.in b/init.d/network.in index b8385b4f..8b02ac4c 100644 --- a/init.d/network.in +++ b/init.d/network.in @@ -13,7 +13,7 @@ depend() need localmount after bootmisc provide net - keyword nojail noprefix novserver + keyword -jail -prefix -vserver } uniqify() diff --git a/init.d/newsyslog.in b/init.d/newsyslog.in index 9e6868c9..964e219a 100644 --- a/init.d/newsyslog.in +++ b/init.d/newsyslog.in @@ -7,7 +7,7 @@ required_files="/etc/newsyslog.conf" depend() { need localmount - keyword noprefix + keyword -prefix } start() diff --git a/init.d/numlock.in b/init.d/numlock.in index 2dab970c..9d88fa08 100644 --- a/init.d/numlock.in +++ b/init.d/numlock.in @@ -9,7 +9,7 @@ ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} depend() { need localmount - keyword noopenvz noprefix novserver + keyword -openvz -prefix -vserver } _setleds() diff --git a/init.d/pf.in b/init.d/pf.in index 2edbbf13..15c9fc5d 100644 --- a/init.d/pf.in +++ b/init.d/pf.in @@ -11,7 +11,7 @@ extra_started_commands="reload" depend() { need localmount - keyword nojail noprefix + keyword -jail -prefix } start() diff --git a/init.d/powerd.in b/init.d/powerd.in index 40125123..6220c1bb 100644 --- a/init.d/powerd.in +++ b/init.d/powerd.in @@ -12,7 +12,7 @@ depend() need localmount use logger after bootmisc - keyword nojail noprefix + keyword -jail -prefix } start_pre() diff --git a/init.d/procfs.in b/init.d/procfs.in index fb7afabd..712adc23 100644 --- a/init.d/procfs.in +++ b/init.d/procfs.in @@ -8,7 +8,7 @@ depend() { use modules devfs need localmount - keyword noopenvz noprefix novserver + keyword -openvz -prefix -vserver } start() diff --git a/init.d/rc-enabled.in b/init.d/rc-enabled.in index fe991457..af212797 100644 --- a/init.d/rc-enabled.in +++ b/init.d/rc-enabled.in @@ -7,7 +7,7 @@ depend() need localmount net after * before local - keyword noprefix + keyword -prefix } start() diff --git a/init.d/root.in b/init.d/root.in index ae1536c1..6dc37c86 100644 --- a/init.d/root.in +++ b/init.d/root.in @@ -7,7 +7,7 @@ description="Mount the root fs read/write" depend() { need fsck - keyword nojail noopenvz noprefix novserver + keyword -jail -openvz -prefix -vserver } start() diff --git a/init.d/savecore.in b/init.d/savecore.in index 66e746ee..afe8ce71 100644 --- a/init.d/savecore.in +++ b/init.d/savecore.in @@ -7,7 +7,7 @@ description="Saves a kernel dump." depend() { need localmount - keyword nojail noprefix + keyword -jail -prefix } start() diff --git a/init.d/swap-blk.in b/init.d/swap-blk.in index a452268c..3c1c52cf 100644 --- a/init.d/swap-blk.in +++ b/init.d/swap-blk.in @@ -5,7 +5,7 @@ depend() { before fsck - keyword nojail noprefix + keyword -jail -prefix } start() diff --git a/init.d/swap.in b/init.d/swap.in index 00c9c6b6..564531ba 100644 --- a/init.d/swap.in +++ b/init.d/swap.in @@ -5,7 +5,7 @@ depend() { need localmount - keyword nojail noopenvz noprefix novserver + keyword -jail -openvz -prefix -vserver } start() diff --git a/init.d/syscons.in b/init.d/syscons.in index 824ce131..cb584b36 100644 --- a/init.d/syscons.in +++ b/init.d/syscons.in @@ -4,7 +4,7 @@ depend() { need localmount - keyword nojail noprefix + keyword -jail -prefix } start() { diff --git a/init.d/sysctl.BSD.in b/init.d/sysctl.BSD.in index ce7cff38..22b364b2 100644 --- a/init.d/sysctl.BSD.in +++ b/init.d/sysctl.BSD.in @@ -6,7 +6,7 @@ depend() { use hostname before bootmisc logger - keyword noprefix + keyword -prefix } start() diff --git a/init.d/sysctl.Linux.in b/init.d/sysctl.Linux.in index 80a38047..39ce01d6 100644 --- a/init.d/sysctl.Linux.in +++ b/init.d/sysctl.Linux.in @@ -6,7 +6,7 @@ depend() { use hostname before bootmisc logger - keyword noopenvz noprefix novserver + keyword -openvz -prefix -vserver } start() diff --git a/init.d/sysfs.in b/init.d/sysfs.in index 7faa983c..5355fb9c 100644 --- a/init.d/sysfs.in +++ b/init.d/sysfs.in @@ -6,7 +6,7 @@ description="Mount the sys filesystem." depend() { - keyword noprefix novserver + keyword -prefix -vserver } mount_sys() diff --git a/init.d/syslogd.in b/init.d/syslogd.in index 232c1e43..a4e4fc32 100644 --- a/init.d/syslogd.in +++ b/init.d/syslogd.in @@ -16,5 +16,5 @@ depend() use net newsyslog need localmount after bootmisc - keyword noprefix + keyword -prefix } diff --git a/init.d/termencoding.in b/init.d/termencoding.in index a2e6fcab..734d2206 100644 --- a/init.d/termencoding.in +++ b/init.d/termencoding.in @@ -9,7 +9,7 @@ ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} depend() { - keyword noopenvz noprefix nouml novserver noxenu + keyword -openvz -prefix -uml -vserver -xenu } start() diff --git a/init.d/ttys.in b/init.d/ttys.in index ddf8e7ab..178f182b 100644 --- a/init.d/ttys.in +++ b/init.d/ttys.in @@ -5,7 +5,7 @@ depend() { after fsck - keyword noprefix + keyword -prefix } start() diff --git a/init.d/urandom.in b/init.d/urandom.in index a2b8ac8d..28c5614e 100644 --- a/init.d/urandom.in +++ b/init.d/urandom.in @@ -8,7 +8,7 @@ description="Initializes the random number generator." depend() { need localmount - keyword nojail noprefix + keyword -jail -prefix } save_seed() diff --git a/init.d/wscons.in b/init.d/wscons.in index d77ebafc..3b18a24b 100644 --- a/init.d/wscons.in +++ b/init.d/wscons.in @@ -5,7 +5,7 @@ depend() { need localmount - keyword noprefix + keyword -prefix } start() diff --git a/man/runscript.8 b/man/runscript.8 index 2fa1c131..a3e1f2ec 100644 --- a/man/runscript.8 +++ b/man/runscript.8 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 30, 2009 +.Dd July 1, 2009 .Dt RUNSCRIPT 8 SMM .Os OpenRC .Sh NAME @@ -138,30 +138,30 @@ We should recalculate our dependencies if the listed files have changed. .It Ic keyword Tags a service with a keyword. Here's the keywords we currently understand:- .Bl -tag -width indent -.It Dv nojail +.It Dv -jail When in a jail, exclude this service from any dependencies. The service can still be run directly. -.It Dv noopenvz -Same as nojail, but for OpenVZ systems. -.It Dv noshutdown +.It Dv -openvz +Same as -jail, but for OpenVZ systems. +.It Dv -shutdown Don't stop this service when shutting the system down. This normally quite safe as remaining daemons will be sent a SIGTERM just before final shutdown. Network related services such as the network and dhcpcd init scripts normally have this keyword. -.It Dv nostop +.It Dv -stop Don't stop this service when changing runlevels, even if not present. This includes shutting the system down. -.It Dv notimeout +.It Dv -timeout Do not time out waiting for that service. -.It Dv nouml -Same as nojail, but for UML systems. -.It Dv novserver -Same as nojail, but for VServer systems. -.It Dv noxen0 -Same as nojail, but for Xen DOM0 systems. -.It Dv noxenu -Same as nojail, but for Xen DOMU systems. +.It Dv -uml +Same as -jail, but for UML systems. +.It Dv -vserver +Same as -jail, but for VServer systems. +.It Dv -xen0 +Same as -jail, but for Xen DOM0 systems. +.It Dv -xenu +Same as -jail, but for Xen DOMU systems. .El .El .Pp diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c index 97421fab..1fb6506c 100644 --- a/src/librc/librc-depend.c +++ b/src/librc/librc-depend.c @@ -738,7 +738,7 @@ rc_deptree_update(void) RC_STRING *s, *s2, *s2_np, *s3, *s4; char *line = NULL; size_t len = 0; - char *depend, *depends, *service, *type, *nosys; + char *depend, *depends, *service, *type, *nosys, *onosys; size_t i, k, l; bool retval = true; const char *sys = rc_sys(); @@ -841,17 +841,25 @@ rc_deptree_update(void) * work for them. This doesn't stop them from being run directly. */ if (sys) { len = strlen(sys); - nosys = xmalloc(len + 3); - nosys[0] = 'n'; - nosys[1] = 'o'; + nosys = xmalloc(len + 1); + nosys[0] = '-'; for (i = 0; i < len; i++) - nosys[i + 2] = (char)tolower((unsigned char)sys[i]); - nosys[i + 2] = '\0'; + nosys[i + 1] = (char)tolower((unsigned char)sys[i]); + nosys[i + 1] = '\0'; + + onosys = xmalloc(len + 3); + onosys[0] = 'n'; + onosys[1] = 'o'; + for (i = 0; i < len; i++) + onosys[i + 2] = (char)tolower((unsigned char)sys[i]); + onosys[i + 2] = '\0'; TAILQ_FOREACH_SAFE(depinfo, deptree, entries, depinfo_np) if ((deptype = get_deptype(depinfo, "keyword"))) TAILQ_FOREACH(s, deptype->services, entries) - if (strcmp(s->value, nosys) == 0) { + if (strcmp(s->value, nosys) == 0 || + strcmp(s->value, onosys) == 0) + { provide = get_deptype(depinfo, "iprovide"); TAILQ_REMOVE(deptree, depinfo, entries); TAILQ_FOREACH(di, deptree, entries) { @@ -870,6 +878,7 @@ rc_deptree_update(void) } } free(nosys); + free(onosys); } /* Phase 3 - add our providers to the tree */ diff --git a/src/rc/rc.c b/src/rc/rc.c index 3d8628e8..6d04b3dd 100644 --- a/src/rc/rc.c +++ b/src/rc/rc.c @@ -600,8 +600,11 @@ do_stop_services(const char *newlevel, bool parallel, bool going_down) continue; } kwords = rc_deptree_depend(deptree, service->value, "keyword"); - if (rc_stringlist_find(kwords, "nostop") || - (going_down && rc_stringlist_find(kwords, "noshutdown"))) + if (rc_stringlist_find(kwords, "-stop") || + rc_stringlist_find(kwords, "nostop") || + (going_down && + (rc_stringlist_find(kwords, "-shutdown") || + rc_stringlist_find(kwords, "noshutdown")))) nstop = true; else nstop = false; diff --git a/src/rc/runscript.c b/src/rc/runscript.c index 91a31a59..ca0d3252 100644 --- a/src/rc/runscript.c +++ b/src/rc/runscript.c @@ -471,7 +471,8 @@ svc_wait(const char *svc) /* Some services don't have a timeout, like fsck */ keywords = rc_deptree_depend(deptree, svc, "keyword"); - if (rc_stringlist_find(keywords, "notimeout")) + if (rc_stringlist_find(keywords, "-timeout") || + rc_stringlist_find(keywords, "notimeout")) forever = true; rc_stringlist_free(keywords);