Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,24 @@ file systems and expects / to be mounted before /usr, you will need to
make sure the appropriate pieces are installed on / by passing the
appropriate options to "meson setup" as follows:

```
```shell
$ meson setup \
--bindir /bin --libdir /lib64 --libexecdir /lib --sbindir /sbin \
build_path
build
```
### Custom openrc directory

If you want to install openrc into a custom directory such as /opt/openrc
```shell
$ CUSTOM_PREFIX=/opt/openrc && meson setup
--prefix="$CUSTOM_PREFIX" --bindir=bin --sbindir=sbin --sysconfdir="$CUSTOM_PREFIX/etc" \
build
```
After, setting it up install openrc by this command.
```shell
$ meson install --destdir='' -C build
```
In our case, openrc is going to be correctly installed at /opt/openrc

## Discussions

Expand Down
7 changes: 7 additions & 0 deletions src/librc/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ rc_h_conf_data.set('RC_PLUGINDIR', pluginsdir)
rc_h_conf_data.set('LOCAL_PREFIX', local_prefix)
rc_h_conf_data.set('PKG_PREFIX', pkg_prefix)
rc_h_conf_data.set('SYSCONFDIR', get_option('sysconfdir'))
rc_h_conf_data.set('SBINDIR', sbindir)

rc_init_bindir = bindir
if rc_init_bindir != '/bin'
rc_init_bindir += ':/bin'
endif
rc_h_conf_data.set('RC_INIT_BINDIR', rc_init_bindir)

librc_sources = [
'librc.c',
Expand Down
1 change: 1 addition & 0 deletions src/librc/rc.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ extern "C" {
#define RC_PLUGINDIR "@RC_PLUGINDIR@"

#define RC_INIT_FIFO RC_SVCDIR"/init.ctl"
#define RC_INIT_DEFAULT_PATH "@SBINDIR@:/usr/sbin:@RC_INIT_BINDIR@:/usr/bin"
#define RC_PROFILE_ENV RC_SYSCONFDIR "/profile.env"
#define RC_SYS_WHITELIST RC_LIBEXECDIR "/conf.d/env_whitelist"
#define RC_USR_WHITELIST RC_SYSCONFDIR "/conf.d/env_whitelist"
Expand Down
5 changes: 3 additions & 2 deletions src/openrc-init/openrc-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
# define CLOCK_MONOTONIC CLOCK_BOOTTIME
#endif

static const char *path_default = "/sbin:/usr/sbin:/bin:/usr/bin";
static const char *rc_default_runlevel = "default";
static int sigpipe[2] = { -1, -1 };
static bool quiet = false;
Expand Down Expand Up @@ -368,8 +367,10 @@ int main(int argc, char **argv)
#endif
reboot(RB_DISABLE_CAD);

if (!quiet)
printf("Setting environment PATH to %s\n", RC_INIT_DEFAULT_PATH);
/* set default path */
setenv("PATH", path_default, 1);
setenv("PATH", RC_INIT_DEFAULT_PATH, 1);

if (!reexec)
init(cmdline_runlevel);
Expand Down
Loading