Commit Graph

47 Commits

Author SHA1 Message Date
William Hubbs
4e0eace837 librc: Add crashed state 2018-05-22 12:19:22 -05:00
William Hubbs
13ca79856e add init process
openrc-init.c and openrc-shutdown.c are based on code which was written by
James Hammons <jlhamm@acm.org>, so I would like to publically
thank him for his work.
2017-04-06 17:13:59 -05:00
Doug Freed
36dde4e7f2 librc: fix handling the nothing special case for rc_sys 2016-01-19 00:09:20 -06:00
William Hubbs
000503fad7 Convert OpenRC to a centralized copyright/license structure
In the past, OpenRC was a hybrid of a centralized and file-scope
license/copyright structure.

I followed the instructions from the Software Freedom Law Center [1] to
convert to a Centralized structure where possible, for easier future
maintenance.

[1] https://softwarefreedom.org/resources/2012/ManagingCopyrightInformation.html
2015-12-21 12:16:06 -06:00
William Hubbs
a0cf8f9124 Add detection for rkt containers 2015-12-02 10:20:39 -06:00
William Hubbs
9fedb3b40b Add detection for docker containers 2015-12-02 10:20:15 -06:00
William Hubbs
635e33cdc8 librc: comsolidate rc_sys_v1 and rc_sys_v2 into rc_sys
These functions were never meant to be used outside of OpenRC, and they
were added when we thought we were going to do away with the automatic
detection of subsystems. Since the autodetection is not going away, we
can combine these functions into rc_sys.
2015-12-01 17:39:04 -06:00
William Hubbs
c09eeca491 Add rc.conf.d support
This makes it possible to override settings in rc.conf by adding a
directory @SYSCONFDIR@/rc.conf.d and putting files in this directory.
The files will be processed in lexical order, and the last setting in
these files will be used.
2015-11-05 10:40:24 -06:00
William Hubbs
c709e6077c Add support for systemd-nspawn containers
This adds support for running OpenRC in a container created by
the systemd-nspawn utility.

This fixes #52.

X-Gentoo-Bug: 548058
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=548058
2015-05-01 09:04:07 -05:00
William Hubbs
7700e6fe79 Fix compile errors created by bundling queue.h 2014-10-24 10:44:14 -05:00
Anthony G. Basile
1e0a4bebde Bundle <sys/queue.h> from NetBSD
We are bundling this to allow building on musl-based systems since musl
does not include <sys/queue.h>.
2014-10-23 19:14:06 -05:00
William Hubbs
ca6b86be44 Fix all tests for GNU/kFreeBSD
It is necessary to check for both the kernel and c library because
__FreeBSD_kernel is also defined on native FreeBSD [1].

[1] http://sourceforge.net/p/predef/wiki/OperatingSystems/
2014-10-23 18:47:24 -05:00
Gabriele Giacone
4ac289b539 Fix rc_svcdir for GNU/Hurd 2014-10-23 13:05:08 -05:00
Gabriele Giacone
89c8a62a10 Fix rc_svcdir for GNU/kFreeBSD 2014-10-22 13:27:37 -05:00
Anthony G. Basile
86e9aa0d36 einfo.h, rc.h.in: simplify __BEGIN_DECLS logic
There is no need to redefine __BEGIN_DECLS and __END_DECLS.
We simplify the logic here and avoid undefining these macros.
2014-10-22 07:46:49 -04:00
Anthony G. Basile
4a08517cac einfo.h, rc.h.in: ensure __BEGIN_DECLS is defined
Some Standard C Libraries, like musl, don't define __BEGIN_DECLS
or __END_DECLS.  We add some ifdef magic to ensure these are
available.
2014-10-21 09:39:34 -04: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
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
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
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
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
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
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
Christian Ruppert
c3be42006b Rename proc_getent to rc_proc_getent and make it global 2012-01-15 01:02:11 +01: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
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
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
Robin H. Johnson
e6fc30da61 Clean up all trailing whitespace in src/. 2011-01-17 08:28:43 +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
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
95ee39ab1c Add support for Linux Containers, fixes #202.
Patch by bug reporter.
2009-11-04 19:21:24 +00: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
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
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
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
e0dfa472d1 Add new functions, rc_stringlist_find and rc_stringlist_split. 2008-09-18 15:12: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
83ade5b701 Style. 2008-06-04 12:44:45 +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