Skip to content

Commit 82e41fe

Browse files
authored
Merge branch 'master' into rc-status-checks
2 parents 6d586dc + cadc1d2 commit 82e41fe

23 files changed

Lines changed: 94 additions & 179 deletions

FEATURE-REMOVAL-SCHEDULE.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,6 @@ Why: Obsolete or replaced by other options.
2626

2727
Who:
2828

29-
# runscript and rc symbolic links
30-
31-
When: 1.0
32-
33-
Why: Deprecated in favor of openrc-run and openrc due to naming
34-
conflicts with other software.
35-
36-
Who:
37-
3829
# support for the opts variable in service scripts
3930

4031
When: 1.0
@@ -67,13 +58,3 @@ Who:
6758
If you have a c program that links to librc and uses functions from
6859
there, this section will list API functions which are deprecated and
6960
will be removed along with the reason they are being removed.
70-
71-
## rc_getline()
72-
73-
When: 1.0
74-
75-
Why: The getline() function was standardized in POSIX.1-2008, so it
76-
should be available on POSIX systems.
77-
78-
Who:
79-

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ We don't support building a static OpenRC with PAM.
1818
`LOCAL_PREFIX` should be set to where user maintained packages are.
1919
Only set `LOCAL_PREFIX` if different from `PKG_PREFIX`.
2020

21-
`ROOTPREFIX` should be set when the root path is different from '/'.
22-
2321
`rc` and `rc.shutdown` are the hooks from the BSD init into OpenRC.
2422

2523
`devd.conf` is modified from FreeBSD to call `/etc/rc.devd` which is a
@@ -32,6 +30,17 @@ Obviously, if you're installing this onto a system that does not use
3230
OpenRC by default then you may wish to backup the above listed files,
3331
remove them and then install so that the OS hooks into OpenRC.
3432

33+
If you are installing this onto a system which has separate / and /usr
34+
file systems and expects / to be mounted before /usr, you will need to
35+
make sure the appropriate pieces are installed on / by passing the
36+
appropriate options to "meson setup" as follows:
37+
38+
```
39+
$ meson setup \
40+
--bindir /bin --libdir /lib64 --libexecdir /lib --sbindir /sbin \
41+
build_path
42+
```
43+
3544
## Discussions
3645

3746
We are testing [discussions](https://github.com/OpenRC/openrc/discussions), so

man/openrc-run.8

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,9 +563,6 @@ Default runlevel chosen. Default is default.
563563
.It Va RC_SYS
564564
A special variable to describe the system more.
565565
Possible values are OPENVZ, XENU, XEN0, UML and VSERVER.
566-
.It Va RC_PREFIX
567-
In a Gentoo Prefix installation, this variable contains the prefix
568-
offset. Otherwise it is undefined.
569566
.It Va RC_UNAME
570567
The result of `uname -s`.
571568
.It Va RC_CMD

meson.build

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,23 +79,15 @@ else
7979
pkg_prefix = option_pkg_prefix
8080
endif
8181

82-
rootprefix = get_option('rootprefix')
83-
if rootprefix == ''
84-
rootprefix = '/'
85-
endif
86-
87-
bindir = rootprefix / get_option('bindir')
88-
libdir = rootprefix / get_option('libdir')
89-
libexecdir = get_option('libexecdir')
90-
if os == 'Linux' and libexecdir == 'libexec'
91-
libexecdir = 'lib'
92-
endif
93-
libexecdir = rootprefix / libexecdir
82+
bindir = get_option('prefix') / get_option('bindir')
83+
libdir = get_option('prefix') / get_option('libdir')
84+
pluginsdir = libdir / 'rc/plugins'
85+
libexecdir = get_option('prefix') / get_option('libexecdir')
9486
rc_libexecdir = libexecdir / 'rc'
9587
rc_bindir = rc_libexecdir / 'bin'
9688
rc_sbindir = rc_libexecdir / 'sbin'
9789
rc_shdir = rc_libexecdir / 'sh'
98-
sbindir = rootprefix / get_option('sbindir')
90+
sbindir = get_option('prefix') / get_option('sbindir')
9991
pamdir = get_option('sysconfdir') / 'pam.d'
10092

10193
crypt_dep = []
@@ -230,7 +222,7 @@ if get_option('pkgconfig')
230222
libraries : librc,
231223
subdirs : ['openrc'],
232224
variables: {
233-
'rc_path': rc_libexecdir,
225+
'pluginsdir': pluginsdir,
234226
}
235227
)
236228
endif

meson_options.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ option('pkg_prefix', type : 'string',
1818
description : 'default location where packages are installed')
1919
option('pkgconfig', type : 'boolean',
2020
description : 'build PKGConfig files')
21-
option('rootprefix', type : 'string',
22-
description : 'override the root prefix')
2321
option('selinux', type : 'feature', value : 'auto',
2422
description : 'enable SELinux support')
2523
option('shell', type : 'string', value : '/bin/sh',

sh/functions.sh.in

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,10 @@ if [ -n "$ZSH_VERSION" ]; then
7979
fi
8080

8181
# Make a sane PATH
82-
_PREFIX=@PREFIX@
8382
_PKG_PREFIX=@PKG_PREFIX@
8483
_LOCAL_PREFIX=@LOCAL_PREFIX@
8584
_LOCAL_PREFIX=${_LOCAL_PREFIX:-/usr/local}
86-
_PATH=@LIBEXECDIR@/bin
87-
case "$_PREFIX" in
88-
"$_PKG_PREFIX"|"$_LOCAL_PREFIX") ;;
89-
*) _PATH="$_PATH:$_PREFIX/bin:$_PREFIX/sbin";;
90-
esac
91-
_PATH="$_PATH":/bin:/sbin:/usr/bin:/usr/sbin
85+
_PATH="@LIBEXECDIR@/bin:/bin:/sbin:/usr/bin:/usr/sbin"
9286

