Commit Graph

1044 Commits

Author SHA1 Message Date
William Hubbs
48981be8a8 Revert "Make einfo routines private"
This reverts commit de88aff0a8.
I was advised that splashutils links to libeinfo, so we do have a
consumer for this library.
2013-10-21 13:49:41 -05:00
William Hubbs
f751e14416 convert flock() messages to verbose warnings
Convert these messages to warnings that are only displayed if
EINFO_VERBOSE is set to yes in the environment.

This is based on a suggestion from Patrick Lauer <patrick@gentoo.org>.

X-Gentoo-Bug: 487588
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=487588
2013-10-12 09:38:09 -05:00
William Hubbs
82378bd92d start-stop-daemon: fix do_stop calls
Several calls to do_stop were forcing the test parameter to be true,
which was causing extra output to the terminal, such as:

* Would send signal 0 to pid xxxxx

This should only happen if the --test command line option was used.
2013-10-06 12:00:37 -05:00
Natanael Copa
03c67bcc27 librc: fix a read off-by-one bug
We should first check if we are within bounds and then read rather than
the opposite.

This makes valgrind happy.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2013-10-04 14:02:02 -05:00
Natanael Copa
681a37e7bd librc: fix off-by-one bug
We need allocate space for both the added leading '-' and the trailing
'\0'.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2013-10-04 14:01:46 -05:00
William Hubbs
56d592866c start-stop-daemon: fix eerorr calls in get_pid
The eerror calls in this function make it too verbose, so change them to
ewarnv() calls instead. This means that they will only print if the
--verbose option is used or EINFO_VERBOSE=yes is set in the environment.
2013-09-30 16:55:25 -05:00
William Hubbs
de88aff0a8 Make einfo routines private
The libeinfo library has no consumers other than OpenRC, so there is no
reason for it to be maintained as a library. The einfo routines are now
an object that links with the rc binary.
2013-09-26 22:18:21 -05:00
William Hubbs
9e989227ab start-stop-daemon: remove the verbose variable
Along the same lines as the quiet variable, this is controlled by an
environment variable for the einfo code, so we do not need a separate
boolean flag.
2013-09-24 01:47:17 -05:00
William Hubbs
d6436bed09 start-stop-daemon: remove the quiet variable
The suppression of output is controlled in the e* functions themselves,
so there is no need for a variable to test in start-stop-daemon.

X-Gentoo-Bug: 482396
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=482396
2013-09-23 17:28:39 -05:00
William Hubbs
4480f1f395 rc: add service to ignore patterns 2013-09-23 13:37:21 -05:00
William Hubbs
0ba14ae720 style fixes 2013-09-23 12:40:26 -05:00
Alexander V Vershilov
7716bf31de Fix stacked runlevel support
Patch was provided by  Max Hacking <max.gentoo.bugzilla@hacking.co.uk>
and slightly fixed by Alexander Vershilov <qnikst@gentoo.org> and
William Hubbs <williamh@gentoo.org>.

Fixes:
1). Rebase to newest OpenRC version.
2). Remove code style fixes. Port to currect code style.
3). Fix rc_runlevel_stack instead of introducing new function.
4). Make get_runlevel_chain a private function.

X-Gentoo-Bug: 467368
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=467368
2013-09-20 14:27:31 -05:00
William Hubbs
445b297360 rc: add support for suppressing error messages
Add support for suppressing error messages with --quiet specified twice
on the command line.

X-Gentoo-Bug: 482396
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=482396
2013-09-03 19:05:13 -05:00
William Hubbs
2590bf7a2b libeinfo: add separate variable to suppress eerror messages
Add an EERROR_QUIET environment variable which works like EINFO_QUIET
but for the eerror functions. This will allow library consumers to
choose whether to suppress eerror messages separately from einfo and
ewarn messages.

X-Gentoo-Bug: 482396
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=482396
2013-09-03 13:03:55 -05:00
William Hubbs
a78b18e291 libeinfo: suppress output for eerror* functions
This makes the eerror* functions honor the EINFO_QUIET environment
variable like the einfo* and ewarn* functions.

X-Gentoo-Bug: 482396
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=482396
2013-08-28 14:23:46 -05:00
William Hubbs
72b58b9e6b Revert "Libeinfo: do not suppress ewarn() messages"
This reverts commit 4ee62c7903.

