librc: filter out container processes on OpenVZ host

Thanks to info and testing done by Daniel Robbins <drobbins@funtoo.org>,
there is now a fix for this. Below is his description of the steps
OpenRC needed to use.

1) See if /proc/<pid>/status exists
2) If it does, see if it has a "envID:" field
3) If it does, see if "envID:" is set to "0"
4) If so, then it's one of the host's processes and should be a
candidate for the list. Otherwise, it is one of the container's
processes and should be ignored.

This should fix the bug and allow start-stop-daemon to work properly on
OpenVZ hosts.

X-Gentoo-Bug: 376817
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=376817
sh/tmpfiles.sh: license under 2-clause BSD

As the author of our tmpfiles.sh script, I hereby license it under
2-clause BSD, like the rest of openrc.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
SELinux filesystem is at /sys/fs/selinux

The SELinux filesystem has been moved to /sys/fs/selinux for quite some
time. We kept supporting /selinux for backwards compatibility, but it's
time to move forward on this.

X-Gentoo-Bug: 511718
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=511718
Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
tmpfiles.sh: fix comment processing

If you happened to format a comment with no white space after the '#',
it was not being processed.

Reported-by: consus@gmx.com
X-Gentoo-Bug: 511804
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=511804
man/start-stop-daemon.8: correct argument from --nice to --nicelevel

X-Gentoo-Bug: 510648
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=510648
Make history a separate document

Move the additional history information from Daniel Robbins' wiki
page along with the history from README to a separate file,
README.history.

X-Gentoo-Bug: 513024
X-Gentoo-Bug-URL: https://bugs.gentoo.org/513024
sysfs: Do not mount openrc cgroup if it is already mounted

We were not checking to see if /sys/fs/cgroup/openrc was already mounted
before we mounted it. This fixes that issue.
Thanks to Robin Johnson <robbat2@gentoo.org> for pointing this out.
Schedule removal of the opts variable from service scripts
sysctl.Linux.in: remove -lxc from keywords

certain tunables can be set independently for each container

X-Gentoo-Bug: 516050
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=516050
Add support for verbose "local" service runscript

With this patch, the "local" service runscript will be verbose like the
"sysctl" service when 'rc_verbose="yes"' is set.

Example output successful start:

 * Stopping local ...
 *   Executing "/etc/local.d/00will-stop.stop" ...                  [ ok ]
 * Starting local ...
 *   Executing "/etc/local.d/00will-start.start" ...                [ ok ]
 *   Executing "/etc/local.d/01 test.start" ...                     [ ok ]

Example output with failing executables:

 * Stopping local ...
 *   Executing "/etc/local.d/00will-stop.stop" ...                  [ ok ]
 *   Executing "/etc/local.d/will-fail.stop" ...
mount: can't find foo in /etc/fstab
 *   Execution of "/etc/local.d/will-fail.stop" failed.             [ !! ]
 * Starting local ...
 *   Executing "/etc/local.d/00will-start.start" ...                [ ok ]
 *   Executing "/etc/local.d/01 test.start" ...                     [ ok ]
 *   Executing "/etc/local.d/will-fail2.start" ...
mount: can't find bar in /etc/fstab
 *   Execution of "/etc/local.d/will-fail2.start" failed.           [ !! ]
 *   Executing "/etc/local.d/will-fail.start" ...
mount: can't find foo in /etc/fstab
 *   Execution of "/etc/local.d/will-fail.start" failed.            [ !! ]

X-Gentoo-Bug: 489274
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=489274
init.d/local: bring functioning more in line with how sysctl works

- remove the has_executables variable since it isn't used.
- Convert the conditional calls to ewend/vewend to a single call to veend.
- Always call eend after all scripts are executed passing the appropriate
error code.

Because of this change, you will see only an overall status when
starting or stopping local unless you are using verbose mode.
FEATURE_REMOVAL_SCHEDULE: add entry for local_start/stop
cgroups: only run cgroup setup when starting a service

Status call should not set limits as it requires root permissions,
also this is not safe, as current process may reach limitation.

Solution is to set limits and move process to service cgroup only
on start.

X-GENTOO-BUG: 500364
X-GENTOO-BUG-URL: https://bugs.gentoo.org/show_bug.cgi?id=500364
Style Fixes
checkpath: report an error if required options were not specified

Before this commit, not specifying -d, -f, -p or -W in a checkpath
command meant the command exited successfully but actually did nothing.

This is an error condition, so report it as such.
checkpath: fix error message in previous commit
typo fix
man/openrc.8: update checkpath documentation

X-GENTOO-BUG: 500606
X-GENTOO-BUG-URL: https://bugs.gentoo.org/show_bug.cgi?id=500606
man/openrc-run.8: more updates and clarifications for checkpath

X-Gentoo-Bug: 500606
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=500606
checkpath: fix logic for the writable option

The -W option does not need an argument of its own; it can take the
first path after all other options are processed on the command line.

Also, move the processing for the -W option out of the switch so it will
be in the same loop as the other processing.