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:
William Hubbs 2013-12-11 17:39:38 -06:00
parent 09733d3fae
commit 7b5fa011ac
14 changed files with 42 additions and 30 deletions

5
README
View File

@ -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 been removed. If you need these scripts, look for a package called
netifrc, which is maintained by them. 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 Reporting Bugs
-------------- --------------
Since Gentoo Linux is hosting OpenRC development, Bugs should go to Since Gentoo Linux is hosting OpenRC development, Bugs should go to

View File

@ -1,7 +1,7 @@
MAN3= einfo.3 \ MAN3= einfo.3 \
rc_config.3 rc_deptree.3 rc_find_pids.3 rc_plugin_hook.3 \ rc_config.3 rc_deptree.3 rc_find_pids.3 rc_plugin_hook.3 \
rc_runlevel.3 rc_service.3 rc_stringlist.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 service.8 start-stop-daemon.8
# Handy macro to create symlinks # Handy macro to create symlinks

View File

@ -22,10 +22,10 @@
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.Dd May 2, 2009 .Dd May 2, 2009
.Dt RC 8 SMM .Dt OPENRC 8 SMM
.Os OpenRC .Os OpenRC
.Sh NAME .Sh NAME
.Nm rc .Nm openrc
.Nd stops and starts services for the specified runlevel .Nd stops and starts services for the specified runlevel
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm

View File

@ -63,7 +63,7 @@ otherwise -1.
.Fl r , -resolve .Fl r , -resolve
does the same and also prints the full path of the service to stdout. does the same and also prints the full path of the service to stdout.
.Sh SEE ALSO .Sh SEE ALSO
.Xr rc 8 , .Xr openrc 8 ,
.Xr stdout 3 .Xr stdout 3
.Sh AUTHORS .Sh AUTHORS
.An Roy Marples <roy@marples.name> .An Roy Marples <roy@marples.name>

View File

@ -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 tries to list services within each runlevel in the presently resolved
dependency order if the dependency tree is available. dependency order if the dependency tree is available.
.Sh SEE ALSO .Sh SEE ALSO
.Xr rc 8 , .Xr openrc 8 ,
.Xr rc-update 8 .Xr rc-update 8
.Sh AUTHORS .Sh AUTHORS
.An Roy Marples <roy@marples.name> .An Roy Marples <roy@marples.name>

View File

@ -86,7 +86,7 @@ If the
option is given then we either add or remove the runlevel from the runlevel. option is given then we either add or remove the runlevel from the runlevel.
This allows inheritance of runlevels. This allows inheritance of runlevels.
.Sh SEE ALSO .Sh SEE ALSO
.Xr rc 8 , .Xr openrc 8 ,
.Xr rc-status 8 .Xr rc-status 8
.Sh AUTHORS .Sh AUTHORS
.An Roy Marples <roy@marples.name> .An Roy Marples <roy@marples.name>

View File

@ -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 Plugins can affect the parent environment by writing NULL separated strings to
.Va rc_environ_fd . .Va rc_environ_fd .
.Sh SEE ALSO .Sh SEE ALSO
.Xr rc 8 , .Xr openrc 8 ,
.Xr runscript 8 .Xr runscript 8
.Sh AUTHORS .Sh AUTHORS
.An Roy Marples <roy@marples.name> .An Roy Marples <roy@marples.name>

View File

@ -343,7 +343,7 @@ sets the following environment variables for use in the service scripts:
.It Va RC_SVCNAME .It Va RC_SVCNAME
Name of the service. Name of the service.
.It Va RC_RUNLEVEL .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 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. 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 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. Users are encouraged to use the is_newer_than function which returns correctly.
.Sh SEE ALSO .Sh SEE ALSO
.Xr einfo 3 , .Xr einfo 3 ,
.Xr rc 8 , .Xr openrc 8 ,
.Xr rc-status 8 , .Xr rc-status 8 ,
.Xr rc-update 8 , .Xr rc-update 8 ,
.Xr rc_plugin_hook 3 , .Xr rc_plugin_hook 3 ,

View File

