Commit Graph

936 Commits

Author SHA1 Message Date
Flex
6d5b452ef5 Do not ignore return code for custom script functions
X-Gentoo-Bug: 380317
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=380317
2011-09-02 11:32:30 -05:00
Diego
b71f3bd2fd Start-stop-daemon: remove call to pam_authenticate 2011-09-01 17:08:55 -05:00
William Hubbs
4ee62c7903 Libeinfo: do not suppress ewarn() messages
The ewarn() function was affected by the EINFO_QUIET environment
variable which lead to warning messages being suppressed. Warnings
should not be suppressed.

Reported-by: Hanno Boeck <hanno@gentoo.org>
X-Gentoo-Bug: 380073
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=380073
2011-08-22 12:39:26 -05:00
William Hubbs
0c8bea2152 Improve processing of service directories and conf.d files
symbolic links should not be followed in an attempt to work out the name
of the service we are running. Also, @sysconfdir@/conf.d should be tried
as a backup directory for configuration files.

I would like to thank Robin Johnson for his input on this change.

X-Gentoo-Bug: 350910
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=350910
2011-07-31 10:00:48 -05:00
William Hubbs
370e5c775a runscript: rename saveDir back to save to fix compile error 2011-07-26 16:58:42 -05:00
William Hubbs
07694255a4 rename save and save2 for clarity
The names saveDir and saveLnk seem to better define how these variables
are used.
2011-07-20 14:38:55 -05:00
Christian Ruppert
a74382d9cb Fix rc_service_value_get() to return multiple lines as well
As introduced in bug 372547 using service_get_value() in the init scripts
or using rc_service_value_get() directly will only return one line.
This patch fixes it by using the new rc_getfile() function, it returns even
multiple lines. We're still using a char *, so the lines will be appended
instead of added into new element.

X-Gentoo-Bug: 372547
X-Gentoo-Bug-URL: http://bugs.gentoo.org/372547
2011-07-13 21:32:13 +02:00
Mike Frysinger
fdaf1c65cd Add a new function, bool rc_getfile(const char *, char **, size_t *)
<snip>
Read the entire @file into the buffer and set @len to the
size of the buffer when finished. For C strings, this will
be strlen(buffer) + 1.
Don't forget to free the buffer afterwards!
</snip>

We also fix bug 374899 by adding this new function.

X-Gentoo-Bug: 374899
X-Gentoo-Bug-URL: http://bugs.gentoo.org/374899
2011-07-13 21:31:20 +02:00
Christian Ruppert
ef22868f36 Do not skip similar config options
OpenRC goes through the config and checks each option for duplicates.
Lets say we're on "rc_logger" currently and its the last option in the config
file and we previously defined rc_logger_path.

It now goes through all previous config options and compares those against the
current one "rc_logger" *but* it compares only the first N bytes, in this
case strlen("rc_logger"). So it strips the _path from "rc_logger_path" which
ends up into "rc_logger" and it compares that against the current one (also
		"rc_logger"), it would then simply override the previous definition.

This patch fixes this behaviour to always compare the full option / variable
names.
2011-07-09 23:15:16 +02:00
Christian Ruppert
05e3251467 Rename rc_logger_path to rc_log_path 2011-07-06 21:16:15 +02:00
Christian Ruppert
44dc7db4f8 Improve logging
Add "e" (O_CLOEXEC) to all fopen() calls.
Remove system() call and replace it by fopen() and friends.
This also fixes bug 368933

X-Gentoo-Bug: 368933
X-Gentoo-Bug-URL: https://bugs.gentoo.org/368933
2011-07-05 23:42:21 +02:00
Christian Ruppert
003d4ba15b Don't write into optarg, this also fixes a compiler warning. 2011-07-05 00:51:29 +02:00
Christian Ruppert
70a3a3cf39 Add --startas/-a back to the optstring
X-Gentoo-Bug: 373609
X-Gentoo-Bug-URL: https://bugs.gentoo.org/373609
2011-06-30 20:21:48 +02:00
Mike Frysinger
d0bc4f20ad drop useless "All rights reserved" notice
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-06-29 19:46:31 -04:00
Christian Ruppert
b6766c2544 Use RC_CONF instead of the hardcoded /etc/rc.conf 2011-06-28 18:45:39 +02:00
Joe Harvell
24ba795563 Only print the deprecation warning for --chuid/-c when using it
The deprecation warning has been printed when using the replecement functions as
well, bug 373243.
2011-06-27 23:20:47 +02:00
Christian Ruppert
4eb37f67cf Warn if deprecated commandline options are used for start-stop-daemon 2011-06-05 16:49:12 +02:00
Mike Frysinger
e49da2af91 clean up gitignore files
Rather than listing explicit object files, ignore all of them in
the whole tree.

