Commit Graph

257 Commits

Author SHA1 Message Date
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
Mike Frysinger
ecf9ef49a7 random spelling fixes
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-01-08 22:02:51 +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
95ee39ab1c Add support for Linux Containers, fixes #202.
Patch by bug reporter.
2009-11-04 19:21:24 +00:00
Roy Marples
42ca23b878 Don't quote opts 2009-09-21 19:05:47 +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
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
7c81f74b60 Fix compile on NetBSD 2009-05-05 16:39:59 +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
658a220638 Add (c) to Copyright 2009-05-01 15:11:40 +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
0feddbd815 Use kill for the pid check as it's fast. 2009-04-25 20:44:13 +00:00
Roy Marples
bd211d534b We should match the full variable name. 2009-04-24 11:45:48 +00:00
Roy Marples
ade85d4bd8 Improve style for KNF 2009-04-23 21:31:22 +00:00
Roy Marples
907ca8a89f Set errno when service does not exist better. 2009-02-28 14:12:03 +00:00
Roy Marples
6cc68e21cf Fix return value for tests. 2009-02-12 10:43:30 +00:00
Roy Marples
415fe87d8c Clean up some compiler warnings. 2009-01-29 13:29:04 +00:00
Roy Marples
fcf1cce549 rc_newer/older_than only report file if time_t is a pointer, so it
should take precedence in the argument list.
2009-01-13 09:11:31 +00:00
Roy Marples
3d37005a3d We now warn about clock skews
rc-update -u will force a regen of the dep tree
rc_newer_than and rc_olderthan now take another two parameters for newest/oldest file and mtime
2009-01-12 23:53:13 +00:00
Roy Marples
f23822e082 Copyright 2009-01-12 10:24:00 +00:00
Roy Marples
8a9a2d5fe9 Use snprintf instead of strlcpy to save on size if not available. 2009-01-12 08:31:03 +00:00
Roy Marples
2c98c5326a Punt .gitignore files. 2008-12-04 12:12:09 +00:00
Roy Marples
2cf24fe793 Ignore after dependencies for shutdown when not in the runlevel. 2008-11-04 09:32:21 +00:00
Roy Marples
77d56f5489 Avoid depends not in the runlevel for sysinit and shutdown. 2008-11-03 23:13:12 +00:00
Roy Marples
0af7d5bc20 Add a new shutdown runlevel, Gentoo #224537.
Split halt.sh into halt, killprocs, romount and savecache services.
The reboot runlevel is removed but mapped to shutdown.
The halt script should be moved to the sysvinit package.
2008-11-03 15:31:01 +00:00
Roy Marples
50b8aba8d9 Remove coldplug and just have hotplug which is a list of allowed/disallowed services. Makes things much easier. 2008-10-10 09:08:59 +00:00
Roy Marples
d6da8e8c48 sysinit is now a real runlevel that handles things like udev, dmesg and
mounting various bits in /dev and /sys.
init.sh JUST mounts /lib/rc/init.d (and /proc for Linux systems)
To make development of this easier we now return an empty RC_STRINGLIST
instead of a NULL for empty things.