The previously referenced commit broke consistency because ewarnx() was
respecting the EINFO_QUIET environment setting, but after this commit,
ewarn() was not.
Also, due to discussion on the below referenced bugs, I think we do
want to suppress warnings when EINFO_QUIET=yes.

X-Gentoo-Bug: 482396
X-Gentoo-Bug: 439174
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=482396
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=439174
2013-08-27 10:26:48 -05:00
William Hubbs
5c3e5d801b start-stop-daemon: remove redundant test of the quiet value
The einfo() function tests for the EINFO_QUIET environment variable
directly, and this is the variable that is set by the --quiet flag, so
there was no reason for this test to exist.
2013-08-26 17:09:18 -05:00
William Hubbs
bb8a9c087d start-stop-daemon: fix --quiet switch
The --quiet switch wasn't really quiet, because we changed it to report
errors. I am changing it back due to discussions on the listed bugs.

X-Gentoo-Bug: 482396
X-Gentoo-Bug: 439174
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=482396
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=439174
2013-08-26 15:51:11 -05:00
Gary
9ebd5a6aff Add support for DragonFly BSD 2013-07-25 22:33:24 -05:00
Alexander V Vershilov
c18d623dc0 rc-status: fix typo
X-Gentoo-Bug: 477318
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=477318
2013-07-19 15:30:28 -05:00
Alexander V Vershilov
0f70cd067f rc-status: fix -a to show all services
We need to unset rc_svcname so that all of the services are added to the
list to display.

X-Gentoo-Bug: 409787
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=409787
2013-07-16 12:53:03 -05:00
William Hubbs
a09a60c4cf Add service applet
The service applet is equivalent to rc-service. This was added so that
we will be more compatible with Debian and Fedora.

Reported-by: cardoe@gentoo.org
X-Gentoo-Bug: 468168
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=468168
2013-05-02 13:52:27 -05:00
William Hubbs
70628a875b fix the build for non-selinux systems
The symlinks should be created only if MKSELINUX=yes, not if it just has
a value.
2013-05-01 18:20:01 -05:00
William Hubbs
10a4385e40 rc: allow switching runlevels without stopping services
OpenRC, by default, stops all services that are not listed in a runlevel
when rc is used to switch runlevels. This adds a -n/--no-stop command
line option to rc which tells it to skip stopping the services which are
not in the runlevel.

Reported-by: gentoo@thoth.purplefrog.com
X-Gentoo-Bug: 372585
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=372585
2013-04-28 12:51:12 -05:00
Natanael Copa
e4668a5061 Fix autodetection of lxc
The /proc/1/environ contains various \0 terminated strings. The current
code will only work when the search string is in the first of those.

To fix this we look for strings in entire buffer.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2013-04-09 02:25:26 -05:00
Andrew Gregory
fb10b97172 rc-service: add usage message
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2013-02-25 14:45:39 -06:00
Andrew Gregory
927207c1b7 rc-status: improve usage message accuracy and consistency
This makes it more clear that many of the options are used as an
alternative to a runlevel.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2013-02-25 14:44:04 -06:00
Andrew Gregory
5872bf1333 rc-update: improve usage message accuracy and consistency
The old message did not indicate that the runlevel argument was optional
for add and del or that it could be used with show.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2013-02-25 14:41:30 -06:00
Andrew Gregory
67377cc09f rc: add usage message
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2013-02-25 14:39:50 -06:00
Andrew Gregory
8c90042dee make BINDIR and SBINDIR available to input files
BINDIR and SBINDIR can be set independently of PREFIX and may not be set
to PREFIX/bin as scripts currently assume.

Note from William Hubbs:

This adds @BINDIR@ and @SBINDIR@ macros to the sed commands run to
convert *.in files to the executable form.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2013-02-23 20:30:39 -06:00
Alexander Mezin
970893adf3 runscript: retry prefix flock if it is interrupted by a signal
Reported-by: Pacho Ramos <pacho2@gentoo.org>
X-Gentoo-Bug: 434800
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=434800
2013-02-15 13:28:35 -06:00
Andrew Gregory
3896b9d55c libeinfo: check for "color" in the terminal name
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2013-01-04 08:48:08 -06:00
William Hubbs
630d23283a Add tools directory
This directory will contain tools which are not necessary for OpenRC to
run, but which some users have found useful.