Also ignore patch/gdb related files throughout.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-06-03 17:07:22 -04:00
Mike Frysinger
11d8b70d74 rc-update: sort "show" output
X-Gentoo-Bug: 367305
X-Gentoo-Bug-URL: http://bugs.gentoo.org/367305
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-05-28 12:11:37 -04:00
Mike Frysinger
227f831639 cc.mk: move debug.mk out of end Makefiles
Since we always want debug.mk whenever we include cc.mk, move the include
out of the Makefiles and into cc.mk itself.  This also fixes an include
order bug in rc/Makefile where debug.mk is included before cc.mk and
breaks the default CFLAGS setup in cc.mk.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-05-28 12:00:34 -04:00
Mike Frysinger
fe18c7bb63 librc: tweak style: foo () -> foo()
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-05-28 11:53:29 -04:00
Mike Frysinger
f8ff4a86a3 rc: delete now unused local "i" variable
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-05-28 11:42:49 -04:00
Christian Ruppert
d59e245bc7 Fix dirname calls in runscript
runscript will try to get the dir and basename of a file/link in case it
contains at least one slash. This patch gives a temporary copy of the path to
the dirname() function since dirname() can modify its argument.
2011-05-23 14:23:15 -05:00
James Le Cuirot
8fcaba9a22 fix rc_service_extra_commands return value
If there were no extra commands, rc_service_extra_commands returned a
list containing a single empty string. This changes that to return an
empty list, which is more consistent with what you would expect.

X-Gentoo-Bug: 360013
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=360013
2011-04-27 15:27:16 -05:00
William Hubbs
04e256e3b8 fix list returned by rc_service_extra_commands
This function was returning the setting of the variable $opts, which is
not correct. $opts was used in baselayout-1, but it is replaced by
$extra_commands and $extra_started_commands in openrc.

This does not appear to break backward compatibility since this function
does not appear to be used anywhere in the openrc code.

Thanks to James Le Cuirot for the original patch.

X-Gentoo-Bug: 360013
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=360013
2011-04-27 14:46:59 -05:00
William Hubbs
07db27d220 typo fix
X-Gentoo-Bug: 217999
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=217999
2011-04-09 13:00:44 -05:00
William Hubbs
b512d0db98 new implementation of applet option
This reworks the implementation of the --applet option so that it is
processed in run_applets() and does not require two calls to the
getopts_long() function. It is based on code by Robin Johnson and Chris
Richards.

X-Gentoo-Bug: 351712
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=351712
2011-02-16 09:00:38 -06:00
William Hubbs
73d1a8698e make version option common
This reworks the code for the version option so that it is part of the
parser loop and is a common option to all applets.
2011-02-14 18:40:05 -06:00
Mike Frysinger
c0aa27ef32 tests: filter valid parisc relocs
Parisc generates a few relocs against internal symbols which are OK.

X-Gentoo-Bug: 258913
X-Gentoo-Bug-URL: http://bugs.gentoo.org/258913
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-02-14 12:06:58 -05:00
William Hubbs
04379b2de9 fix symlink target
The target for the symlinks in ${SBINDIR} (the same directory as the rc
binary) was "rc". This is not correct; the target should be
${SBINDIR}/rc instead.
2011-02-07 02:25:00 -06:00
William Hubbs
db6d680765 rework pam, ncurses and termcap include files
This allows error checking inside the included files instead of either
including the appropriate file or a blank file.