If you don't have a udev init script installed, don't reboot your box OR
roll back to an older OpenRC version.
2008-10-10 08:37:21 +00:00
Roy Marples
13d88731b7 We don't check exec when starting, so don't when testing for crashed. 2008-09-22 20:07:14 +00:00
Roy Marples
6b3d8cf598 Fix stopping wpa_supplicant incorrectly, #107 2008-09-19 11:24:21 +00:00
Roy Marples
e368a4b4f8 Add missing profile bits to env, #72. 2008-09-18 19:46:10 +00:00
Roy Marples
312d6f3e57 Work with NULL lists. 2008-09-18 15:32:57 +00:00
Roy Marples
e0dfa472d1 Add new functions, rc_stringlist_find and rc_stringlist_split. 2008-09-18 15:12:43 +00:00
Roy Marples
15678263d5 Add new OpenVZ detection code 2008-08-19 06:36:43 +00:00
Roy Marples
cea206014d Attempt to make s-s-d simpler by not enforcing the need for a full path and maybe working better with interpreted scripts. 2008-07-27 11:30:49 +00:00
Roy Marples
7a6112d3b0 Punt STAILQ and just use TAILQ so we're a bit more portable. 2008-07-07 14:16:46 +00:00
Roy Marples
a88a177f99 Add older_than function to complement newer_than function. Also make the userland instance reversed to be compatable with current baselayout, which truely does suck. 2008-07-03 13:11:47 +00:00
Roy Marples
11acce3c7d Use CPPFLAGS so we work with -combine in CFLAGS. 2008-06-19 23:12:00 +00:00
Roy Marples
bf8f0da921 fuzzy dependency ordering should be started, starting, stopped whilst checking runlevel, bootlevel, any at each stage. 2008-06-10 15:19:46 +00:00
Roy Marples
2adc99a8f5 No need to include this. 2008-06-05 12:26:53 +00:00
Roy Marples
dc891b0647 Remove broken before dependencies, Gentoo #224171. 2008-06-05 10:14:11 +00:00
Roy Marples
3525e602d6 Use addu instead of another loop. 2008-06-04 19:07:09 +00:00
Roy Marples
79ebd89d19 Only add a backreference if it doesn't already exist. 2008-06-04 19:00:46 +00:00
Roy Marples
e6aed12328 No need to check type twice like this. 2008-06-04 12:47:06 +00:00
Roy Marples
83ade5b701 Style. 2008-06-04 12:44:45 +00:00
Roy Marples
1df3ab05b5 realloc -> xrealloc 2008-05-19 13:41:16 +00:00
Roy Marples
775df18a70 Fix a potential segfault, thanks to Fernando J. Pereda. 2008-05-19 13:16:53 +00:00
Roy Marples
f13ea77491 The real fix for the last commit is to uncomment some code - d'oh. 2008-05-12 23:33:40 +00:00
Roy Marples
6d5d655b52 Style. 2008-05-12 23:00:05 +00:00
Roy Marples
5188fd2592 Wups, test compiles before commiting :) 2008-04-30 16:33:54 +00:00
Roy Marples
5b800030f1 Remove redundant checking of /proc/pid/exe 2008-04-30 16:26:05 +00:00
Roy Marples
208443fa0e Save a few bytes and make it easier to read. 2008-04-30 15:26:29 +00:00
Roy Marples
a818eebf7b No need to init this. 2008-04-30 12:26:38 +00:00
Roy Marples
10910876d1 Make the function a little smaller. 2008-04-30 10:55:42 +00:00
Roy Marples
35b4978152 Style 2008-04-30 10:31:06 +00:00
Roy Marples
3c2b93fc9c Check we have a list before running depends. 2008-04-26 14:59:07 +00:00
Roy Marples
b5d829789f Check we have a list before running depends. 2008-04-26 14:57:39 +00:00
Roy Marples
54d7aa39dd If we don't have permission to inspect the pidfile, don't report crashed. Gentoo #218028. 2008-04-21 10:56:28 +00:00
Roy Marples
dc5d63aa97 Add RC_TMPDIR so that there's a writeable location during boot. 2008-04-21 10:29:29 +00:00
Roy Marples
f0aacec02e Cast to unsigned char for ctype calls. 2008-04-17 10:19:58 +00:00
Roy Marples
99d5046a56 Don't assume that we have a list returned. 2008-04-10 08:49:05 +00:00
Roy Marples
8759735711 Give an error when running zap as a generic user. 2008-04-08 22:57:42 +00:00
Roy Marples
e995404e3b Add XEN support to NetBSD. 2008-03-28 16:10:31 +00:00
Roy Marples
caa4704ce6 Merge branch 'master' of git@git.overlays.gentoo.org:proj/openrc 2008-03-28 16:05:11 +00:00
Roy Marples
17d28fde42 Support XEN on NetBSD 2008-03-28 16:04:48 +00:00
Roy Marples
b418f2e471 Allow our headers to be included by C++ programs easily. 2008-03-28 11:06:47 +00:00
Roy Marples
ee4e861796 Put some dir locations in rc.h so that 3rd party apps can become awware of them. 2008-03-28 10:46:12 +00:00
Roy Marples
11e33e81c8 Remove rc_service_start/stop from librc as they block and unmask signals. The application may not wish this behaviour and should fork/exec the service itself. 2008-03-28 08:42:05 +00:00
Roy Marples
15d34d0a16 Add license blurb to a few files and append my email to my name. 2008-03-26 17:53:37 +00:00
Roy Marples
cee3ccc4c1 Fix a segfault if rc.conf does not exist, Gentoo #214887 2008-03-26 15:10:26 +00:00
Roy Marples
821166fbfd Fix debug support to work without gmake and bundle -ggdb in properly. 2008-03-24 11:43:03 +00:00
Roy Marples
79719b5386 Fix adding services to the boot runlevel, #43 2008-03-24 10:13:49 +00:00
Mike Frysinger
7b08276fa8 add missing rc_stringlist_new/rc_sys hidden defs 2008-03-24 06:24:46 +00:00
Roy Marples
a1b9768243 Fix returning a service descriptions. 2008-03-23 22:58:25 +00:00
Roy Marples
e505e6ea41 We should only free the buffer when done reading the dir. 2008-03-21 08:31:04 +00:00
Roy Marples
eea30772d4 Fix last commit. 2008-03-19 22:11:22 +00:00
Roy Marples
d9ec62b22a Add rc-service and update all softlevel refs to runlevel. 2008-03-19 17:11:50 +00:00
Roy Marples
64853c4916 Rejig the build system a little so we have per ok defs per system. Probably easier in the long run. 2008-03-19 15:22:20 +00:00
Roy Marples
f69013adbe Fix define name 2008-03-19 15:15:09 +00:00
Roy Marples
cdd3881c1b Return scheduled services correctly. 2008-03-19 12:26:09 +00:00
Roy Marples
51c825ceee Make rc_getline private and save it's buffer so it's sort of like getline from glibc. 2008-03-17 21:27:37 +00:00
Roy Marples
c74cfabe2e init some vars. 2008-03-17 16:42:31 +00:00
Roy Marples
5d77c0db6b This should be a fixed buffer. 2008-03-17 14:42:10 +00:00
Roy Marples
b2f7606b23 We should check for NULL here. 2008-03-17 14:31:44 +00:00
Roy Marples
4c14666423 Punt the rc_strcatpaths function and use snprintf instead to save on expensive malloc calls. 2008-03-17 13:25:56 +00:00
Roy Marples
50a7697bf2 rc_find_pids now returns RC_PIDLIST instead of a NULL terminated array. 2008-03-17 09:59:52 +00:00
Roy Marples
40930d7d0a Use correct TAILQ_CONCAT macro when not defined. 2008-03-16 17:27:13 +00:00
Roy Marples
1fd1472dde Add new stringlist files. 2008-03-16 17:01:35 +00:00
Roy Marples
cb9da6a262 Remove null terminated char ** lists in favour of RC_STRINGLIST, using TAILQ from queue(3). Refactor code style around the BSD KNF. 2008-03-16 17:00:56 +00:00
Roy Marples
4742e1ec69 d_type is not portable across filesystems. 2008-03-08 13:06:29 +00:00
Roy Marples
a689b66023 Add tunable SYSCONFDIR 2008-03-05 12:27:11 +00:00
Roy Marples
6baff6cd1d Don't store empty services. 2008-03-04 10:36:20 +00:00
Roy Marples
54afc10aa4 Sanitise the BSD defines a little. 2008-03-03 19:55:29 +00:00
Roy Marples
15cf41e713 Split VPS into VSERVER and OPENVZ 2008-03-03 17:19:56 +00:00
Roy Marples
f3e90dddbf rc single and rc sysinit don't check sysvinit env vars in prefix. 2008-03-03 15:57:36 +00:00
Roy Marples
b614477948 Fix ignore files some more. 2008-03-03 13:31:25 +00:00
Roy Marples
7a8e9d4ddb Add a gitignore make target. 2008-03-03 13:04:08 +00:00
Roy Marples
0aedc02860 Introduce LOCAL_PREFIX for a user maintained script location. 2008-03-03 10:33:42 +00:00
Roy Marples
5971d14afd Ensure that normal users can use s-s-d on NetBSD. 2008-03-03 09:57:48 +00:00
Roy Marples
c67c283b2a Fix prefix test. 2008-03-03 08:06:53 +00:00
Roy Marples
7c092fbc79 If build in a prefix, define the system as prefix. 2008-03-02 10:40:08 +00:00
Roy Marples
baf217acc7 Fix unused var. 2008-03-01 09:27:29 +00:00
Roy Marples
f092045650 Support the use of PREFIX and PKG_PREFIX. 2008-02-28 11:08:49 +00:00
Roy Marples
8b4b958678 Now that s-s-d accepts >1 argument for stopping a daemon on match we need to store all arguments used incase a service started the same daemon more than once with different paramters. 2008-02-23 00:26:11 +00:00
Roy Marples
ad780077d2 Welcome to 2008. 2008-02-22 12:07:34 +00:00
Roy Marples
7dec6f4025 Don't warn about removed services through use of the nosys keyword. 2008-02-19 22:04:24 +00:00
Roy Marples
d7129163ce Fix compile warning, and free removed depinfo's 2008-02-19 19:43:31 +00:00
Roy Marples
42dd9965cc Default to using C99 standard. 2008-02-19 16:49:28 +00:00
Roy Marples
916a4463ce Fix some warnings. 2008-02-19 16:05:42 +00:00
Roy Marples
79d40707db Fix compile on Linux. 2008-02-19 15:51:59 +00:00
Roy Marples
e1e36b2872 keywords -> keyword 2008-02-19 14:36:22 +00:00
Roy Marples
0364bb2c84 Add the nojail keyword which excludes services marked as such from the dependency tree when in a jail, #bug 22 2008-02-19 14:15:53 +00:00
Roy Marples
eedf63906d Fix compile on FreeBSD. 2008-02-18 16:26:49 +00:00
Roy Marples
b0442b3193 We need to check for contents of argv too. 2008-02-18 16:01:04 +00:00
Roy Marples
d904acf448 Fix a signed error. 2008-02-18 13:37:58 +00:00
Roy Marples
27f97f2106 We need to be able to locate pids by argv, instead of just argv0. 2008-02-17 15:12:00 +00:00
Roy Marples
9854f9e3ee Use _PATH_DEVNULL on FreeBSD when using kvm_openfiles so we work in a jail, bug #21. 2008-02-13 23:44:17 +00:00
Roy Marples
3198d81a1f Remove unsed vars 2008-02-10 23:13:09 +00:00
Roy Marples
4c6a66c3e9 Just restore the old set. 2008-02-04 21:48:05 +00:00
Roy Marples
08a5bdbcb3 RC_DEP_START/STOP should only be used for ordering services, and not the actual dependencies ofthe services themselves. This allows coldplugged services to satisfy the net dependency for rc ordering them correctly but not for services that require net and strict is on. 2008-02-03 23:27:16 +00:00
Roy Marples
5014968e83 Fix fork error message. 2008-02-02 22:17:44 +00:00
Roy Marples
7b27a12f6c OK, we have to use fork with sigprocmask as not all systems provide a working and sane kernel call to bypass libc. 2008-02-02 14:22:37 +00:00
Roy Marples
8830b50636 Fix compile on systems that do not expose SYS_sigaction. 2008-02-02 13:00:22 +00:00
Roy Marples
e2919519d7 Using syscall in a vfork is safe for sigaction and sigprogmask. 2008-02-02 00:38:06 +00:00
Roy Marples
ad04517623 Block signals to avoid fork /signal races. 2008-02-02 00:17:35 +00:00
Roy Marples
fef5d0af59 Constantise as much as possible so that it reduces COW usage. 2008-02-01 19:54:46 +00:00
Roy Marples
3f0381e3e6 Use the variable instead of type for sizeof. 2008-01-30 14:46:08 +00:00
Roy Marples
61e36be694 Add xzalloc function to reduce size. 2008-01-30 14:34:55 +00:00
Roy Marples
51a9c647b9 Allow !net to remove the net provision from dependencies. 2008-01-30 13:37:20 +00:00
Roy Marples
4bdfccc2c2 Fix adding net scripts to the boot runlevel. 2008-01-30 12:50:44 +00:00
Roy Marples
9ce3086bf5 Fix service_started_daemon, bug #11 2008-01-28 13:16:33 +00:00
Roy Marples
b4bff9ce5e Quiet some lint warnings. 2008-01-22 10:29:15 +00:00
Roy Marples
07728abbc1 Checking first char for null is more efficient than strlen. 2008-01-21 15:30:40 +00:00
Roy Marples
773c2b9ca6 We should never change the list passed to rc_config_value. 2008-01-18 14:01:48 +00:00
Roy Marples
c6774d1c74 If adding to the boot runlevel, ensure that the realpath of the resolved service points to /etc/init.d/$service 2008-01-15 19:47:48 +00:00
Roy Marples
3e0f49b846 rc_newer_than no longer tests if souce has data, making it a more logical function. As such, we add the existss function to check for existance and size when checking to see if the deptree needs an update. 2008-01-15 09:24:50 +00:00
Roy Marples
d695407114 Add support for is_newer_than and is_older_than. is_older_than currently doesn't work as expected, but is_newer_than works fine. 2008-01-14 08:12:37 +00:00
Mike Frysinger
6aab712cb4 strip trailing newlines 2008-01-14 05:05:22 +00:00
Roy Marples
87e4e4410c Remove rc_service_plugable function and make it private as it needs to read from our config file. 2008-01-13 17:47:23 +00:00
Roy Marples
abde759d5b Re-indent to a standard tw of 8. 2008-01-11 15:51:40 +00:00
Roy Marples
2d95c9a756 Loads of NetBSD tweaks here. 2008-01-10 23:22:46 +00:00
Roy Marples
4314784520 Allow for OS and SUBOS folders so we can introduce NetBSD scripts whilst keeping BSD for all BSD's. 2008-01-10 16:35:59 +00:00
Roy Marples
06634f6309 Style updates. 2008-01-09 11:44:43 +00:00
Roy Marples
2e35d2a73c Avoid valgrind errors with getline. 2008-01-07 19:12:58 +00:00
Roy Marples
81b8e5450e Really fix off by one error. 2008-01-07 15:27:26 +00:00
Roy Marples
fa898af791 Fix an off by one error. 2008-01-07 14:59:17 +00:00
Roy Marples
d22fc0dd93 Allow depend creation again. This doesn't work on GNU make, but does on all others. 2008-01-07 14:20:13 +00:00
Roy Marples
43d0f3fc76 rc_getline keeps expanding it's malloced buffer until it has read a whole line or EOF. All functions which read into static buffers have been changed to use fhis function to avoid any potential overflows and to ensure we really do read a long long config line. 2008-01-07 12:29:30 +00:00