Split our rc commands out into general use vs service commands
This commit is contained in:
		
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							@@ -56,6 +56,8 @@ install::
 | 
				
			|||||||
	if test $(LIB) != "lib" ; then \
 | 
						if test $(LIB) != "lib" ; then \
 | 
				
			||||||
		sed -i'.bak' -e 's,/lib/,/$(LIB)/,g' $(DESTDIR)/$(RC_LIB)/sh/functions.sh || exit $$? ; \
 | 
							sed -i'.bak' -e 's,/lib/,/$(LIB)/,g' $(DESTDIR)/$(RC_LIB)/sh/functions.sh || exit $$? ; \
 | 
				
			||||||
		rm -f $(DESTDIR)/$(RC_LIB)/sh/functions.sh.bak ; \
 | 
							rm -f $(DESTDIR)/$(RC_LIB)/sh/functions.sh.bak ; \
 | 
				
			||||||
 | 
							sed -i'.bak' -e 's,/lib/,/$(LIB)/,g' $(DESTDIR)/$(RC_LIB)/sh/rc-functions.sh || exit $$? ; \
 | 
				
			||||||
 | 
							rm -f $(DESTDIR)/$(RC_LIB)/sh/rc-functions.sh.bak ; \
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
layout:
 | 
					layout:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -59,4 +59,10 @@ get_bootparam() {
 | 
				
			|||||||
	return 1
 | 
						return 1
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Add our sbin to $PATH
 | 
				
			||||||
 | 
					case "${PATH}" in
 | 
				
			||||||
 | 
						/lib/rc/sbin|/lib/rc/sbin:*) ;;
 | 
				
			||||||
 | 
						*) export PATH="/lib/rc/sbin:${PATH}" ;;
 | 
				
			||||||
 | 
					esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# vim: set ts=4 :
 | 
					# vim: set ts=4 :
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										37
									
								
								src/Makefile
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								src/Makefile
									
									
									
									
									
								
							@@ -65,22 +65,23 @@ LIB_TARGETS = $(LIBEINFOSO) $(LIBRCSO)
 | 
				
			|||||||
SBIN_TARGETS = rc
 | 
					SBIN_TARGETS = rc
 | 
				
			||||||