The first of these is deptree2dot, which converts /run/openrc/deptree to
a .dot file for use with graphviz. This can assist in finding circular
dependencies.
2013-01-02 18:00:04 -06:00
William Hubbs
a9272f50f7 Do not add a prefix to the /run directory
This doesn't affect us on gentoo, but on archlinux, which has done the
/usr merge, OpenRC was looking for /run under PREFIX. /run is always at
the root level, so it shouldn't have prefix appended to it.

Reported-by: udeved@openrc4arch.site40.net
2012-12-03 18:33:21 -06:00
William Hubbs
e634376482 Checkpath: print the path when correcting the owner
Checkpath was printing the path it was working with unless it was
correcting the owner. In this case, it was printing "checkpath", which
is not very useful.

Reported-by: <devurandom@gmx.net>
X-Gentoo-Bug: 439014
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=439014
2012-10-27 12:59:58 -05:00
William Hubbs
978dbe0284 mountinfo: respect the -q command line option
Previously, we were setting the quiet flag before the command line was
parsed. Since the flag is only used once, we can just read the
environment variable which is set by the parsing process.

Reported-by: <devurandom@gmx.net>
X-Gentoo-Bug: 439010
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=439010
2012-10-24 12:29:29 -05:00
William Hubbs
20af890ac2 Spacing fixes 2012-10-17 18:47:36 -05:00
William Hubbs
b68d4b3580 checkpath: fix bool values
Use true/false for bool values instead of 0/1.

Reported-by: <vapier@gentoo.org>
2012-10-09 18:55:09 -05:00
William Hubbs
6f345abe91 checkpath: change the owner/group only when requested to do so
Fix checkpath so that it only changes the owner/group if -o is on the
command line.

Reported-by: <flameeyes@gentoo.org>
X-Gentoo-Bug: 437560
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=437560
2012-10-09 16:44:01 -05:00
William Hubbs
361f5ce2b8 set the RC_UNAME environment variable when updating dependencies
This is needed because the network script uses this variable in the
depend() function but it wasn't exported when this was run.

Reported-by: <aaly90@gmail.com>
2012-10-04 22:01:33 -05:00
William Hubbs
0a132cdca5 fix RC_SVCDIR on prefix systems
On prefix systems, RC_SVCDIR was being defined based on the host
operating system. This is not correct because there will not be a /run
directory in a prefix.
This commit moves RC_SVCDIR on prefix systems to the same location as on
non-Linux systems.
2012-09-20 16:04:48 -05:00
Christian Ruppert
6b1e806c8b Typo: emtpy -> empty
Reported-by: Walter <walter@pratyeka.org>
X-Gentoo-Bug: 430146
X-Gentoo-Bug-URL: https://bugs.gentoo.org/430146
2012-09-14 22:59:01 +02:00
Christian Ruppert
3cd293c515 Silence the right get_pid() call 2012-09-12 21:35:55 +02:00
Christian Ruppert
a06072b395 Silence get_pid(), OpenRC will give the process some time to create the PID file and the first get__pid() call may fail. 2012-09-12 21:00:20 +02:00
William Hubbs
5092595835 add RC_PREFIX environment variable
This will be used by init scripts which want to be able to run in a
Gentoo Prefix installation. RC_PREFIX will contain the prefix offset.
2012-09-09 22:22:15 -05:00
Christian Ruppert
9afdf50667 Do not silence errors 2012-08-19 00:26:38 +02:00
Christian Ruppert
8dc06e3259 Fix quiet usage
EINFO_QUIET will always been unset when we first do unsetenv("EINFO_QUIET") and
later query it again anyway..
2012-08-18 23:21:40 +02:00
William Hubbs
e641b43849 Bring Back prefix support
We now have a team member who is interested in OpenRC on prefix, so I am
bringing it back to the main tree.
2012-07-26 10:54:48 -05:00
Mike Frysinger
f5ba232fb4 rc: fix inverted string compare logic
X-Gentoo-Bug: 417227
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=417227
Reported-by: sphakka <marcoep@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-23 19:32:59 -04:00
Mike Frysinger
6241f17e95 rc: fix thinko in applet collapse
We want to lookup the service based on the applet name.

