From 7b5fa011ac7a9544fe68a9abb2f8ef940d9845f7 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Wed, 11 Dec 2013 17:39:38 -0600 Subject: [PATCH] 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 --- README | 5 +++++ man/Makefile | 2 +- man/{rc.8 => openrc.8} | 4 ++-- man/rc-service.8 | 2 +- man/rc-status.8 | 2 +- man/rc-update.8 | 2 +- man/rc_plugin_hook.3 | 2 +- man/runscript.8 | 4 ++-- sh/init-common-post.sh.in | 2 +- sh/init.sh.Linux.in | 2 +- src/rc/Makefile | 8 ++++---- src/rc/rc-applets.c | 11 +++++++++-- src/rc/rc.c | 6 +++--- support/sysvinit/inittab | 20 ++++++++++---------- 14 files changed, 42 insertions(+), 30 deletions(-) rename man/{rc.8 => openrc.8} (99%) diff --git a/README b/README index e42071d3..53408c36 100644 --- a/README +++ b/README @@ -61,6 +61,11 @@ As of OpenRC-0.12, the net.* scripts, originally from Gentoo Linux, have been removed. If you need these scripts, look for a package called netifrc, which is maintained by them. +As of OpenRC-0.13, the /sbin/rc binary has been renamed /sbin/openrc. +There is a /sbin/rc symbolic link in place currently in case you are +still using the old name. However, it is strongly advised that you +migrate your system to the new name. + Reporting Bugs -------------- Since Gentoo Linux is hosting OpenRC development, Bugs should go to diff --git a/man/Makefile b/man/Makefile index 4110c8f7..04862da2 100644 --- a/man/Makefile +++ b/man/Makefile @@ -1,7 +1,7 @@ MAN3= einfo.3 \ rc_config.3 rc_deptree.3 rc_find_pids.3 rc_plugin_hook.3 \ rc_runlevel.3 rc_service.3 rc_stringlist.3 -MAN8= rc-service.8 rc-status.8 rc-update.8 rc.8 runscript.8 \ +MAN8= rc-service.8 rc-status.8 rc-update.8 openrc.8 runscript.8 \ service.8 start-stop-daemon.8 # Handy macro to create symlinks diff --git a/man/rc.8 b/man/openrc.8 similarity index 99% rename from man/rc.8 rename to man/openrc.8 index dd457888..35e21a74 100644 --- a/man/rc.8 +++ b/man/openrc.8 @@ -22,10 +22,10 @@ .\" SUCH DAMAGE. .\" .Dd May 2, 2009 -.Dt RC 8 SMM +.Dt OPENRC 8 SMM .Os OpenRC .Sh NAME -.Nm rc +.Nm openrc .Nd stops and starts services for the specified runlevel .Sh SYNOPSIS .Nm diff --git a/man/rc-service.8 b/man/rc-service.8 index c40c7478..5ed5ce5c 100644 --- a/man/rc-service.8 +++ b/man/rc-service.8 @@ -63,7 +63,7 @@ otherwise -1. .Fl r , -resolve does the same and also prints the full path of the service to stdout. .Sh SEE ALSO -.Xr rc 8 , +.Xr openrc 8 , .Xr stdout 3 .Sh AUTHORS .An Roy Marples diff --git a/man/rc-status.8 b/man/rc-status.8 index 90f26038..48f51a35 100644 --- a/man/rc-status.8 +++ b/man/rc-status.8 @@ -66,7 +66,7 @@ exits 0, except when checking for crashed services and it doesn't find any. tries to list services within each runlevel in the presently resolved dependency order if the dependency tree is available. .Sh SEE ALSO -.Xr rc 8 , +.Xr openrc 8 , .Xr rc-update 8 .Sh AUTHORS .An Roy Marples diff --git a/man/rc-update.8 b/man/rc-update.8 index 088b5fea..459f0693 100644 --- a/man/rc-update.8 +++ b/man/rc-update.8 @@ -86,7 +86,7 @@ If the option is given then we either add or remove the runlevel from the runlevel. This allows inheritance of runlevels. .Sh SEE ALSO -.Xr rc 8 , +.Xr openrc 8 , .Xr rc-status 8 .Sh AUTHORS .An Roy Marples diff --git a/man/rc_plugin_hook.3 b/man/rc_plugin_hook.3 index ab83b4c2..22a1c589 100644 --- a/man/rc_plugin_hook.3 +++ b/man/rc_plugin_hook.3 @@ -44,7 +44,7 @@ is set to the name of the runlevel or name of the service. Plugins can affect the parent environment by writing NULL separated strings to .Va rc_environ_fd . .Sh SEE ALSO -.Xr rc 8 , +.Xr openrc 8 , .Xr runscript 8 .Sh AUTHORS .An Roy Marples diff --git a/man/runscript.8 b/man/runscript.8 index 7a0b79ed..e0d7cf02 100644 --- a/man/runscript.8 +++ b/man/runscript.8 @@ -343,7 +343,7 @@ sets the following environment variables for use in the service scripts: .It Va RC_SVCNAME Name of the service. .It Va RC_RUNLEVEL -Current runlevel that rc is in. Note that, in OpenRC, the reboot +Current runlevel that OpenRC is in. Note that, in OpenRC, the reboot runlevel is mapped to the shutdown runlevel. This was done because most services do not need to know if a system is shutting down or rebooting. If you are writing a service that does need to know this, see the @@ -536,7 +536,7 @@ Instead we return 1 to be compliant with Gentoo baselayout. Users are encouraged to use the is_newer_than function which returns correctly. .Sh SEE ALSO .Xr einfo 3 , -.Xr rc 8 , +.Xr openrc 8 , .Xr rc-status 8 , .Xr rc-update 8 , .Xr rc_plugin_hook 3 , diff --git a/sh/init-common-post.sh.in b/sh/init-common-post.sh.in index 6001fe9c..96eeeeef 100644 --- a/sh/init-common-post.sh.in +++ b/sh/init-common-post.sh.in @@ -6,7 +6,7 @@ # the old service state data : ${RC_LIBEXECDIR:=@LIBEXECDIR@} : ${RC_SVCDIR:=@LIBEXECDIR@/init.d} -case "$(rc --sys)" in +case "$(openrc --sys)" in OPENVZ|VSERVER) rm -rf "$RC_SVCDIR"/*;; *) if mountinfo --quiet "$RC_SVCDIR"; then rm -rf "$RC_SVCDIR"/* diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in index 09bcbdb6..9054978a 100644 --- a/sh/init.sh.Linux.in +++ b/sh/init.sh.Linux.in @@ -37,7 +37,7 @@ fi # /run is a new directory for storing volatile runtime data. # Read more about /run at https://lwn.net/Articles/436012 -sys="$(rc --sys)" +sys="$(openrc --sys)" if [ ! -d /run ]; then if [ "$sys" = VSERVER ]; then diff --git a/src/rc/Makefile b/src/rc/Makefile index a2e638e8..209523ab 100644 --- a/src/rc/Makefile +++ b/src/rc/Makefile @@ -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,.) diff --git a/src/rc/rc-applets.c b/src/rc/rc-applets.c index 64b6e888..8431eea3 100644 --- a/src/rc/rc-applets.c +++ b/src/rc/rc-applets.c @@ -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); } diff --git a/src/rc/rc.c b/src/rc/rc.c index c1c1629a..136e8fa8 100644 --- a/src/rc/rc.c +++ b/src/rc/rc.c @@ -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] []" + "Usage: openrc [options] []" #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()); diff --git a/support/sysvinit/inittab b/support/sysvinit/inittab index df7be790..25790970 100644 --- a/support/sysvinit/inittab +++ b/support/sysvinit/inittab @@ -5,24 +5,24 @@ id:3:initdefault: # System initialization, mount local filesystems, etc. -si::sysinit:/sbin/rc sysinit +si::sysinit:/sbin/openrc sysinit # Further system initialization, brings up the boot runlevel. -rc::bootwait:/sbin/rc boot +rc::bootwait:/sbin/openrc boot -l0:0:wait:/sbin/rc shutdown +l0:0:wait:/sbin/openrc shutdown l0s:0:wait:/sbin/halt -dhip -l1:S1:wait:/sbin/rc single -l2:2:wait:/sbin/rc nonetwork -l3:3:wait:/sbin/rc default -l4:4:wait:/sbin/rc default -l5:5:wait:/sbin/rc default -l6:6:wait:/sbin/rc reboot +l1:S1:wait:/sbin/openrc single +l2:2:wait:/sbin/openrc nonetwork +l3:3:wait:/sbin/openrc default +l4:4:wait:/sbin/openrc default +l5:5:wait:/sbin/openrc default +l6:6:wait:/sbin/openrc reboot l6r:6:wait:/sbin/reboot -d #z6:6:respawn:/sbin/sulogin # new-style single-user -su0:S:wait:/sbin/rc single +su0:S:wait:/sbin/openrc single su1:S:wait:/sbin/sulogin # TERMINALS