Commit Graph

937 Commits

Author SHA1 Message Date
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
William Hubbs
66e99b6d63 Fix compile warning 2011-11-17 16:06:18 -06:00
William Hubbs
5b1aaf8cc8 add support for extra_stopped_commands 2011-11-16 13:56:55 -06:00
Mike Frysinger
3f2e9c4e1f mountinfo: Do not error out if realpath fails
Reported-By: Dennis Schridde <devurandom@gmx.net>
X-Gentoo-Bug: 383333
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=383333
2011-11-15 15:19:55 -06:00
Mike Frysinger
16661d02e9 ssd: fix building when SYS_ioprio_set is missing
Older glibc's might not provide this.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-09 00:09:58 -05:00
William Hubbs
f46626dcfc add auto detection for lxc
Reported-by: Francesco Riosa <francesco+gentoo_bugzilla@pnpitalia.it>
X-Gentoo-Bug: 384151
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=384151
2011-11-07 08:39:16 -06:00
William Hubbs
5066d40ac8 Use pattern rules instead of suffix rules
Rework the makefiles to use pattern rules instead of suffix rules.
This is the preferred way to write implicit rules according to the gnu
make manual.
2011-10-29 09:43:24 -05:00
Christian Ruppert
e2f1464f47 Use the real/actual path when looking for mounts
/proc/mounts contains real/actual paths so we should do the same in mountinfo.
2011-09-08 19:20:20 +02:00