We should use -feature instead of nofeature.
This matches the ifconfig and Gentoo USE flag syntax and is hopefully easier to read. Fixes #178.
This commit is contained in:
		| @@ -14,7 +14,7 @@ depend() | ||||
| 	use logger | ||||
| 	after bootmisc modules | ||||
| 	before dns dhcpcd net | ||||
| 	keyword noshutdown | ||||
| 	keyword -shutdown | ||||
| } | ||||
|  | ||||
| find_wireless() | ||||
|   | ||||
| @@ -22,7 +22,7 @@ depend() | ||||
| 	   [ "$clock" != "UTC" -a ! -e /etc/wall_cmos_clock ]; then | ||||
| 		need root | ||||
| 	fi | ||||
| 	keyword nojail noprefix | ||||
| 	keyword -jail -prefix | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -8,7 +8,7 @@ depend() | ||||
| 	need localmount | ||||
| 	before logger | ||||
| 	after clock sysctl | ||||
| 	keyword noprefix | ||||
| 	keyword -prefix | ||||
| } | ||||
|  | ||||
| dir_writeable() | ||||
|   | ||||
| @@ -8,7 +8,7 @@ depend() | ||||
| { | ||||
| 	need localmount termencoding | ||||
| 	after hotplug bootmisc | ||||
| 	keyword noopenvz noprefix nouml novserver noxenu | ||||
| 	keyword -openvz -prefix -uml -vserver -xenu | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -10,7 +10,7 @@ depend() { | ||||
| 	need localmount | ||||
| 	after bootmisc | ||||
| 	before net.lo0 | ||||
| 	keyword nojail noprefix | ||||
| 	keyword -jail -prefix | ||||
| } | ||||
|  | ||||
| start_pre() { | ||||
|   | ||||
| @@ -6,7 +6,7 @@ description="Mount system critical filesystems in /dev." | ||||
|  | ||||
| depend() { | ||||
| 	use dev | ||||
| 	keyword noprefix novserver | ||||
| 	keyword -prefix -vserver | ||||
| } | ||||
|  | ||||
| start() { | ||||
|   | ||||
| @@ -7,7 +7,7 @@ description="Set the dmesg level for a cleaner boot" | ||||
| depend() | ||||
| { | ||||
| 	before dev modules | ||||
| 	keyword novserver | ||||
| 	keyword -vserver | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -6,7 +6,7 @@ description="Configures a specific kernel dump device." | ||||
|  | ||||
| depend() { | ||||
| 	need swap | ||||
| 	keyword nojail noprefix | ||||
| 	keyword -jail -prefix | ||||
| } | ||||
|  | ||||
| start() { | ||||
|   | ||||
| @@ -9,7 +9,7 @@ _IFS=" | ||||
| depend() | ||||
| { | ||||
| 	use dev clock modules | ||||
| 	keyword nojail noopenvz noprefix notimeout novserver | ||||
| 	keyword -jail -openvz -prefix -timeout -vserver | ||||
| } | ||||
|  | ||||
| _abort() { | ||||
|   | ||||
| @@ -9,7 +9,7 @@ depend() | ||||
| { | ||||
| 	use root | ||||
| 	before devd net | ||||
| 	keyword nojail noprefix | ||||
| 	keyword -jail -prefix | ||||
| } | ||||
|  | ||||
| _set() | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| description="Sets the hostname of the machine." | ||||
|  | ||||
| depend() { | ||||
| 	keyword noprefix | ||||
| 	keyword -prefix | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -28,7 +28,7 @@ depend() | ||||
| 	else | ||||
| 		before * | ||||
| 	fi | ||||
| 	keyword noopenvz noprefix nouml novserver noxenu | ||||
| 	keyword -openvz -prefix -uml -vserver -xenu | ||||
| } | ||||
|  | ||||
| setupopts() | ||||
|   | ||||
| @@ -13,7 +13,7 @@ opts="panic showstatus" | ||||
| depend() { | ||||
| 	before net | ||||
| 	provide firewall | ||||
| 	keyword nojail | ||||
| 	keyword -jail | ||||
| } | ||||
|  | ||||
| ipfw() { | ||||
|   | ||||
| @@ -8,7 +8,7 @@ depend() | ||||
| { | ||||
| 	need localmount termencoding | ||||
| 	after bootmisc | ||||
| 	keyword noopenvz noprefix nouml novserver noxenu | ||||
| 	keyword -openvz -prefix -uml -vserver -xenu | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -6,7 +6,7 @@ description="Kill all processes so we can unmount disks cleanly." | ||||
|  | ||||
| depend() | ||||
| { | ||||
| 	keyword noprefix | ||||
| 	keyword -prefix | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -7,7 +7,7 @@ description="Executes user commands in /etc/conf.d/local" | ||||
| depend() | ||||
| { | ||||
| 	after * | ||||
| 	keyword notimeout | ||||
| 	keyword -timeout | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -8,7 +8,7 @@ depend() | ||||
| { | ||||
| 	need fsck | ||||
| 	use lvm modules mtab | ||||
| 	keyword nojail noopenvz noprefix novserver | ||||
| 	keyword -jail -openvz -prefix -vserver | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -7,7 +7,7 @@ extra_commands="restore" | ||||
| depend() | ||||
| { | ||||
| 	need localmount | ||||
| 	keyword nojail noprefix | ||||
| 	keyword -jail -prefix | ||||
| } | ||||
|  | ||||
| restore() | ||||
|   | ||||
| @@ -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() | ||||
|   | ||||
| @@ -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() | ||||
|   | ||||
| @@ -16,7 +16,7 @@ depend() | ||||
| { | ||||
| 	need localmount | ||||
| 	after bootmisc | ||||
| 	keyword nojail noprefix | ||||
| 	keyword -jail -prefix | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -7,7 +7,7 @@ description="Update /etc/mtab to match what the kernel knows about" | ||||
| depend() | ||||
| { | ||||
| 	need root | ||||
| 	keyword noprefix | ||||
| 	keyword -prefix | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -21,7 +21,7 @@ depend() | ||||
| 	need localmount | ||||
| 	after bootmisc | ||||
| 	provide net | ||||
| 	keyword nojail noprefix novserver | ||||
| 	keyword -jail -prefix -vserver | ||||
|  | ||||
| 	case "${IFACE}" in | ||||
| 		lo|lo0);; | ||||
|   | ||||
| @@ -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() | ||||
|   | ||||
| @@ -13,7 +13,7 @@ depend() | ||||
| 	need localmount | ||||
| 	after bootmisc | ||||
| 	provide net | ||||
| 	keyword nojail noprefix novserver | ||||
| 	keyword -jail -prefix -vserver | ||||
| } | ||||
|  | ||||
| uniqify() | ||||
|   | ||||
| @@ -7,7 +7,7 @@ required_files="/etc/newsyslog.conf" | ||||
| depend() | ||||
| { | ||||
| 	need localmount | ||||
| 	keyword noprefix | ||||
| 	keyword -prefix | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -9,7 +9,7 @@ ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} | ||||
| depend() | ||||
| { | ||||
| 	need localmount | ||||
| 	keyword noopenvz noprefix novserver | ||||
| 	keyword -openvz -prefix -vserver | ||||
| } | ||||
|  | ||||
| _setleds() | ||||
|   | ||||
| @@ -11,7 +11,7 @@ extra_started_commands="reload" | ||||
|  | ||||
| depend() { | ||||
| 	need localmount | ||||
| 	keyword nojail noprefix | ||||
| 	keyword -jail -prefix | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -12,7 +12,7 @@ depend() | ||||
| 	need localmount | ||||
| 	use logger | ||||
| 	after bootmisc | ||||
| 	keyword nojail noprefix | ||||
| 	keyword -jail -prefix | ||||
| } | ||||
|  | ||||
| start_pre() | ||||
|   | ||||
| @@ -8,7 +8,7 @@ depend() | ||||
| { | ||||
| 	use modules devfs | ||||
| 	need localmount | ||||
| 	keyword noopenvz noprefix novserver | ||||
| 	keyword -openvz -prefix -vserver | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -7,7 +7,7 @@ depend() | ||||
| 	need localmount net | ||||
| 	after * | ||||
| 	before local | ||||
| 	keyword noprefix | ||||
| 	keyword -prefix | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -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() | ||||
|   | ||||
| @@ -7,7 +7,7 @@ description="Saves a kernel dump." | ||||
| depend() | ||||
| { | ||||
| 	need localmount | ||||
| 	keyword nojail noprefix | ||||
| 	keyword -jail -prefix | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| depend() | ||||
| { | ||||
| 	before fsck | ||||
| 	keyword nojail noprefix | ||||
| 	keyword -jail -prefix | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| depend() | ||||
| { | ||||
| 	need localmount | ||||
| 	keyword nojail noopenvz noprefix novserver | ||||
| 	keyword -jail -openvz -prefix -vserver | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
|  | ||||
| depend() { | ||||
| 	need localmount | ||||
| 	keyword nojail noprefix | ||||
| 	keyword -jail -prefix | ||||
| } | ||||
|  | ||||
| start() { | ||||
|   | ||||
| @@ -6,7 +6,7 @@ depend() | ||||
| { | ||||
| 	use hostname | ||||
| 	before bootmisc logger | ||||
| 	keyword noprefix | ||||
| 	keyword -prefix | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -6,7 +6,7 @@ depend() | ||||
| { | ||||
| 	use hostname | ||||
| 	before bootmisc logger | ||||
| 	keyword noopenvz noprefix novserver | ||||
| 	keyword -openvz -prefix -vserver | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -6,7 +6,7 @@ description="Mount the sys filesystem." | ||||
|  | ||||
| depend() | ||||
| { | ||||
| 	keyword noprefix novserver | ||||
| 	keyword -prefix -vserver | ||||
| } | ||||
|  | ||||
| mount_sys() | ||||
|   | ||||
| @@ -16,5 +16,5 @@ depend() | ||||
| 	use net newsyslog | ||||
| 	need localmount | ||||
| 	after bootmisc | ||||
| 	keyword noprefix | ||||
| 	keyword -prefix | ||||
| } | ||||
|   | ||||
| @@ -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() | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| depend()  | ||||
| { | ||||
| 	after fsck | ||||
| 	keyword noprefix | ||||
| 	keyword -prefix | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -8,7 +8,7 @@ description="Initializes the random number generator." | ||||
| depend() | ||||
| { | ||||
| 	need localmount | ||||
| 	keyword nojail noprefix | ||||
| 	keyword -jail -prefix | ||||
| } | ||||
|  | ||||
| save_seed() | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| depend() | ||||
| { | ||||
| 	need localmount | ||||
| 	keyword noprefix | ||||
| 	keyword -prefix | ||||
| } | ||||
|  | ||||
| start() | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 */ | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user