@ -6,7 +6,7 @@
# the old service state data # the old service state data
: ${RC_LIBEXECDIR:=@LIBEXECDIR@} : ${RC_LIBEXECDIR:=@LIBEXECDIR@}
: ${RC_SVCDIR:=@LIBEXECDIR@/init.d} : ${RC_SVCDIR:=@LIBEXECDIR@/init.d}
case "$(rc --sys)" in case "$(openrc --sys)" in
OPENVZ|VSERVER) rm -rf "$RC_SVCDIR"/*;; OPENVZ|VSERVER) rm -rf "$RC_SVCDIR"/*;;
*) if mountinfo --quiet "$RC_SVCDIR"; then *) if mountinfo --quiet "$RC_SVCDIR"; then
rm -rf "$RC_SVCDIR"/* rm -rf "$RC_SVCDIR"/*

View File

@ -37,7 +37,7 @@ fi
# /run is a new directory for storing volatile runtime data. # /run is a new directory for storing volatile runtime data.
# Read more about /run at https://lwn.net/Articles/436012 # Read more about /run at https://lwn.net/Articles/436012
sys="$(rc --sys)" sys="$(openrc --sys)"
if [ ! -d /run ]; then if [ ! -d /run ]; then
if [ "$sys" = VSERVER ]; then if [ "$sys" = VSERVER ]; then

View File

@ -1,4 +1,4 @@
PROG= rc PROG= openrc
SRCS= checkpath.c fstabinfo.c mountinfo.c start-stop-daemon.c \ SRCS= checkpath.c fstabinfo.c mountinfo.c start-stop-daemon.c \
rc-applets.c rc-depend.c rc-logger.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 \ rc-misc.c rc-plugin.c rc-service.c rc-status.c rc-update.c \
@ -11,7 +11,7 @@ SBINDIR= ${PREFIX}/sbin
LINKDIR= ${LIBEXECDIR} LINKDIR= ${LIBEXECDIR}
BINLINKS= rc-status 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 \ RC_BINLINKS= einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \
eindent eoutdent esyslog eval_ecolors ewaitfile \ eindent eoutdent esyslog eval_ecolors ewaitfile \
veinfo vewarn vebegin veend vewend veindent veoutdent \ veinfo vewarn vebegin veend vewend veindent veoutdent \
@ -90,5 +90,5 @@ install: all
check test:: check test::
links: rc links: $PROG
$(call make-links,${ALL_LINKS},rc,.) $(call make-links,${ALL_LINKS},$PROG,.)

View File

@ -533,11 +533,18 @@ run_applets(int argc, char **argv)
{ {
size_t i; 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 /* 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 * 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 * 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. */ * '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)) { (strcmp(argv[1],"--applet") == 0 || strcmp(argv[1], "-a") == 0)) {
applet = argv[2]; applet = argv[2];
argv += 2; argv += 2;
@ -557,6 +564,6 @@ run_applets(int argc, char **argv)
if (strncmp(applet, "mark_service_", strlen("mark_service_")) == 0) if (strncmp(applet, "mark_service_", strlen("mark_service_")) == 0)
exit(do_mark_service(argc, argv)); 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); eerrorx("%s: unknown applet", applet);
} }

View File

@ -125,7 +125,7 @@ cleanup(void)
#endif #endif
if (!rc_in_logger && !rc_in_plugin && if (!rc_in_logger && !rc_in_plugin &&
applet && strcmp(applet, "rc") == 0) applet && (strcmp(applet, "rc") == 0 || strcmp(applet, "openrc") == 0))
{ {
if (hook_out) if (hook_out)
rc_plugin_run(hook_out, runlevel); rc_plugin_run(hook_out, runlevel);
@ -724,7 +724,7 @@ handle_bad_signal(int sig)
#include "_usage.h" #include "_usage.h"
#define usagestring "" \ #define usagestring "" \
"Usage: rc [options] [<runlevel>]" "Usage: openrc [options] [<runlevel>]"
#define getoptstring "a:no:s:S" getoptstring_COMMON #define getoptstring "a:no:s:S" getoptstring_COMMON
static const struct option longopts[] = { static const struct option longopts[] = {
{ "applet", 1, NULL, 'a' }, { "applet", 1, NULL, 'a' },
@ -864,7 +864,7 @@ main(int argc, char **argv)
} }
/* Enable logging */ /* Enable logging */
setenv("EINFO_LOG", "rc", 1); setenv("EINFO_LOG", "openrc", 1);
/* Export our PID */ /* Export our PID */
snprintf(pidstr, sizeof(pidstr), "%d", getpid()); snprintf(pidstr, sizeof(pidstr), "%d", getpid());

View File

@ -5,24 +5,24 @@
id:3:initdefault: id:3:initdefault:
# System initialization, mount local filesystems, etc. # System initialization, mount local filesystems, etc.
si::sysinit:/sbin/rc sysinit si::sysinit:/sbin/openrc sysinit
# Further system initialization, brings up the boot runlevel. # 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 l0s:0:wait:/sbin/halt -dhip
l1:S1:wait:/sbin/rc single l1:S1:wait:/sbin/openrc single
l2:2:wait:/sbin/rc nonetwork l2:2:wait:/sbin/openrc nonetwork
l3:3:wait:/sbin/rc default l3:3:wait:/sbin/openrc default
l4:4:wait:/sbin/rc default l4:4:wait:/sbin/openrc default
l5:5:wait:/sbin/rc default l5:5:wait:/sbin/openrc default
l6:6:wait:/sbin/rc reboot l6:6:wait:/sbin/openrc reboot
l6r:6:wait:/sbin/reboot -d l6r:6:wait:/sbin/reboot -d
#z6:6:respawn:/sbin/sulogin #z6:6:respawn:/sbin/sulogin
# new-style single-user # new-style single-user
su0:S:wait:/sbin/rc single su0:S:wait:/sbin/openrc single
su1:S:wait:/sbin/sulogin su1:S:wait:/sbin/sulogin
# TERMINALS # TERMINALS