Skip to content

Commit 7e647d6

Browse files
committed
librc: add build option to set default RC_PATH
distros, namely debian, want to keep sysvinit scripts for compatibility, while moving to openrc native scripts slowly having /etc/init.d in the search path before /usr/libexec/rc/init.d makes that transition almost impossible the recommendation for most distros is to leave the path untouched or as close to the default as possible
1 parent df6e94a commit 7e647d6

3 files changed

Lines changed: 23 additions & 15 deletions

File tree

meson_options.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,11 @@ option('uucp_group', type : 'string', value : 'uucp',
2727
option('agetty', type: 'array',
2828
value: ['tty1', 'tty2', 'tty3', 'tty4', 'tty5', 'tty6'],
2929
description : 'agetty symlinks to install when sysvinit is also specified')
30+
option('rc_path', type: 'array',
31+
description : '''compile-time default RC_PATH, if unset, defaults to:
32+
$sysconfdir/rc, $sysconfdir, $local_prefix/etc/rc, $local_prefix, $libexecdir/rc
33+
34+
consider using the runtime environment variable RC_PATH over setting this, though
35+
if setting a custom compile-time time is strictly necessary, it is recommended to
36+
set it as close to the default as possible
37+
''')

src/librc/librc.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -555,21 +555,7 @@ rc_runlevel_stacks(const char *runlevel)
555555
return stack;
556556
}
557557

558-
static const char *config_path[] = {
559-
RC_SYSCONFDIR "/rc",
560-
RC_SYSCONFDIR,
561-
#ifdef RC_LOCAL_PREFIX
562-
RC_LOCAL_PREFIX "/etc/rc",
563-
RC_LOCAL_PREFIX "/etc",
564-
#endif
565-
#ifdef RC_PKG_PREFIX
566-
RC_PKG_PREFIX "/etc/rc",
567-
RC_PKG_PREFIX "/etc",
568-
#endif
569-
RC_LIBEXECDIR,
570-
RC_SVCDIR,
571-
NULL,
572-
};
558+
static const char *config_path[] = { _RC_PATH, NULL };
573559

574560
static struct {
575561
bool set;

src/librc/meson.build

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,27 @@ librc_sources = [
1212
'librc-stringlist.c',
1313
]
1414

15+
sysconfdir = get_option('sysconfdir')
16+
rc_path = get_option('rc_path')
17+
if rc_path.length() == 0
18+
rc_path = [
19+
sysconfdir / 'rc',
20+
sysconfdir,
21+
local_prefix / 'rc',
22+
local_prefix,
23+
rc_libexecdir,
24+
]
25+
endif
26+
rc_path += '/run/openrc'
27+
1528
rc_h = configure_file(input : 'rc.h.in', output : 'rc.h',
1629
configuration : rc_h_conf_data)
1730

1831
rc = declare_dependency(
1932
include_directories: '.',
2033
sources: rc_h,
2134
link_with: library('rc', librc_sources,
35+
c_args: [ '-D_RC_PATH="@0@"'.format('","'.join(rc_path)) ],
2236
dependencies: kvm_dep,
2337
include_directories : incdir,
2438
link_depends : 'rc.map',

0 commit comments

Comments
 (0)