Reported-by: Christian Ruppert <idl0r@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-16 18:16:51 -04:00
William Hubbs
82d3918d7a move rc_svcdir to /run/openrc on Linux systems
If you are not using linux, this should not affect you.

If you are using linux, from this point forward, openrc requires the
/run directory to be a mounted tmpfs. If it is, you can run
@LIBEXECDIR@/sh/migrate-to-run.sh as root to migrate your dependency
tree and state information to the new location. If it is not, you must
create the /run directory as root with permissions 755 then reboot your
system.

reported-by: Maxim Kammerer <mk@dee.su>
X-Gentoo-Bug: 401059
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=401059
2012-05-14 13:49:06 -05:00
Mike Frysinger
2486eb4989 rc: collapse the applet if statements into a single array walk
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-06 01:17:30 -04:00
Mike Frysinger
0813a80223 add a new ARRAY_SIZE macro and use it
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-06 01:17:30 -04:00
Mike Frysinger
3969cb2a85 split out librc-independent helpers into a dedicated header file
Many of these helpers are not special to librc, so split them out so they
can be used in all source trees (including libeinfo).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-06 01:17:30 -04:00
Christian Ruppert
441272ff97 Reduce overhead by leaving rc_deptree_update_needed() as soon as possible
There's no need to check any further if we're returning true anyway.

Signed-off-by: Christian Ruppert <idl0r@gentoo.org>
2012-04-26 12:40:13 +02:00
Christian Ruppert
fd6bbfbe07 Disable some questionable lines
Caused by bug 412589 I was looking at the do_mark_service() function and quickly
found that the segfault is caused by a strlen() call against a NULL pointer.
I also noticed it's using "/exclusive/%s.%s" so svcname.pid, all other functions
are just using the svcname.. So it seems that svcname.pid was/is never used and
thus not necessary at all.

In relation to the above, the if statement in the do_mark_service() function
("if (ok && svcname && strcmp(svcname, service) == 0) {") needs to be
fixed/improved as svcname and service are almost always equal, see my comment in
the function for further details.

Signed-off-by: Christian Ruppert <idl0r@gentoo.org>

Reported-by: Patrick McLean <chutzpah@gentoo.org>
X-Gentoo-Bug: 412589
X-Gentoo-Bug-URL: https://bugs.gentoo.org/412589
2012-04-26 10:33:54 +02:00
Christian Ruppert
1f5072421e Remove duplicate getenv("RC_SVCNAME") call 2012-04-24 03:49:04 +02:00
William Hubbs
300c03203d librc: Do not output error messages from within the library.
This fixes a compile issue. Also, it is cleaner to have the client
output error messages as opposed to having the library do this.

Reported-by: Ewoud Kohl van Wijngaarden <gentoo@kohlvanwijngaarden.nl>
X-Gentoo-Bug: 409743
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=409743
2012-03-26 15:04:40 -05:00
William Hubbs
582c8e9868 librc: make rc_proc_getent available for all operating systems
This looks up an option on the kernel command line. For now, itworks on
linux and returns NULL on the bsds, but we are definitely open to
patches for that side.
2012-02-25 15:00:03 -06:00
Christian Ruppert
de6323ba51 Fix rc_proc_getent() undeclared on BSD
X-Gentoo-Bug: 405713
X-Gentoo-Bug-URL: https://bugs.gentoo.org/405713
Reported-by: Dmitri Bogomolov <4glitch@gmail.com>
2012-02-25 17:56:24 +01:00
William Hubbs
3272261479 Skip pam if running as root
Reported-by: Piotr Karbowski <piotr.karbowski@gmail.com>
X-Gentoo-Bug: 386623
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=386623
2012-02-23 16:47:52 -06:00
William Hubbs
3247184d86 Remove prefix support
I spoke with the prefix team sometime back and was told that they do not
have an interest in using OpenRC on prefix systems.
2012-02-21 07:27:16 -06:00
William Hubbs
04db6c3d39 rc: remove calls to rc_sys_v2 and rc_sys_v1
These separate calls are no longer needed since we do not warn about
falling back to automatic detection.
2012-02-20 20:04:57 -06:00
Jory A. Pratt
3c602e7422 remove the warning about falling back to autodetection 2012-02-20 19:07:54 -06:00
Christian Ruppert
6913f1deb6 Fix some more warnings 2012-02-12 20:37:05 +01:00
Christian Ruppert
d9dc5dc423 Use size_t instead of int 2012-02-12 02:23:04 +01:00
Christian Ruppert
8c55f1e50d Remove unused/useless function single_user() 2012-02-11 00:24:46 +01:00
William Hubbs
0fcc6251fc fstabinfo: add --remount option
This adds a --remount/-R option to fstabinfo. This new option works like
--mount, but it adds the necessary options to remount a file system
that is already mounted.