Also the blank file named .mk gets removed by this change.
2011-02-04 22:30:30 -06:00
William Hubbs
19037cbd83 remove unnecessary shell calls
The main makefile, init.d/Makefile and src/librc/Makefile all contain
several shell calls which can be handled as make conditionals. This
switches them to conditionals.
2011-02-04 17:46:57 -06:00
Chris Richards
21c5a022af selinux: replace symlinks with wrapper scripts
This needs to be done on selinux systems so the proper context can be
set for each rc applet.

X-Gentoo-Bug: 351712
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=351712
2011-01-31 14:54:02 -06:00
William Hubbs
cca7e9f7e1 use immediate evaluation for shell calls
This reworks the shell calls in the makefiles to use immediate
evaluation and should improve parallel building.

X-Gentoo-Bug: 289264
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=289264
2011-01-31 14:05:57 -06:00
Mike Frysinger
9ce957c3e7 librc: delete trailing newlines
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-17 20:05:13 -05:00
Mike Frysinger
c825a74dd1 tests: check for trailing blank newlines
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-17 20:04:53 -05:00
Robin H. Johnson
164b8e4e04 Document that rc_sys_v{1,2} should not be used outside of OpenRC. 2011-01-17 22:30:40 +00:00
Robin H. Johnson
de8b4855d3 Bug #351570: Fix hidden functions visibility for rc_deptree_load_file. 2011-01-17 19:36:51 +00:00
Robin H. Johnson
f3f55f1f6d Build cleanup: librc.funcs.hidden.list is generated by testsuite. 2011-01-17 19:34:09 +00:00
Robin H. Johnson
2b7c2b8cf1 Bug #351570: Hidden function fixes: rc_conf_value.
Refactor rc_conf_value into librc for use in library context.
Also requires moving:
- rc_conf internal static
- Defines: PROFILE_ENV, SYS_WHITELIST, USR_WHITELIST, RC_PATH_PREFIX
  moved to rc.h with new RC_ prefix added.
- Defines: RC_CONF, RC_CONF_OLD moved to rc.h.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2011-01-17 19:29:45 +00:00
Mike Frysinger
6e876bca13 tests: check for common style issues
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-17 04:49:35 -05:00
Mike Frysinger
faa2df1159 more whitespace cleanup
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-17 04:49:12 -05:00
Mike Frysinger
711713d664 start-stop-daemon: use termios.h rather than sys/termios.h
POSIX specifies termios.h, not sys/termios.h.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-17 04:48:13 -05:00
Robin H. Johnson
b2d0656814 Style fix: "char *foo" not "char* foo". 2011-01-17 08:46:41 +00:00
Robin H. Johnson
c0a3e25d48 Style fix: /* */ comments not // comments. 2011-01-17 08:43:40 +00:00
Robin H. Johnson
0c93f4df32 Style fix: "while (" not "while(". 2011-01-17 08:42:28 +00:00
Robin H. Johnson
b1fcf4ce9c Style fix: "if (" not "if(". 2011-01-17 08:41:02 +00:00
Robin H. Johnson
6804edfc85 Better error checking of argc for --applet call. 2011-01-17 08:39:44 +00:00
Robin H. Johnson
bfb87f2d51 Use xstrdup for style. 2011-01-17 08:34:03 +00:00
Robin H. Johnson
e6fc30da61 Clean up all trailing whitespace in src/. 2011-01-17 08:28:43 +00:00
Robin H. Johnson
49339525a9 Bug #351712: Implement --applet selection mode for SELinux wrappers.
In addition to detecting what multicall applet we want via argv[0],
provide an explicit override mode with a --applet initial argument.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2011-01-17 07:37:43 +00:00
Robin H. Johnson
b00ad439a6 Add new option -F to rc-depend tool, so that we can debug user deptree files easily. 2011-01-17 06:53:50 +00:00
Robin H. Johnson
0e90ae266a Factor out new function rc_deptree_load_file to aid in debugging deptree files from users. Loads from a given filename instead of the hardcoded RC_DEPTREE_CACHE define. 2011-01-17 06:32:46 +00:00
Eray Aslan
66abbefd6c bug 351160: make openrc exit codes LSB compliant
* status on a stopped service now has a return code of 3 (was 1)
* starting an already started service now has a return code of 0 (was 1)
* stopping an already stopped service now has a return code of 0 (was 1)
2011-01-12 19:46:11 -06:00
Robin H. Johnson
647df8cfe7 Make sure old rc_sys code never runs if the rc_sys variable exists.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2011-01-05 22:33:03 -08:00
Robin H. Johnson
3d4d1ab14b Remove broken automatic LXC subsystem detection.
Any system using cgroups was being detected as an LXC system. This was
triggering on OpenVZ under RHEL6 as well as the "automated per tty task
groups" as discussed on the LKML.