9387
if [ -n "$_PKG_PREFIX" ]; then
9488
_PATH="$_PATH:$_PKG_PREFIX/bin:$_PKG_PREFIX/sbin"

sh/meson.build

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
sh_conf_data = configuration_data()
2-
if rootprefix == '/'
3-
sh_conf_data.set('PREFIX', '')
4-
else
5-
sh_conf_data.set('PREFIX', rootprefix)
6-
endif
72
sh_conf_data.set('BINDIR', bindir)
83
sh_conf_data.set('LIBEXECDIR', rc_libexecdir)
94
sh_conf_data.set('LOCAL_PREFIX', local_prefix)

src/kill_all/kill_all.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static bool is_user_process(pid_t pid)
115115
temp_pid = -1;
116116
while (!feof(fp)) {
117117
buf = NULL;
118-
if (getline(&buf, &size, fp) != -1) {
118+
if (xgetline(&buf, &size, fp) != -1) {
119119
sscanf(buf, "PPid: %d", &temp_pid);
120120
free(buf);
121121
} else {

src/librc/librc-daemon.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ rc_find_pids(const char *exec, const char *const *argv, uid_t uid, pid_t pid)
140140
if (exists("/proc/self/status")) {
141141
fp = fopen("/proc/self/status", "r");
142142
if (fp) {
143-
while (!feof(fp)) {
144-
rc_getline(&line, &len, fp);
143+
while (xgetline(&line, &len, fp) != -1) {
145144
if (strncmp(line, "envID:\t0", 8) == 0) {
146145
openvz_host = true;
147146
break;
@@ -196,8 +195,7 @@ rc_find_pids(const char *exec, const char *const *argv, uid_t uid, pid_t pid)
196195
free(buffer);
197196
if (!fp)
198197
continue;
199-
while (!feof(fp)) {
200-
rc_getline(&line, &len, fp);
198+
while (xgetline(&line, &len, fp) != -1) {
201199
if (strncmp(line, "envID:", 6) == 0) {
202200
container_pid = !(strncmp(line, "envID:\t0", 8) == 0);
203201
break;
@@ -346,7 +344,7 @@ _match_daemon(const char *path, const char *file, RC_STRINGLIST *match)
346344
if (!fp)
347345
return false;
348346

349-
while ((rc_getline(&line, &len, fp))) {
347+
while (xgetline(&line, &len, fp) != -1) {
350348
TAILQ_FOREACH(m, match, entries)
351349
if (strcmp(line, m->value) == 0) {
352350
TAILQ_REMOVE(match, m, entries);
@@ -559,7 +557,7 @@ rc_service_daemons_crashed(const char *service)
559557
if (!fp)
560558
break;
561559

562-
while ((rc_getline(&line, &len, fp))) {
560+
while (xgetline(&line, &len, fp) != -1) {
563561
p = line;
564562
if ((token = strsep(&p, "=")) == NULL || !p)
565563
continue;

src/librc/librc-depend.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ rc_deptree_load_file(const char *deptree_file)
160160
RC_DEPINFO *depinfo = NULL;
161161
RC_DEPTYPE *deptype = NULL;
162162
char *line = NULL;
163-
size_t len = 0;
164-
ssize_t size;
163+
size_t size;
165164
char *type;
166165
char *p;
167166
char *e;
@@ -171,8 +170,7 @@ rc_deptree_load_file(const char *deptree_file)
171170
return NULL;
172171

173172
deptree = make_deptree();
174-
while ((size = getline(&line, &len, fp)) != -1) {
175-
line[size - 1] = '\0';
173+
while (xgetline(&line, &size, fp) != -1) {
176174
p = line;
177175
e = strsep(&p, "_");
178176
if (!e || strcmp(e, "depinfo") != 0)
@@ -788,8 +786,7 @@ rc_deptree_update(void)
788786
RC_STRINGLIST *config, *dupes, *types, *sorted, *visited;
789787
RC_STRING *s, *s2, *s2_np, *s3, *s4;
790788
char *line = NULL;
791-
size_t len = 0;
792-
ssize_t size;
789+
size_t size;
793790
char *depend, *depends, *service, *type;
794791
size_t i, l;
795792
bool retval = true;
@@ -811,8 +808,7 @@ rc_deptree_update(void)
811808
config = rc_stringlist_new();
812809

813810
deptree = make_deptree();
814-
while ((size = getline(&line, &len, fp)) != -1) {
815-
line[size - 1] = '\0';
811+
while (xgetline(&line, &size, fp) != -1) {
816812
depends = line;
817813
service = strsep(&depends, " ");
818814
if (!service || !*service)
@@ -894,8 +890,8 @@ rc_deptree_update(void)
894890
* work for them. This doesn't stop them from being run directly. */
895891
if (sys) {
896892
char *nosys, *onosys;
893+
size_t len = strlen(sys);
897894

898-
len = strlen(sys);
899895
nosys = xmalloc(len + 2);
900896
nosys[0] = '-';
901897
for (i = 0; i < len; i++)

0 commit comments

Comments
 (0)