Rename the rc binary to openrc
Debian requested this rename due to the "rc" binary conflicting with the "rc" binary from the plan 9 shell. We also add a deprecation warning to the binary when it is run as rc to encourage users to switch to openrc instead. X-Gentoo-Bug: 493958 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=493958
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
PROG=		rc
 | 
			
		||||
PROG=		openrc
 | 
			
		||||
SRCS=		checkpath.c fstabinfo.c mountinfo.c start-stop-daemon.c \
 | 
			
		||||
		rc-applets.c rc-depend.c rc-logger.c \
 | 
			
		||||
		rc-misc.c rc-plugin.c rc-service.c rc-status.c rc-update.c \
 | 
			
		||||
@@ -11,7 +11,7 @@ SBINDIR=	${PREFIX}/sbin
 | 
			
		||||
LINKDIR=	${LIBEXECDIR}
 | 
			
		||||
 | 
			
		||||
BINLINKS=	rc-status
 | 
			
		||||
SBINLINKS=	rc-service rc-update runscript service start-stop-daemon
 | 
			
		||||
SBINLINKS=	rc rc-service rc-update runscript service start-stop-daemon
 | 
			
		||||
RC_BINLINKS=	einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \
 | 
			
		||||
		eindent eoutdent esyslog eval_ecolors ewaitfile \
 | 
			
		||||
		veinfo vewarn vebegin veend vewend veindent veoutdent \
 | 
			
		||||
@@ -90,5 +90,5 @@ install: all
 | 
			
		||||
 | 
			
		||||
check test::
 | 
			
		||||
 | 
			
		||||
links: rc
 | 
			
		||||
	$(call make-links,${ALL_LINKS},rc,.)
 | 
			
		||||
links: $PROG
 | 
			
		||||
	$(call make-links,${ALL_LINKS},$PROG,.)
 | 
			
		||||
 
 | 
			
		||||
@@ -533,11 +533,18 @@ run_applets(int argc, char **argv)
 | 
			
		||||
{
 | 
			
		||||
	size_t i;
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * The "rc" applet is deprecated and should be referred to as
 | 
			
		||||
	 * "openrc", so output a warning.
 | 
			
		||||
	 */
 | 
			
		||||
	if (strcmp(applet, "rc") == 0)
 | 
			
		||||
		ewarn("The 'rc' applet is deprecated; please use 'openrc' instead.");
 | 
			
		||||
	/* Bug 351712: We need an extra way to explicitly select an applet OTHER
 | 
			
		||||
	 * than trusting argv[0], as argv[0] is not going to be the applet value if
 | 
			
		||||
	 * we are doing SELinux context switching. For this, we allow calls such as
 | 
			
		||||
	 * 'rc --applet APPLET', and shift ALL of argv down by two array items. */
 | 
			
		||||
	if (strcmp(applet, "rc") == 0 && argc >= 3 &&
 | 
			
		||||
	if ((strcmp(applet, "rc") == 0 || strcmp(applet, "openrc") == 0) &&
 | 
			
		||||
		argc >= 3 &&
 | 
			
		||||
		(strcmp(argv[1],"--applet") == 0 || strcmp(argv[1], "-a") == 0)) {
 | 
			
		||||
		applet = argv[2];
 | 
			
		||||
		argv += 2;
 | 
			
		||||
@@ -557,6 +564,6 @@ run_applets(int argc, char **argv)
 | 
			
		||||
	if (strncmp(applet, "mark_service_", strlen("mark_service_")) == 0)
 | 
			
		||||
		exit(do_mark_service(argc, argv));
 | 
			
		||||
 | 
			
		||||
	if (strcmp(applet, "rc") != 0)
 | 
			
		||||
	if (strcmp(applet, "rc") != 0 && strcmp(applet, "openrc") != 0)
 | 
			
		||||
		eerrorx("%s: unknown applet", applet);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -125,7 +125,7 @@ cleanup(void)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (!rc_in_logger && !rc_in_plugin &&
 | 
			
		||||
	    applet && strcmp(applet, "rc") == 0)
 | 
			
		||||
	    applet && (strcmp(applet, "rc") == 0 || strcmp(applet, "openrc") == 0))
 | 
			
		||||
	{
 | 
			
		||||
		if (hook_out)
 | 
			
		||||
			rc_plugin_run(hook_out, runlevel);
 | 
			
		||||
@@ -724,7 +724,7 @@ handle_bad_signal(int sig)
 | 
			
		||||
 | 
			
		||||
#include "_usage.h"
 | 
			
		||||
#define usagestring ""					\
 | 
			
		||||
    "Usage: rc [options] [<runlevel>]"
 | 
			
		||||
    "Usage: openrc [options] [<runlevel>]"
 | 
			
		||||
#define getoptstring "a:no:s:S" getoptstring_COMMON
 | 
			
		||||
static const struct option longopts[] = {
 | 
			
		||||
	{ "applet",   1, NULL, 'a' },
 | 
			
		||||
@@ -864,7 +864,7 @@ main(int argc, char **argv)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Enable logging */
 | 
			
		||||
	setenv("EINFO_LOG", "rc", 1);
 | 
			
		||||
	setenv("EINFO_LOG", "openrc", 1);
 | 
			
		||||
 | 
			
		||||
	/* Export our PID */
 | 
			
		||||
	snprintf(pidstr, sizeof(pidstr), "%d", getpid());
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user