All LXC users should now switch to the new rc_sys variable introduced in
the previous patch.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2011-01-05 22:09:34 -08:00
Robin H. Johnson
09f990a7c8 Implement explicit selection of subsystem types.
- Fixes bugs #347583, #349389, both of which were triggered by cgroups
  being detected as the LXC subsystem type.
- Makes it much easier to select "prefix" type.
- "rc -S" will now print a warning if you have not configured rc_sys in
  /etc/rc.conf
- All other semantics of rc_sys are unchanged in this patch.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2011-01-05 22:09:34 -08:00
Thomas Pfaff
062223a5df Avoid race condition in runscript (bug #319865)
Under normal conditions, runscript creates one child and waits for its
termination, which is signaled by a pipe write from the SIGCHLD
sighandler.

When running killprocs however more than one SIGHCLD signal is generated, at
least on all of my amd64 boxes running on real hardware and in vmware.

When the first SIGCHLD occurs svc_exec leaves the loop and closes the pipe.
Subsequent SIGCHLDs during the close can lead to a race condition and create an
EBADF error in the pipe write (pipe is closed but the file handle is still !=
-1).

We avoid this by blocking SIGHCHLD during the pipe close.
2010-12-03 14:01:28 -06:00
Mike Frysinger
3036b44798 restore init.d pause option 2010-04-09 02:19:40 -04:00
Mike Frysinger
acc0edb040 restore old e* func output
Gentoo has always used the sytle:
 * moo ...                [ ok ]
Latest openrc now does:
* moo...                    [ok]

Realistically, 4 spaces out of 80 on reduced terminals doesn't make any
sort of realistic difference and it's been just fine for the last 10
years, so keep the default behavior.
2010-04-09 02:19:40 -04:00
Roy Marples
4d86d34635 Fix -s and -S. 2010-03-26 22:10:03 +00:00
Roy Marples
7271449a0c Fix two leaks. 2010-03-17 20:37:47 +00:00
Mike Frysinger
ecf9ef49a7 random spelling fixes
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-01-08 22:02:51 +00:00
Roy Marples
dc3ccd8101 start-stop-daemon can now set process IO scheduling. 2009-12-14 08:47:48 +00:00
Roy Marples
509e34d425 Only allow one service to be provided by default.
Fixes Gentoo #293139.
2009-11-14 08:37:05 +00:00
Roy Marples
0de1d18d41 Fix logic 2009-11-13 22:29:01 +00:00
Roy Marples
80d4ce3a11 Add a --warn option to just warn when reference file does not exist.
Fixes Gentoo #291894.
2009-11-13 21:31:09 +00:00
Roy Marples
95ee39ab1c Add support for Linux Containers, fixes #202.
Patch by bug reporter.
2009-11-04 19:21:24 +00:00
Roy Marples
ac6808a73e Regenerate version.h if necessary 2009-10-16 08:13:34 +01:00
William Hubbs
c96a015742 fix wait time for gentoo bug 288495
The wait time was in seconds.  This patch converts it to milliseconds.
2009-10-15 20:25:01 +01:00
Roy Marples
a8f6a9b654 Add new utility and init script swclock that sets the system time based on
the mtime of a file. It saves the shutdown time to this file also.
This is handy for systems without a working RTC chip.
Based on an idea by Michael A. Smith <michael@smith-li.com>.
Fixes Gentoo #272073.
2009-10-13 08:03:45 +01:00
Roy Marples
07f9be7b1c Add pkg-config support, fixes #187. 2009-10-08 00:20:43 +01:00
Roy Marples
42ca23b878 Don't quote opts 2009-09-21 19:05:47 +01:00
Roy Marples
3dc712e222 Allow init scripts to show their dependencies easier 2009-09-04 16:00:08 +01:00
Roy Marples
44585fea46 Add -P to start-stop-daemon to display a . for each second elapsed.
Fixes #197.
2009-09-04 15:41:08 +01:00
Roy Marples
6e485bde39 Really fix --signal 0 2009-09-04 13:32:59 +01:00
Roy Marples
2ea1df634e Fix signed error. 2009-09-04 13:24:26 +01:00
Roy Marples
7012630302 Allow any valid numeric signal and not just what we define. 2009-09-01 13:57:45 +01:00
Roy Marples
7fbb6ad427 Don't provide ourself, fixes #190 2009-07-20 19:42:15 +01:00
Roy Marples
b4104957b1 We should use -feature instead of nofeature.
This matches the ifconfig and Gentoo USE flag syntax and is hopefully
easier to read.
Fixes #178.
2009-07-01 00:07:32 +01:00
Roy Marples
6abeec7430 Use rc_getline instead of assuming a fixed kernel cmdline length.
This is now requires as COMMAND_LINE_SIZE isn't exposed by kernel
headers anymore.
Fixes #177.
2009-06-21 12:20:53 +01:00
Roy Marples
c3e9a7ec14 Warn about going inactive correctly. 2009-06-01 20:10:42 +01:00
Roy Marples
c0fd1b49e4 Move non compiled libraries from /lib/rc to /libexec/rc
OpenRC version is now stored as plaintext in /libexec/rc/version

Plugins (cursplash, splashutils) will have to be re-compiled to pickup
the new directories. State data needs to be moved from /lib/rc/init.d
to /libexec/rc/init.d as well.
2009-05-23 20:38:12 +01:00
Roy Marples
5294abe617 If already started or stopped, abort. 2009-05-17 12:29:46 +01:00
Roy Marples
b2eb9f8a83 Unset PAM environment variables if not set 2009-05-07 12:20:59 +01:00
Roy Marples
7c81f74b60 Fix compile on NetBSD 2009-05-05 16:39:59 +01:00
Roy Marples
43063ae7c2 Fix compile on NetBSD and FreeBSD 2009-05-05 10:24:21 +01:00
Roy Marples
6615eb4b68 Add runlevel stacking, #88
This implementation has the limitation that you cannot have a stacked
runlevel and service of the same name in a runlevel.
2009-05-02 12:26:45 +01:00
Roy Marples
e040bd77e9 Ignore test results 2009-05-02 12:18:34 +01:00
Roy Marples
658a220638 Add (c) to Copyright 2009-05-01 15:11:40 +01:00
Roy Marples
fb051bf81a Add -i, --ifexists so that we can do this
rc-sercice -i foo -- restart
instead of this
  rc-service -e foo && rc-service foo -- restart
2009-05-01 08:38:57 +01:00
Roy Marples
caf29a6480 Fix git versioning 2009-05-01 00:15:20 +01:00
Roy Marples
f689187966 Add -Z, --dry-run option to show which services we would start/stop
without actually doing so.
Fixes #151.
2009-04-30 23:42:01 +01:00
Roy Marples
3d0e5175d8 Avoid more gcc warning about not checking return values ... 2009-04-30 19:56:43 +01:00
Roy Marples
21e45e895c Brand with git version instead of svn 2009-04-30 19:16:31 +01:00
Juan RP
a1e40e9beb Fix parens 2009-04-30 16:45:18 +01:00
Roy Marples
b70501ef45 Go back to git 2009-04-30 15:05:39 +01:00
Roy Marples
e0f0fc8046 Don't start services when their need dependency is broken 2009-04-28 08:29:02 +00:00
Roy Marples
94b3057571 Add the noshutdown keyword to special case the shutdown. 2009-04-27 12:04:33 +00:00
Roy Marples
338c93733d Fix the nstop keyword. 2009-04-27 09:06:30 +00:00