SYS_WHITELIST = env_whitelist
 | 
					SYS_WHITELIST = env_whitelist
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TARGET = $(LIB_TARGETS) $(BIN_TARGETS) $(SBIN_TARGETS) $(PRIV_BIN_TARGETS)
 | 
					TARGET = $(LIB_TARGETS) $(BIN_TARGETS) $(SBIN_TARGETS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RCLINKS = einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \
 | 
					RC_BINLINKS = einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \
 | 
				
			||||||
	      eindent eoutdent esyslog eval_ecolors \
 | 
								  eindent eoutdent esyslog eval_ecolors \
 | 
				
			||||||
	      veinfo vewarn vebegin veend vewend veindent veoutdent \
 | 
								  veinfo vewarn vebegin veend vewend veindent veoutdent \
 | 
				
			||||||
	      service_starting service_inactive service_started \
 | 
								  service_starting service_inactive service_started \
 | 
				
			||||||
	      service_stopping service_stopped \
 | 
								  service_stopping service_stopped \
 | 
				
			||||||
	      service_inactive service_wasinactive \
 | 
								  service_inactive service_wasinactive \
 | 
				
			||||||
	      service_coldplugged \
 | 
								  service_coldplugged \
 | 
				
			||||||
	      mark_service_starting mark_service_inactive mark_service_started \
 | 
								  is_runlevel_start is_runlevel_stop service_started_daemon \
 | 
				
			||||||
	      mark_service_stopping mark_service_stopped \
 | 
								  checkown fstabinfo mountinfo rc-depend
 | 
				
			||||||
	      mark_service_inactive mark_service_wasinactive \
 | 
					RC_SBINLINKS =  mark_service_starting mark_service_inactive \
 | 
				
			||||||
	      mark_service_coldplugged \
 | 
									mark_service_started \
 | 
				
			||||||
	      get_options save_options rc-abort rc-depend \
 | 
									mark_service_stopping mark_service_stopped \
 | 
				
			||||||
	      is_runlevel_start is_runlevel_stop service_started_daemon \
 | 
									mark_service_inactive mark_service_wasinactive \
 | 
				
			||||||
		  checkown fstabinfo mountinfo
 | 
									mark_service_coldplugged \
 | 
				
			||||||
 | 
									get_options save_options rc-abort
 | 
				
			||||||
BINLINKS = rc-status
 | 
					BINLINKS = rc-status
 | 
				
			||||||
SBINLINKS = env-update rc-update runscript start-stop-daemon
 | 
					SBINLINKS = env-update rc-update runscript start-stop-daemon
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -122,7 +123,7 @@ rc: $(LIBEINFOSO) $(LIBRCSO) $(RCOBJS)
 | 
				
			|||||||
	$(CC) $(LDFLAGS) -o rc $(RCOBJS) $(LDLIBS) $(LDLIBS_RC)
 | 
						$(CC) $(LDFLAGS) -o rc $(RCOBJS) $(LDLIBS) $(LDLIBS_RC)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
links: rc
 | 
					links: rc
 | 
				
			||||||
	for x in $(BINLINKS) $(SBINLINKS) $(RCLINKS) $(RCPRIVLINKS); do ln -sf rc $$x; done
 | 
						for x in $(BINLINKS) $(SBINLINKS) $(RC_BINLINKS) $(RC_SBINLINKS); do ln -sf rc $$x; done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
install: $(TARGET)
 | 
					install: $(TARGET)
 | 
				
			||||||
	install -m 0755 -d $(DESTDIR)/$(LIB)
 | 
						install -m 0755 -d $(DESTDIR)/$(LIB)
 | 
				
			||||||
@@ -138,9 +139,11 @@ install: $(TARGET)
 | 
				
			|||||||
	install -m 0755 -d $(DESTDIR)/$(RC_LIB)/conf.d
 | 
						install -m 0755 -d $(DESTDIR)/$(RC_LIB)/conf.d
 | 
				
			||||||
	install -m 0644 $(SYS_WHITELIST) $(DESTDIR)/$(RC_LIB)/conf.d
 | 
						install -m 0644 $(SYS_WHITELIST) $(DESTDIR)/$(RC_LIB)/conf.d
 | 
				
			||||||
	install -m 0755 -d $(DESTDIR)/$(RC_LIB)/bin
 | 
						install -m 0755 -d $(DESTDIR)/$(RC_LIB)/bin
 | 
				
			||||||
 | 
						install -m 0755 -d $(DESTDIR)/$(RC_LIB)/sbin
 | 
				
			||||||
	for x in $(BINLINKS); do ln -sf ../sbin/rc $(DESTDIR)/bin/$$x; done
 | 
						for x in $(BINLINKS); do ln -sf ../sbin/rc $(DESTDIR)/bin/$$x; done
 | 
				
			||||||
	for x in $(SBINLINKS); do ln -sf rc $(DESTDIR)/sbin/$$x; done
 | 
						for x in $(SBINLINKS); do ln -sf rc $(DESTDIR)/sbin/$$x; done
 | 
				
			||||||
	for x in $(RCLINKS); do ln -sf ../../../sbin/rc $(DESTDIR)/$(RC_LIB)/bin/$$x; done
 | 
						for x in $(RC_BINLINKS); do ln -sf ../../../sbin/rc $(DESTDIR)/$(RC_LIB)/bin/$$x; done
 | 
				
			||||||
 | 
						for x in $(RC_SBINLINKS); do ln -sf ../../../sbin/rc $(DESTDIR)/$(RC_LIB)/sbin/$$x; done
 | 
				
			||||||
	if test "$(PAM)" = "pam" ; then \
 | 
						if test "$(PAM)" = "pam" ; then \
 | 
				
			||||||
		install -m 0755 -d $(DESTDIR)/etc/pam.d ; \
 | 
							install -m 0755 -d $(DESTDIR)/etc/pam.d ; \
 | 
				
			||||||
		install -m 0644 start-stop-daemon.pam $(DESTDIR)/etc/pam.d/start-stop-daemon ; \
 | 
							install -m 0644 start-stop-daemon.pam $(DESTDIR)/etc/pam.d/start-stop-daemon ; \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -860,24 +860,38 @@ int start_stop_daemon (int argc, char **argv)
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* Clean the environment of any RC_ variables */
 | 
							/* Clean the environment of any RC_ variables */
 | 
				
			||||||
		STRLIST_FOREACH (environ, env, i)
 | 
							STRLIST_FOREACH (environ, env, i) {
 | 
				
			||||||
			if (env && strncmp (env, "RC_", 3) != 0) {
 | 
								if (strncmp (env, "RC_", 3) == 0 ||
 | 
				
			||||||
				/* For the path r, remove the rcscript bin dir from it */
 | 
									strncmp (env, "SSD_NICELEVEL=", strlen ("SSD_NICELEVEL=")) == 0)
 | 
				
			||||||
				if (strncmp (env, "PATH=" RC_LIBDIR "/bin:",
 | 
									continue;
 | 
				
			||||||
							 strlen ("PATH=" RC_LIBDIR "/bin:")) == 0)
 | 
					
 | 
				
			||||||
				{
 | 
								/* For the path, remove the rcscript bin dir from it */
 | 
				
			||||||
					char *path = env;
 | 
								if (strncmp (env, "PATH=", 5) == 0) {
 | 
				
			||||||
					char *newpath;
 | 
									char *path = rc_xstrdup (env);
 | 
				
			||||||
					int len;
 | 
									char *newpath = NULL;
 | 
				
			||||||
					path += strlen ("PATH=" RC_LIBDIR "/bin:");
 | 
									char *p = path;
 | 
				
			||||||
					len = sizeof (char *) * strlen (path) + 6;
 | 
									char *token;
 | 
				
			||||||
					newpath = rc_xmalloc (len);
 | 
					
 | 
				
			||||||
					snprintf (newpath, len, "PATH=%s", path);
 | 
									p += 5;
 | 
				
			||||||
					rc_strlist_add (&newenv, newpath);
 | 
									while ((token = strsep (&p, ":"))) {
 | 
				
			||||||
					free (newpath);
 | 
										if (strcmp (token, RC_LIBDIR "/bin") == 0 ||
 | 
				
			||||||
				} else
 | 
											strcmp (token, RC_LIBDIR "/sbin") == 0)
 | 
				
			||||||
					rc_strlist_add (&newenv, env);
 | 
											continue;
 | 
				
			||||||
			}
 | 
										
 | 
				
			||||||
 | 
										if (newpath)
 | 
				
			||||||
 | 
											asprintf (&newpath, "%s:%s", newpath, token);
 | 
				
			||||||
 | 
										else
 | 
				
			||||||
 | 
											asprintf (&newpath, "PATH=%s", token);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									rc_strlist_add (&newenv, newpath);
 | 
				
			||||||
 | 
									free (path);
 | 
				
			||||||
 | 
									free (newpath);
 | 
				
			||||||
 | 
								} else
 | 
				
			||||||
 | 
									rc_strlist_add (&newenv, env);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							STRLIST_FOREACH (newenv, env, i)
 | 
				
			||||||
 | 
								einfo ("env %s", env);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		umask (022);
 | 
							umask (022);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user