Reported-by: Piotr Karbowski <piotr.karbowski@gmail.com>
X-Gentoo-Bug: 401573
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=401573
2012-01-31 16:33:05 -06:00
William Hubbs
7da8394a8e Complain about loading /etc/conf.d/rc
Openrc was quietly loading this file if it existed and this was causing
some issues, so now openrc loads the file and complains about it.

Hopefully the warning message will convince everyone to remove this file
and migrate the settings to @SYSCONFDIR@/rc.conf where they belong.
2012-01-30 13:24:54 -06:00
Christian Ruppert
2d2751c433 Do not unlink the temp. log during shutdown
Also ignore errors in case of EROFS (Read-Only file systems)
Reported-by: Maxim Kammerer
X-Gentoo-Bug: 401115
X-Gentoo-Bug-URL: https://bugs.gentoo.org/401115
2012-01-28 18:59:16 +01:00
Christian Ruppert
6be8a0679b Do not loop flock()
There's no need to loop until flock was successfully as flock() would simply
block till a previous lock has been released.
There's more to do to fix it properly, see my comments in the patch.

Reported-by: James Le Cuirot <chewi@aura-online.co.uk>
X-Gentoo-Bug: 360013
X-Gentoo-Bug-URL: https://bugs.gentoo.org/360013
2012-01-28 16:43:54 +01:00
Christian Ruppert
7ea5c614d9 Add -W/--writable function to checkpath
Checkpath -W will use access(3p) to determine whether or not a path is
writable. This is more accurate than test(1p) because it also takes into
account whether or not the filesystem is mounted read-only.

Modified by William Hubbs to add the man page update.
2012-01-26 14:42:18 -06:00
Christian Ruppert
5d441dd376 Whitespace 2012-01-26 20:47:46 +01:00
Christian Ruppert
44019f6542 Add is_writable() function to check whether a path is writable or not 2012-01-26 20:46:31 +01:00
Christian Ruppert
8b4fc05ff2 Disable parallel startup in interactive mode 2012-01-24 19:41:50 +01:00
Christian Ruppert
ced60319e3 Override rc.conf options only 2012-01-24 19:41:50 +01:00
Robin H. Johnson
426b94bd69 Per the systemd tmpfiles implementation, we need to watch out for umask during initial creation of files as well as potentially changing permissions later. Also do not abort if the items exist already, per truncate rules in tmpfiles.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2012-01-23 10:26:58 +00:00
Robin H. Johnson
06b8084b2c Ensure that when -F is passed, existing files are truncated properly.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2012-01-23 05:30:00 +00:00
Robin H. Johnson
e3d0fe06bd Respin features.h usage so that we correctly test for features before we use them. Some BSD libc implementations may have one or the other flag, but not both.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2012-01-23 05:26:40 +00:00
Robin H. Johnson
319f5003c6 Revert "Drop include for features.h"
This reverts commit 30a565f80d.
2012-01-23 05:24:54 +00:00
William Hubbs
30a565f80d Drop include for features.h
The following information is taken from the feature_test_macros man
page:

<features.h> is a Linux/glibc-specific header file.  Other systems have
an analogous file, but typically with a different name.  This header
file is automatically included by other header files as required: it is
not necessary to explicitly include it in order to employ feature test
macros.

Reported-by: Tibor Vago <tibor.vago@gmail.com>
X-Gentoo-Bug: 399635
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=399635
2012-01-22 14:41:47 -06:00
William Hubbs
85c90f9a1d small style fix 2012-01-20 21:38:13 -06:00
William Hubbs
d729f9d0f2 style fixes 2012-01-16 12:11:29 -06:00
Christian Ruppert
30a56cdb46 Add "ifstopped" command to runscript
Signed-off-by: Christian Ruppert <idl0r@gentoo.org>
2012-01-15 02:10:35 +01:00
Christian Ruppert
14625346c0 Allow overriding of rc.conf options via kernel cmdline
This adds a new function that allows us to override some specific rc.conf
options via the kernel cmdline aka /proc/cmdline.
This makes esp. sense in cases where a rc_parallel enabled system has boot
issues. Simply disable rc_parallel by appending rc_parallel=no to your kernel
cmdline.
2012-01-15 01:02:11 +01:00
Christian Ruppert
c3be42006b Rename proc_getent to rc_proc_getent and make it global 2012-01-15 01:02:11 +01:00
Robin H. Johnson
66f4305e1c rc/checkpath: tmpfiles.d backend creation code
This commit provides the checkpath applet with feature parity to
systemd's tmpfiles.c create_item function.

Very similarly to the systemd function, it does NOT do any of the
cleanup work in this function.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2012-01-09 19:20:47 -08:00
Christian Ruppert
34b7632d1d Do not exit immediately when a service has been stopped already
The old behaviour was to exit(EXIT_SUCCESS) in case the service has been stopped
already, even if further commands has been passed to the init script
(like zap, start).
So using for example /etc/init.d/foo stop zap start would abort immediately
after "stop" if the service has been stopped already. Though there may be cases
were we need it to proceed with the remaining commands, zap and start in this
case.
This patch fixes the behaviour to continue and proceed with the remaining
commands whenever necessary.

X-Gentoo-Bug: 371845
X-Gentoo-Bug-URL: https://bugs.gentoo.org/371845
2011-12-31 03:35:32 +01:00
Christian Ruppert
372745844b Code style fixes 2011-12-30 16:03:24 +01:00
Christian Ruppert
0d6ae379f4 Compare stricter in proc_getent
The new proc_getent compares stricter so that e.g. "ro" doesn't match
root=/dev/sdaN anymore.
So it has to be either "ro" or "ro=".
2011-12-30 16:03:24 +01:00
Christian Ruppert
49e99a7393 Don't try to write the log during sysinit
During the sysinit and shutdown runlevels the logfile destination may be
read-only. Skip the error messages in this case.

X-Gentoo-Bug: 390645
X-Gentoo-Bug-URL: https://bugs.gentoo.org/390645
2011-12-29 13:58:08 +01:00
Christian Ruppert
8dcb7554ee Use RC_LEVEL_SHUTDOWN 2011-12-29 03:16:53 +01:00
Christian Ruppert
b754a27f62 Remove useless rc_runlevel_get() call
The current runlevel will be passed to rc_logger_open() already.
2011-12-29 03:08:29 +01:00
Christian Ruppert
ec65f181ea Don't print error when the logfile isn't writeable during shutdown
The logfile or its basedir may be read-only during shutdown because the
directory may be umounted or read-only remounted already. In this case we simply
skip this error.
This is related to a comment in bug 390645 but the initial bug is not fixed
through this commit.

X-Gentoo-Bug: 390645
X-Gentoo-Bug-URL: https://bugs.gentoo.org/390645
2011-12-29 02:50:24 +01:00
William Hubbs
e574b5d441 fix compile error
A variable used in the previous commit was actually removed in another
commit; that is why I didn't catch it.

Reported-by: Duncan < 1i5t5.duncan@cox.net>
X-Gentoo-Bug: 394369
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=394369
2011-12-11 14:33:39 -06:00
William Hubbs
5e01051c4e Allow init scripts to be executed with a relative path
This was a regression that was caused by the fix for
http://bugs.gentoo.org/show_bug.cgi?id=350910. I am reverting the commit
that we said fixed that bug and re-opening it.

Reported-By: Nathaniel <nathaniel@paust.us
X-Gentoo-Bug: 392457
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=392457
2011-12-11 01:18:08 -06:00
Mike Frysinger
453d13296d rc: usage: do not output non-printable short options in usage
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-19 02:43:25 -05:00
Mike Frysinger
c21c1f1e59 rc: usage: optimize help string alignment output a little
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-19 02:42:41 -05:00
Mike Frysinger
c7cc685458 rc: fix style around case_RC_COMMON_GETOPT
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-19 02:33:11 -05:00
Mike Frysinger
ef1ff1b4f2 make shell math operations style more succulent
Convert the style:
	var=$((${var} + 1))
to:
	: $(( var += 1 ))

The latter is easier to read imo.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-19 02:25:36 -05:00