Compare commits

..

12 Commits
0.41 ... 0.40.x

Author SHA1 Message Date
William Hubbs
4a3454966a Update ChangeLog 2018-12-21 12:24:18 -06:00
William Hubbs
63e40f31bf fix compiler warnings 2018-12-21 12:20:35 -06:00
William Hubbs
e43ee29eb4 supervise-daemon: do not use the exec_service() function
In order to run healthcheck() and the unhealthy() function, add an
exec_command call to the supervisor.
Another difference is This function also logs errors instead of
attempting to display them.

This is for #271.
2018-12-21 12:20:35 -06:00
William Hubbs
a3555b1442 Add debug logging to start-stop-daemon and rc-supervisor
This will make it easier to track down why the supervisor intermittently
hangs after it runs for a long time.
2018-12-21 12:20:35 -06:00
William Hubbs
eb863156fb version 0.40.3 2018-12-21 12:20:12 -06:00
William Hubbs
ac76b24b85 Update ChangeLog 2018-12-06 17:40:06 -06:00
William Hubbs
b8e57c693a init.d/agetty: set default respawn period to 60 seconds
Without a respawn period setting, the supervisor will give up on
respawning agetty after it is respawned respawn_max times. For most
daemons giving up like this is reasonable, but not for agettys. Agettys
should always be respawned unless they are respawning too fafst,.

If an agetty is respawning faster than 10 times in 60 seconds, this
seems to be too fast.
2018-12-06 16:56:20 -06:00
William Hubbs
5df12e2414 supervise-daemon: fix busy loop
This fixes #264.
2018-12-06 16:56:20 -06:00
William Hubbs
461df0c78b version 0.40.2 2018-12-06 16:55:51 -06:00
William Hubbs
cefae65392 Update ChangeLog 2018-12-04 17:27:46 -06:00
Alexander Zubkov
69fbd12993 supervise-daemon: redirect std{in,out,err} to /dev/null after demonizing
This fixes #239.
2018-12-04 17:23:27 -06:00
William Hubbs
4aa5686d90 version 0.40.1 2018-12-04 17:21:55 -06:00
57 changed files with 723 additions and 715 deletions

View File

@@ -1,15 +0,0 @@
# Cirrus CI integration
# https://cirrus-ci.org
test_task:
freebsd_instance:
matrix:
image: freebsd-12-0-release-amd64
image: freebsd-11-2-release-amd64
env:
OS: FreeBSD
procfs_script: >
[ -f /proc/curproc ] || mount -t procfs proc /proc
pkg_install_script: pkg install -y bash gawk gmake gsed
gsed_hack_script: rm /usr/bin/sed && ln -s /usr/local/bin/gsed /usr/bin/sed
test_script: bash ci/cirrus.sh

View File

@@ -9,20 +9,6 @@ os:
compiler:
- gcc
- clang
- musl-gcc
addons:
apt:
packages:
- musl-tools
notifications:
irc:
channels:
- "irc.freenode.org#openrc"
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: false # default: false
script:
- ./ci/travis.sh
- ./test/travis.sh

670
ChangeLog
View File

@@ -1,377 +1,10 @@
commit 067088bbff42ca2fb9106acf309f1d9ce3e78ada
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
move ci scripts to their own directory
This fixes #296.
commit 52d4e566743f57b9de81c77fdb605c171c02eacb
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
combine test directories
This fixes #295.
commit 6e6902c28b715826fdfc7b42a592db88459b9a57
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
remove unused test ignore patterns
commit 084823182aec4aef6fb880d642bba2d0ef91a3ad
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
remove unused test data files
commit 7478c104fc479067d71d191dccfa4cbf541311d8
Author: Georgy Yakovlev <gyakovlev@gentoo.org>
Commit: William Hubbs <w.d.hubbs@gmail.com>
librc/librc-depend.c: fix NULL pointer dereference
In some cases deptree or depinfo can be NULL, check
before dereferencing.
Fixes https://github.com/OpenRC/openrc/issues/293
Fixes https://github.com/OpenRC/openrc/pulls/294
X-Gentoo-Bug: 659906
X-Gentoo-Bug-URL: https://bugs.gentoo.org/659906
commit 065b7ecc0d4ddd046cc235d60de20140db1a6fe8
Author: Georgy Yakovlev <gyakovlev@gentoo.org>
Commit: William Hubbs <w.d.hubbs@gmail.com>
use cirrus-ci for FreeBSD builds
This fixes #265.
commit b054aca50b31fc46fc736a542ec2719de2d23d30
Author: Sergei Trofimovich <slyfox@gentoo.org>
Commit: William Hubbs <w.d.hubbs@gmail.com>
src/test/runtests.sh: drop 'readelf'-based tests
The 'readelf'-based tests cover a few situations:
1. undefined symbols in shared libraries
2. unexpected exports in shared libraries
Bug #575958 shows that [2.] implementation is too simplistic
in assuming that presence of relocation equals to export presence.
It is incorrect for PLT stubs and local symbols.
Let's just drop these tests.
If one needs to cover [1.] it is better to use LDFLAGS=-Wl,--no-undefined.
This closes #292.
X-Reported-by: Benda Xu
X-Gentoo-Bug: https://bugs.gentoo.org/575958
X-Gentoo-Bug-URL: https://bugs.gentoo.org/575958
commit f9e7a00ba9c9b179c697fc0af83a19e923c831b0
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
rc-status: style fixes
commit f1f48011acb266db309922f145653b86f11e0baf
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
update ChangeLog
commit 427a1ce2995b376ed6d112c5c5b422217f815fbb
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
rc-status: add -f option to allow formatting output
The -f option can be used when showing the status of services in
runlevels to allow making the output more easily parsable.
Currently, the .ini format is the only one supported.
commit f43cec34ca0201031fc10b584bcb391859f302cd
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
rc-status.c: small style changes
commit d64c9d205083ca82823f9f5ff178a5581f6c8b2a
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
add experimental support for an alternate shell for service scripts
This is for #288.
commit b2b2c57a3898c945b33b8bf0a10b658483be09c1
Author: Edan Bedrik <3d4nb3@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
librc: fix realpath() return value check
This fixes #226.
commit 155b8451945f8a17cd61ad56be3bb09541c3719a
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
improve shutdown documentation
This fixes #290.
commit 9b578808fb67682780adb17157330934a5c2cce7
Author: Austin English <austinenglish@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
travis: try enabling musl-gcc
This fixes #261.
commit 03164dd38d9e8d9a93141e5d6b495f306875bcd9
Author: Austin English <austinenglish@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
fix build with muslc
This fixes #261.
commit 2b82766452adec4eb99f61902d62f0fa2e369fa4
Author: Austin English <austinenglish@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
test/skel.runtests.sh: remove unused file
git grep shows no usage, and `make test` passes
This fixes #256.
commit 3eef6e91274f2e07bd566f206e89d9b0b9c45fb9
Author: Felix Neumärker <xdch47@posteo.de>
Commit: William Hubbs <w.d.hubbs@gmail.com>
zsh-completion: _rc-service support extra actions
- use rc-service <service> describe to get action list
This is for #285.
commit 77f09900a2e0eeb1475e9ee404b6e7ff76ff8e9d
Author: Felix Neumärker <xdch47@posteo.de>
Commit: William Hubbs <w.d.hubbs@gmail.com>
zsh-completion: _rc-service fix flag/command combinations
- handle `rc-service -<flag> <service> <action>` correctly
This is for #285.
commit 50d77a4e5d8c321cc89565295db13e60b2fb2cc7
Author: Kim Jahn <kim@maisspace.org>
Commit: William Hubbs <w.d.hubbs@gmail.com>
man/openrc.8: add openrc-run.8 to see also
This fixes #283.
commit 2d31b0a3f8b4be7290e596cb7072b78361e1734b
Author: Mike Frysinger <vapier@gentoo.org>
Commit: Mike Frysinger <vapier@gentoo.org>
man: supervise-daemon: fix various style issues
The .Dt header is supposed to be all caps. This was mixing case.
The options block was being incorrectly indented due to a missing .El.
Some of the new options were missing the .It block, so add that.
Finally, the -D option was missing capitalization.
commit b84d0bac4d3f23ff969827d74808fd7bd1c621c3
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
travis-ci: add IRC notifications
commit 1ff3a37c60e89da31c5c06bb4edd184770c91923
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
start-stop-daemon: fix compiler warning
commit 7e95d924c9067d9d643fc3b533f777ea7a5234d7
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
bash-completions/rc-service: allow tab to be used again
X-Gentoo-Bug: 670290
X-Gentoo-Bug-URL: https://bugs.gentoo.org/670290
commit a15b532a02094b3afe9d698f6b98e70f0fd4506a
Author: artoo <artoo@artixlinux.org>
Commit: William Hubbs <w.d.hubbs@gmail.com>
scripts: fix halt, poweroff and reboot wrappers
These are designed to emulate the sysvinit equivalents, so pass "now" as
the time argument if no arguments are given.
This fixes #268.
commit 3e00fbc9b08dde9e2c7fc26ecb9e831417012dd1
Author: philhofer <phofer@umich.edu>
Commit: William Hubbs <w.d.hubbs@gmail.com>
fix leading whitespace
Clean up code indented with mixed tabs and spaces.
No actual code changes.
This fixes #280.
commit 846e4600754dab3f0cb49edb4ad9e2b2b73d3f47
Author: philhofer <phofer@umich.edu>
Commit: William Hubbs <w.d.hubbs@gmail.com>
fix potential out-of-bounds reads
readlink(3) does not nul-terminate the result it sticks
into the supplied buffer. Consequently, the code
rc = readlink(path, buf, sizeof(buf));
does not necessarily produce a C string.
The code in rc_find_pid() produces some C strings this way
and passes them to strlen() and strcmp(), which can lead
to an out-of-bounds read.
In this case, since the code already takes care to
zero-initialize the buffers before passing them
to readlink(3), only allow sizeof(buf)-1 bytes to
be returned.
(While fixing this issue, I fixed two other locations that
used the same problematic pattern.)
This fixes #270.
commit a32b14bbb43e9888acaaea6f764fb8dcb34fb941
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
Do not use UT_LINESIZE or __UT_LINESIZE
These are not standard.
For more information see issue #279.
This fixes #279.
commit 084877eb52971faf8f52c780ddd08ed9af140eb6
Author: philhofer <phofer@umich.edu>
Commit: William Hubbs <w.d.hubbs@gmail.com>
src/librc/librc-daemon.c: fix buffer overrun in pid_is_argv
The contents of /proc/<pid>/cmdline are read into
a stack buffer using
bytes = read(fd, buffer, sizeof(buffer));
followed by appending a null terminator to the buffer with
buffer[bytes] = '\0';
If bytes == sizeof(buffer), then this write is out-of-bounds.
Refactor the code to use rc_getfile instead, since PATH_MAX
is not the maximum size of /proc/<pid>/cmdline. (I hit this
issue in practice while compiling Linux; it tripped the
stack-smashing protector.)
This is roughly the same buffer overflow condition
that was fixed by commit 0ddee9b7d2b8dea810e252ca6a95c457876df120
This fixes #269.
commit 97e74f97347f5798e01a47057efab00906754546
Author: philhofer <phofer@umich.edu>
Commit: William Hubbs <w.d.hubbs@gmail.com>
src/rc/supervise-daemon.c: formatting fixes
Fix misleading indentation and other erroneous whitespace.
This fixes #273.
commit d328de198d0ad980188b105decc09405652aa3d6
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
remove /run migration script again
This time it was done correctly.
I missed a '\' the last time.
commit a9fc26ac1367ac887eab76007e8834dfe787edcd
Author: philhofer <phofer@umich.edu>
Commit: Mike Frysinger <vapier@gmail.com>
src/rc/supervise-daemon.c: do not pass NULL to strcmp
The following will cause a segfault due to NULL being
passed to strcmp(3)
$ RC_SVCNAME=foo supervise-daemon
Fix the bounds check on argc in main. If argc<=1, then
it is not safe to dereference argv[1].
commit 40f70466969b340ee5e277c98a4b27a9117b795e
Author: philhofer <phofer@umich.edu>
Commit: Mike Frysinger <vapier@gmail.com>
src/rc/openrc-run.c: remove duplicate statement
The statement
ll = strlen(applet);
appears twice in the same block without any
intervening assignment to the variables
'll' or 'applet'
Remove the second (duplicate) statement.
commit 894995176e827eef16bf90b6479b7c285677ceef
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
Revert "remove /run migration script"
For some reason removing this broke the build.
This reverts commit 5246ea7b6f8c6a247403f725f8301457f6ddfffd.
commit 5246ea7b6f8c6a247403f725f8301457f6ddfffd
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
remove /run migration script
We have used /run for some time now and we have had this migration
script for 6 years. Linux users should have upgraded by now to a version
of OpenRC which stores its information in /run.
commit ed8b768c4a68042eed0c21c8305640841b22f006
commit 63e40f31bfc7d8908fee8059ea383038832dd84f
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
fix compiler warnings
commit 825caa14de6160c966d44d64d5c0254f4038d9a0
commit e43ee29eb4310ff23c438d1877ef79c56539b002
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
@@ -384,7 +17,7 @@ Commit: William Hubbs <w.d.hubbs@gmail.com>
This is for #271.
commit d5c396cbfc49ce88f58d944c8ab01d2c36ccdc7b
commit a3555b144291b7d32f7c14fd9bd0dbe3ee6e33f9
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
@@ -393,29 +26,19 @@ Commit: William Hubbs <w.d.hubbs@gmail.com>
This will make it easier to track down why the supervisor intermittently
hangs after it runs for a long time.
commit 5427783fdf3d183ea4e63afc507c31d88f0d2c9c
commit eb863156fbcbce236c60dec0e90338edbd9de686
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
standardize the default shell
I do not know of a need to have the default shell be a build-time
configurable setting. All *nix systems I am aware of have /bin/sh as a
default posix compatible shell.
If some systems running OpenRC do not make that assumption about
/bin/sh, I will consider bringing this back, so feel free to open an
issue.
version 0.40.3
commit d95425b08a1675efb66def056d0f92e6b2d78a77
commit ac76b24b85d3767a9561b76ac0fee5569383a63a
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
rc-cgroup.sh: remove shebang line
This is not a stand-alone script, so it does not need the shebang line.
This also means it is not necessary to run this through sed.
Update ChangeLog
commit 76420d9849e6832a52aa4c1ba1fd2895b7d51a08
commit b8e57c693a973528799c9a5fdf86135b658dcce2
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
@@ -429,7 +52,7 @@ Commit: William Hubbs <w.d.hubbs@gmail.com>
If an agetty is respawning faster than 10 times in 60 seconds, this
seems to be too fast.
commit bebc604438f9586f26d0cad8bd72749ae84b4335
commit 5df12e24146cd091de71c77737c07eed5a14101f
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
@@ -437,7 +60,19 @@ Commit: William Hubbs <w.d.hubbs@gmail.com>
This fixes #264.
commit 9dae4f2e38ceae227933673e25db9583e8f610a6
commit 461df0c78b1b8a58bb272958dce4af39fc2549c0
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
version 0.40.2
commit cefae65392568afac83f64773b6ad33462791c38
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
Update ChangeLog
commit 69fbd129938522cdd9b82fea2b83c857796a32af
Author: Alexander Zubkov <green@msu.ru>
Commit: William Hubbs <w.d.hubbs@gmail.com>
@@ -445,11 +80,11 @@ Commit: William Hubbs <w.d.hubbs@gmail.com>
This fixes #239.
commit d126542dc626c8295b0f2cfcdee7bf5aa79daff1
commit 4aa5686d9037132b27d7554436738fa98e8e9057
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
version 0.41
version 0.40.1
commit ab6c8d56f155564f56d61553c4b1af9e7f63a9d2
Author: William Hubbs <w.d.hubbs@gmail.com>
@@ -1472,3 +1107,260 @@ Commit: William Hubbs <w.d.hubbs@gmail.com>
make the base/controller functions return successfully if cgroups v1/v2
are not configured in the kernel
commit aa7d3a7911b658c550e7ce76cd6d7d46541fc323
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
openrc: force deptree update for sysinit runlevel
commit 98262647a9d2f3c65a7ceb1aaa81095522c1ef06
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
supervise-daemon: zero out the cmdline buffer when it is allocated
commit 5868abe97babcc287794dcb36ad8e77989b6ddcf
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
start-stop-daemon: compiler warning cleanup
commit 71aad16256604e0e9e146221957a9b00cfe67b99
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
openrc-run: clean up a compiler warning
commit e275da84de1589253da5ff6a7c272cf1c82f8567
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
supervise-daemon: remove references to PATH_MAX
commit a6cc7f06cf3807a0e0590697e1f14e6ab9055271
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
rc.c: remove PATH_MAX references
commit c1178c8eebb92c9f3702e981cd4af9ef41f51884
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
rc-selinux.c: remove references to path_max
commit 3c031ca9780c555817fe9ccb8b23ceb231129724
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
rc-plubin.c: remove references to PATH_MAX
commit 8e02406d8fbf92167c30431987d5de8de72cd7df
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
rc-misc.c: remove references to PATH_MAX
commit 8dbdabcc5e0df8ac36722a4ba7bfe30664cc9919
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
start-stop-daemon: clean up string handling
commit 488d8989c518d9256f183899aac02024c679b93e
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
openrc-run: clean up string handling
- remove references to PATH_MAX
- use xasprintf to create strings
commit 9e14b35da8942bd8fa552363617c3415887f485f
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
rc-update: remove reference to PATH_MAX
commit 7b4879cb72e907414b70553663bd9b6fda8d4408
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
mountinfo: create strings with xasprintf
commit 74cfb455c59298f86849541e724ae346ff205c3d
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
kill_all: create strings with xasprintf
commit 0110487722646ebf9bc2c4e12b4b4a3c358cb10d
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
helpers.h: silence compiler warnings about xasprintf
commit 68b9b0bc2a11d144870d14fcb8ac24e6c9c63354
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
xasprintf: exit if return value of vsnprintf is invalid
commit 4616f8f809ee8566904ca37f2b8bf0409a487475
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
helpers.h: add xasprintf function
This is our own version of asprintf(). This original code was written by
Mike Frysinger, and I was able to modify it to use our memory helper
functions.
We need a version of this code because it is not available on glibc at
least without defining _GNU_SOURCE, and I would rather not do that.
This is the first step in improving string handling in OpenRC for #207.
commit 287d71bd2591ddec73efe356db081020e65cd922
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
helpers.h: style fix
commit c1ffe4d9f2e10b6853464cc298d1922c81ae92f4
Author: Michael Orlitzky <michael@orlitzky.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
man/openrc-run.8: fix mountinfo args.
The "Ar" tag for the mountinfo command contained a typo (leading
space) that resulted in the tag being output verbatim; that is,
mountinfo ... .Ar mount1 mount2
rather than e.g.
mountinfo ... <mount1> <mount2>
This commit deletes the leading space to fix the output.
This fixes #204.
commit 4c517bdb2b69eac36f004ae41bb9cbb212fe0a51
Author: Michael Orlitzky <michael@orlitzky.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
man/openrc-run.8: add missing "Xo" tags for fstabinfo and mountinfo.
The BUILTINS are all surrounded by Xo...Xc tags, but the opening "Xo"
was missing from the two commands fstabinfo and mountinfo. This commit
adds them, and thereby fixes the spacing when viewed by man.
This is for #204.
commit 110582491ff02db061b567636a237460afbc489c
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
service-script-guide.md cleanups
Refer to /var/run in the documentation instead of /run, and make it
clear at the top of the pidfile section that we use /run under Linux.
This is for #202.
commit 5dd1d39d20c118064d31ed65dc7ae2de75dd7908
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
typo fix
commit 1771bc2a83fe65bfe6ec3e93ea7632609e697a38
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
checkpath: use fchown and fchmod to handle ownership and mode changes
This is related to #195.
This is an attempt to shorten the window for the first two issues
discussed by using a file descriptor which does not follow symbolic
links and using the fchmod and fchown calls instead of chown and chmod.
with.
commit 87c98ebb01873120eecc1757e615b3a4c14a2f1f
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
checkpath: fix lchown error message
X-Gentoo-Bug: 643084
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=643084
commit 4af5a80b0c516773286cc30e743dc90a2d19df23
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
_rc_deptree_load - return NULL if the stat() call is not successful
X-Gentoo-Bug: 643084
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=643084
commit fee2ffe559bc39beec16585daf557b902a53137b
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
Reformat and fix titles in documentation
commit 8878f8916b7682a333d1e40af991cd7354192be1
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
Rename guide.md to user-guide.md to better describe its purpose
commit 14e3359a9e4174da3e422957d9de56907f025875
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
move developer documentation from guide.md to service-script-guide.md
commit 918d955fd2de1f594b83508f5ddd5271534e3591
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
checkpath: use lchown instead of chown
Checkpath should never follow symbolic links when changing ownership of a file.
This is for https://github.com/openrc/openrc/issues/195.
commit 92cfa0e543d380ab290d06e98e2fef1b283349fe
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
service-script-guide.md: formatting changes
Add a title, adjust the headings and update the example that referred to
"net.lo" to refer to "loopback".
commit c2bd33e4838eb56bebe2707f6ca6bd05e9df5b24
Author: Michael Orlitzky <michael@orlitzky.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
service-script-guide.md: new guide for service script authors.
This fixes #162.
commit f42ec82f21f3760b829507344ad0ae761e1d59aa
Author: 3PO <r2d2@freakmail.de>
Commit: William Hubbs <w.d.hubbs@gmail.com>
net-online: only process symbolic links in /sys/class/net
The /sys/class/net directory contains files which are not symlinks if
the system has bonded devices [1]. We should ignore these files.
This fixes #196.
[1] https://elkano.org/blog/manage-interface-bondings-sysfs-interface/

View File

@@ -33,9 +33,8 @@ ifeq (${MKZSHCOMP},yes)
SUBDIR+= zsh-completion
endif
# We need to ensure that runlevels is done last other than test
# We need to ensure that runlevels is done last
SUBDIR+= runlevels
SUBDIR+= test
INSTALLAFTER= _installafter

View File

@@ -1,3 +1,3 @@
NAME= openrc
VERSION= 0.41
VERSION= 0.40.3
PKG= ${NAME}-${VERSION}

12
NEWS.md
View File

@@ -4,18 +4,6 @@ OpenRC NEWS
This file will contain a list of notable changes for each release. Note
the information in this file is in reverse order.
## OpenRC 0.41.
This version adds the ability to format the output of rc-status when
showing the status of services in a runlevel so that it may be parsed.
Currently, the -f switch only accepts ini as an argument which
causes the output to be in the .ini format.
This version adds an experimental build time switch to allow setting the
default shell to use for service scripts.
By default, this is set to /bin/sh if it is changed, the new shell must
be able to understand posix-compatible syntax.
## OpenRC 0.40
In this version, the keymaps and termencoding services on Linux needed

View File

@@ -38,7 +38,6 @@ PKG_PREFIX=/usr/pkg
LOCAL_PREFIX=/usr/local
PREFIX=/usr/local
BRANDING=\"Gentoo/$(uname -s)\"
SH=/bin/sh
```
## Notes

View File

@@ -91,14 +91,11 @@ _rc_service()
done))
return 0
elif [[ ${COMP_CWORD} -eq 2 ]] && [[ ${prev} != -* ]]; then # if second word typed and we didn't type in a function
rc-service --exists "$prev" || return
shopt -s extglob
while read -r _ line; do
if [[ $line == +([[:alnum:]_]):* ]]; then
opts+="${line%%:*} "
fi
done < <(rc-service "$prev" describe 2>&1)
shopt -u extglob
filename=$(rc-service --resolve ${prev})
opts=$(cat ${filename} | grep "^\w*()" | sed "s/().*$//") # Greps the functions included in the init script
if [[ "x${opts}" == "x" ]] ; then # if no options found loosen the grep algorhythm
opts=$(cat ${filename} | grep "\w*()" | sed "s/().*$//")
fi
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi

View File

@@ -1,21 +0,0 @@
#!/bin/bash
# Copyright (c) 2007-2018 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
#
# This file is part of OpenRC. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
set -e
set -u
set -x
# These are steps to run on Cirrus CI under a jailed FreeBSD system.
# See $TOP/.cirrus.yml for more info about the Cirrus CI setup.
cpus=$(getconf NPROCESSORS_CONF || echo 1)
gmake -j"${cpus}" -O
gmake test

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!@SHELL@
# Copyright (c) 2007-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!@SHELL@
# Copyright (c) 2007-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS

View File

@@ -17,35 +17,15 @@
.Sh SYNOPSIS
.Nm
.Op Fl c , -cancel
.Nm
.Op Fl R , -reexec
.Nm
.Op Fl w , -write-only
.Nm
.Op Fl d , -no-write
.Op Fl D , -dry-run
.Op Fl H , -halt
time
.Nm
.Op Fl d , -no-write
.Op Fl D , -dry-run
.Op Fl k , -kexec
time
.Nm
.Op Fl d , -no-write
.Op Fl D , -dry-run
.Op Fl p , -poweroff
time
.Nm
.Op Fl d , -no-write
.Op Fl D , -dry-run
.Op Fl R , -reexec
.Op Fl r , -reboot
time
.Nm
.Op Fl d , -no-write
.Op Fl D , -dry-run
.Op Fl s , -single
time
.Op Fl w , -write-only
.Sh DESCRIPTION
.Nm
is the utility that communicates with
@@ -76,7 +56,7 @@ Stop all services, kill all processes and reboot the system.
.It Fl s , -single
Stop all services, kill all processes and move to single user mode.
.It Fl w , -write-only
Wrrite a wtmp shutdown record and do nothing else.
Stop all services, kill all processes and move to single user mode.
.El
.Sh SEE ALSO
.Xr openrc-init 8 ,

View File

@@ -66,7 +66,6 @@ and
.Xr shutdown 8
and let them call these special runlevels.
.Sh SEE ALSO
.Xr openrc-run 8 ,
.Xr rc-status 8 ,
.Xr rc-update 8 ,
.Xr init 8 ,

View File

@@ -17,7 +17,6 @@
.Sh SYNOPSIS
.Nm
.Op Fl aclsuC
.Op Fl f Ar ini
.Op Ar runlevel
.Sh DESCRIPTION
.Nm
@@ -38,9 +37,6 @@ The options are as follows:
Show all runlevels and their services.
.It Fl c , -crashed
List all services that have crashed.
.It Fl f , -format
Select a format for the output. Currently, the only one that can be
specified is ini, which outputs in *.ini format.
.It Fl l , -list
List all defined runlevels.
.It Fl m , -manual

View File

@@ -9,7 +9,7 @@
.\" except according to the terms contained in the LICENSE file.
.\"
.Dd April 27, 2016
.Dt SUPERVISE-DAEMON 8 SMM
.Dt supervise-DAEMON 8 SMM
.Os OpenRC
.Sh NAME
.Nm supervise-daemon
@@ -88,17 +88,16 @@ owned by the user. You can optionally append a
name here also.
.It Fl v , -verbose
Print the action(s) that are taken just before doing them.
.El
.Pp
The options are as follows:
.Bl -tag -width indent
.It Fl a , -healthcheck-timer Ar seconds
.Fl a , -healthcheck-timer Ar seconds
Run the healthcheck() command, possibly followed by the unhealthy()
command every time this number of seconds passes.
.It Fl A , -healthcheck-delay Ar seconds
.Fl A , -healthcheck-delay Ar seconds
Wait this long before the first health check.
.It Fl D , -respawn-delay Ar seconds
Wait this number of seconds before restarting a daemon after it crashes.
wait this number of seconds before restarting a daemon after it crashes.
The default is 0.
.It Fl d , -chdir Ar path
chdir to this directory before starting the daemon.

View File

@@ -11,7 +11,7 @@
SFX= .Linux.in
PKG_PREFIX?= /usr
CPPFLAGS+= -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L -D_BSD_SOURCE -D_XOPEN_SOURCE
CPPFLAGS+= -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L
LIBDL= -Wl,-Bdynamic -ldl
ifeq (${MKSELINUX},yes)

View File

@@ -19,7 +19,7 @@ _PKG_SED:= $(shell ${_PKG_SED_SH})
_LCL_SED_SH= if test "${PREFIX}" = "${LOCAL_PREFIX}"; then echo "-e 's:@LOCAL_PREFIX@::g'"; else echo "-e 's:@LOCAL_PREFIX@:${LOCAL_PREFIX}:g'"; fi
_LCL_SED:= $(shell ${_LCL_SED_SH})
SED_REPLACE= -e 's:@SHELL@:${SH}:' -e 's:@LIB@:${LIBNAME}:g' -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g' -e 's:@PREFIX@:${PREFIX}:g' -e 's:@BINDIR@:${BINDIR}:g' -e 's:@SBINDIR@:${SBINDIR}:g' ${_PKG_SED} ${_LCL_SED}
SED_REPLACE= -e 's:@SHELL@:${SH}:g' -e 's:@LIB@:${LIBNAME}:g' -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g' -e 's:@PREFIX@:${PREFIX}:g' -e 's:@BINDIR@:${BINDIR}:g' -e 's:@SBINDIR@:${SBINDIR}:g' ${_PKG_SED} ${_LCL_SED}
# Tweak our shell scripts
%.sh: %.sh.in
@@ -53,6 +53,7 @@ realinstall: ${BIN} ${CONF} ${INC}
install: all realinstall ${INSTALLAFTER}
check test::
@if test -e runtests.sh ; then ./runtests.sh || exit $$? ; fi
# A lot of scripts don't have anything to clean
# Also, some rm implentation require a file argument regardless of error

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!@SHELL@
option_arg=
poweroff_arg=
@@ -21,9 +21,4 @@ if [ -z "${poweroff_arg}" ]; then
poweroff_arg=--poweroff
fi
script_args="$@"
if [ -z "${script_args}" ]; then
script_args=now
fi
exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "${script_args}"
exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "$@"

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!@SHELL@
option_arg=
poweroff_arg=
@@ -20,9 +20,4 @@ if [ -z "${poweroff_arg}" ]; then
poweroff_arg=--poweroff
fi
script_args="$@"
if [ -z "${script_args}" ]; then
script_args=now
fi
exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "${script_args}"
exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "$@"

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!@SHELL@
# Copyright (c) 2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!@SHELL@
option_arg=
poweroff_arg=
@@ -22,9 +22,4 @@ if [ -z "${poweroff_arg}" ]; then
poweroff_arg=--reboot
fi
script_args="$@"
if [ -z "${script_args}" ]; then
script_args=now
fi
exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "${script_args}"
exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "$@"

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!@SHELL@
shutdown_arg=
while getopts :akrhPHfFnct: opt; do

2
sh/.gitignore vendored
View File

@@ -4,4 +4,6 @@ openrc-run.sh
cgroup-release-agent.sh
init.sh
init-early.sh
rc-cgroup.sh
migrate-to-run.sh
binfmt.sh

View File

@@ -2,7 +2,7 @@ DIR= ${LIBEXECDIR}/sh
SRCS= init.sh.in functions.sh.in gendepends.sh.in \
openrc-run.sh.in ${SRCS-${OS}}
INC= rc-mount.sh functions.sh rc-functions.sh runit.sh s6.sh \
start-stop-daemon.sh supervise-daemon.sh ${INC-${OS}}
start-stop-daemon.sh supervise-daemon.sh
BIN= gendepends.sh init.sh openrc-run.sh ${BIN-${OS}}
INSTALLAFTER= _installafter
@@ -13,9 +13,10 @@ include ${MK}/os.mk
SRCS-FreeBSD=
BIN-FreeBSD=
SRCS-Linux= binfmt.sh.in cgroup-release-agent.sh.in init-early.sh.in
BIN-Linux= binfmt.sh cgroup-release-agent.sh init-early.sh
INC-Linux= rc-cgroup.sh
SRCS-Linux= binfmt.sh.in cgroup-release-agent.sh.in init-early.sh.in \
migrate-to-run.sh.in rc-cgroup.sh.in
BIN-Linux= binfmt.sh cgroup-release-agent.sh init-early.sh migrate-to-run.sh \
rc-cgroup.sh
SRCS-NetBSD=
BIN-NetBSD=
@@ -31,3 +32,4 @@ _installafter:
ln -snf ${LIBEXECDIR}/sh/functions.sh ${DESTDIR}/${INITDIR} || exit $$?
check test::
./runtests.sh

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!@SHELL@
# This is a reimplementation of the systemd binfmt.d code to register
# misc binary formats with the kernel.
#

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!@SHELL@
# This is run by the kernel after the last task is removed from a
# control group in the openrc hierarchy.

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!@SHELL@
# Copyright (c) 2007-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!@SHELL@
# Copyright (c) 2007-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!@SHELL@
# Copyright (c) 2007-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!@SHELL@
# Copyright (c) 2007-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!@SHELL@
# Copyright (c) 1999-2007 Gentoo Foundation
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.

36
sh/migrate-to-run.sh.in Normal file
View File

@@ -0,0 +1,36 @@
#!@SHELL@
# Copyright (c) 2012-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
#
# This file is part of OpenRC. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
. "@LIBEXECDIR@/sh/functions.sh"
if [ -e /run/openrc/softlevel ]; then
einfo "The OpenRC dependency data has already been migrated."
exit 0
fi
if [ ! -d /run ]; then
eerror "/run is not a directory."
eerror "moving /run to /run.pre-openrc"
mv /run /run.pre-openrc
mkdir /run
fi
rm -rf /run/openrc
if ! mountinfo -q -f tmpfs /run; then
ln -s "@LIBEXECDIR@"/init.d /run/openrc
else
cp -a "@LIBEXECDIR@/init.d" /run/openrc
rc-update -u
fi
einfo "The OpenRC dependency data was migrated successfully."
exit 0

View File

@@ -1,3 +1,4 @@
#!@SHELL@
# Copyright (c) 2012-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS

View File

@@ -15,6 +15,7 @@
ret=0
tret=0
ebegin "Testing yesno()"
for f in yes YES Yes true TRUE True 1 ; do
if ! yesno $f; then
: $(( tret += 1 ))
@@ -27,7 +28,7 @@ for f in no NO No false FALSE False 0 ; do
echo "!$f!"
fi
done
eend $tret
: $(( ret += $tret ))
eend $ret
exit $ret

View File

@@ -1,7 +1,7 @@
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.
SUBDIR= libeinfo librc rc
SUBDIR= test libeinfo librc rc
MK= ../mk
include ${MK}/subdir.mk

View File

@@ -48,40 +48,34 @@ pid_is_exec(pid_t pid, const char *exec)
static bool
pid_is_argv(pid_t pid, const char *const *argv)
{
char *buffer = NULL;
char *cmdline = NULL;
int fd;
char buffer[PATH_MAX];
char *p;
size_t bytes;
bool rc;
ssize_t bytes;
xasprintf(&cmdline, "/proc/%u/cmdline", pid);
if (!rc_getfile(cmdline, &buffer, &bytes)) {
if ((fd = open(cmdline, O_RDONLY)) < 0) {
free(cmdline);
return false;
}
bytes = read(fd, buffer, sizeof(buffer));
close(fd);
free(cmdline);
if (bytes <= 0) {
if (buffer)
free(buffer);
if (bytes == -1)
return false;
}
p = buffer;
rc = true;
while (*argv) {
if (strcmp(*argv, p) != 0) {
rc = false;
break;
}
buffer[bytes] = '\0';
p = buffer;
while (*argv) {
if (strcmp(*argv, p) != 0)
return false;
argv++;
p += strlen(p) + 1;
if ((unsigned)(p - buffer) >= bytes) {
rc = false;
break;
}
if ((unsigned)(p - buffer) > sizeof(buffer))
return false;
}
free(buffer);
return rc;
return true;
}
RC_PIDLIST *
@@ -147,7 +141,7 @@ rc_find_pids(const char *exec, const char *const *argv, uid_t uid, pid_t pid)
memset(my_ns, 0, sizeof(my_ns));
memset(proc_ns, 0, sizeof(proc_ns));
if (exists("/proc/self/ns/pid")) {
rc = readlink("/proc/self/ns/pid", my_ns, sizeof(my_ns)-1);
rc = readlink("/proc/self/ns/pid", my_ns, sizeof(my_ns));
if (rc <= 0)
my_ns[0] = '\0';
}
@@ -161,7 +155,7 @@ rc_find_pids(const char *exec, const char *const *argv, uid_t uid, pid_t pid)
continue;
xasprintf(&buffer, "/proc/%d/ns/pid", p);
if (exists(buffer)) {
rc = readlink(buffer, proc_ns, sizeof(proc_ns)-1);
rc = readlink(buffer, proc_ns, sizeof(proc_ns));
if (rc <= 0)
proc_ns[0] = '\0';
}

View File

@@ -84,11 +84,10 @@ static RC_DEPINFO *
get_depinfo(const RC_DEPTREE *deptree, const char *service)
{
RC_DEPINFO *di;
if (deptree) {
TAILQ_FOREACH(di, deptree, entries)
if (strcmp(di->service, service) == 0)
return di;
}
TAILQ_FOREACH(di, deptree, entries)
if (strcmp(di->service, service) == 0)
return di;
return NULL;
}
@@ -97,11 +96,9 @@ get_deptype(const RC_DEPINFO *depinfo, const char *type)
{
RC_DEPTYPE *dt;
if (depinfo) {
TAILQ_FOREACH(dt, &depinfo->depends, entries)
if (strcmp(dt->type, type) == 0)
return dt;
}
TAILQ_FOREACH(dt, &depinfo->depends, entries)
if (strcmp(dt->type, type) == 0)
return dt;
return NULL;
}
@@ -619,11 +616,11 @@ mtime_check(const char *source, const char *target, bool newer,
return false;
mtime = buf.st_mtime;
retval = deep_mtime_check(target,newer,&mtime,file);
if (rel) {
*rel = mtime;
}
return retval;
retval = deep_mtime_check(target,newer,&mtime,file);
if (rel) {
*rel = mtime;
}
return retval;
}
bool

View File

@@ -423,7 +423,7 @@ rc_conf_value(const char *setting)
}
rc_conf = rc_config_directory(rc_conf);
rc_conf = rc_config_kcl(rc_conf);
rc_conf = rc_config_kcl(rc_conf);
/* Convert old uppercase to lowercase */
TAILQ_FOREACH(s, rc_conf, entries) {

View File

@@ -558,7 +558,7 @@ rc_service_resolve(const char *service)
if (*file) {
memset(buffer, 0, sizeof(buffer));
r = readlink(file, buffer, sizeof(buffer)-1);
r = readlink(file, buffer, sizeof(buffer));
if (r > 0)
return xstrdup(buffer);
}
@@ -1047,6 +1047,7 @@ rc_service_add(const char *runlevel, const char *service)
char *init;
char file[PATH_MAX];
char path[MAXPATHLEN] = { '\0' };
char *p = NULL;
char binit[PATH_MAX];
char *i;
@@ -1067,7 +1068,8 @@ rc_service_add(const char *runlevel, const char *service)
/* We need to ensure that only things in /etc/init.d are added
* to the boot runlevel */
if (strcmp(runlevel, RC_LEVEL_BOOT) == 0) {
if (realpath(dirname(init), path) == NULL) {
p = realpath(dirname(init), path);
if (!*p) {
free(init);
return false;
}

View File

@@ -37,6 +37,10 @@
# define _PATH_DEV "/dev/"
#endif
#ifndef UT_LINESIZE
#define UT_LINESIZE __UT_LINESIZE
#endif
static sigjmp_buf jbuf;
/*
@@ -58,7 +62,7 @@ static void getuidtty(char **userp, char **ttyp)
uid_t uid;
char *tty;
static char uidbuf[32];
char *ttynm = NULL;
static char ttynm[UT_LINESIZE + 4];
uid = getuid();
if ((pwd = getpwuid(uid)) != NULL) {
@@ -78,8 +82,10 @@ static void getuidtty(char **userp, char **ttyp)
if (tty[0] == '/')
tty++;
}
xasprintf(&ttynm, "(%s) ", tty);
}
snprintf(ttynm, sizeof(ttynm), "(%.*s) ",
UT_LINESIZE, tty);
} else
ttynm[0] = 0;
*userp = uidbuf;
*ttyp = ttynm;
@@ -150,7 +156,6 @@ void broadcast(char *text)
xasprintf(&line, "\007\r\nBroadcast message from %s@%s %s(%s):\r\n\r\n",
user, name.nodename, tty, date);
free(tty);
/*
* Fork to avoid hanging in a write()

View File

@@ -1120,7 +1120,7 @@ int main(int argc, char **argv)
char *dir, *save = NULL, *saveLnk = NULL;
char *pidstr = NULL;
size_t l = 0, ll;
const char *file;
const char *file;
struct stat stbuf;
/* Show help if insufficient args */
@@ -1152,7 +1152,7 @@ int main(int argc, char **argv)
}
lnk = xmalloc(4096);
memset(lnk, 0, 4096);
if (readlink(argv[1], lnk, 4096-1)) {
if (readlink(argv[1], lnk, 4096)) {
dir = dirname(path);
if (strchr(lnk, '/')) {
save = xstrdup(dir);
@@ -1223,6 +1223,7 @@ int main(int argc, char **argv)
/* Make our prefix string */
prefix = xmalloc(sizeof(char) * l + 1);
ll = strlen(applet);
memcpy(prefix, applet, ll);
memset(prefix + ll, ' ', l - ll);
memset(prefix + l, 0, 1);

View File

@@ -67,15 +67,7 @@ const char * const longopts_help[] = {
"write wtmp boot record and exit",
longopts_help_COMMON
};
const char *usagestring = "" \
"Usage: openrc-shutdown -c | --cancel\n" \
" or: openrc-shutdown -R | --reexec\n" \
" or: openrc-shutdown -w | --write-only\n" \
" or: openmrc-shutdown -H | --halt time\n" \
" or: openrc-shutdown -K | --kexec time\n" \
" or: openrc-shutdown -p | --poweroff time\n" \
" or: openrc-shutdown -r | --reboot time\n" \
" or: openrc-shutdown -s | --single time";
const char *usagestring = NULL;
const char *exclusive = "Select one of "
"--cancel, --halt, --kexec, --poweroff, --reexec, --reboot, --single or \n"
"--write-only";
@@ -119,8 +111,8 @@ static void create_nologin(int mins)
t += 60 * mins;
if ((fp = fopen(nologin_file, "w")) != NULL) {
fprintf(fp, "\rThe system is going down on %s\r\n", ctime(&t));
fclose(fp);
fprintf(fp, "\rThe system is going down on %s\r\n", ctime(&t));
fclose(fp);
}
}
@@ -130,7 +122,7 @@ static void create_nologin(int mins)
static void send_cmd(const char *cmd)
{
FILE *fifo;
size_t ignored;
size_t ignored;
if (do_dryrun) {
einfo("Would send %s to init", cmd);

View File

@@ -27,18 +27,12 @@
#include "rc-misc.h"
#include "_usage.h"
enum format_t {
FORMAT_DEFAULT,
FORMAT_INI,
};
const char *applet = NULL;
const char *extraopts = NULL;
const char *getoptstring = "acf:lmrsSu" getoptstring_COMMON;
const char *getoptstring = "aclmrsSu" getoptstring_COMMON;
const struct option longopts[] = {
{"all", 0, NULL, 'a'},
{"crashed", 0, NULL, 'c'},
{"format", 1, NULL, 'f'},
{"list", 0, NULL, 'l'},
{"manual", 0, NULL, 'm'},
{"runlevel", 0, NULL, 'r'},
@@ -50,7 +44,6 @@ const struct option longopts[] = {
const char * const longopts_help[] = {
"Show services from all run levels",
"Show crashed services",
"format status to be parsable (currently arg must be ini)",
"Show list of run levels",
"Show manually started services",
"Show the name of the current runlevel",
@@ -60,7 +53,7 @@ const char * const longopts_help[] = {
longopts_help_COMMON
};
const char *usagestring = "" \
"Usage: rc-status [options] -f ini <runlevel>...\n" \
"Usage: rc-status [options] <runlevel>...\n" \
" or: rc-status [options] [-a | -c | -l | -m | -r | -s | -u]";
static RC_DEPTREE *deptree;
@@ -69,27 +62,19 @@ static RC_STRINGLIST *types;
static RC_STRINGLIST *levels, *services, *tmp, *alist;
static RC_STRINGLIST *sservices, *nservices, *needsme;
static void print_level(const char *prefix, const char *level,
enum format_t format)
static void
print_level(const char *prefix, const char *level)
{
switch (format) {
case FORMAT_DEFAULT:
if (prefix)
printf("%s ", prefix);
printf ("Runlevel: ");
if (isatty(fileno(stdout)))
printf("%s%s%s\n",
ecolor(ECOLOR_HILITE), level, ecolor(ECOLOR_NORMAL));
else
printf("%s\n", level);
break;
case FORMAT_INI:
printf("%s", "[");
if (prefix)
printf("%s ", prefix);
printf("%s]\n", level);
break;
}
if (prefix)
printf("%s ", prefix);
printf ("Runlevel: ");
if (isatty(fileno(stdout)))
printf("%s%s%s\n",
ecolor(ECOLOR_HILITE),
level,
ecolor(ECOLOR_NORMAL));
else
printf("%s\n", level);
}
static char *get_uptime(const char *service)
@@ -140,13 +125,14 @@ static char *get_uptime(const char *service)
return uptime;
}
static void print_service(const char *service, enum format_t format)
static void
print_service(const char *service)
{
char *status = NULL;
char *uptime = NULL;
char *child_pid = NULL;
char *start_time = NULL;
int cols;
int cols = printf(" %s", service);
const char *c = ecolor(ECOLOR_GOOD);
RC_SERVICE state = rc_service_state(service);
ECOLOR color = ECOLOR_BAD;
@@ -190,22 +176,14 @@ static void print_service(const char *service, enum format_t format)
xasprintf(&status, " stopped ");
errno = 0;
switch (format) {
case FORMAT_DEFAULT:
cols = printf(" %s", service);
if (c && *c && isatty(fileno(stdout)))
printf("\n");
ebracket(cols, color, status);
break;
case FORMAT_INI:
printf("%s = %s\n", service, status);
break;
}
if (c && *c && isatty(fileno(stdout)))
printf("\n");
ebracket(cols, color, status);
free(status);
}
static void print_services(const char *runlevel, RC_STRINGLIST *svcs,
enum format_t format)
static void
print_services(const char *runlevel, RC_STRINGLIST *svcs)
{
RC_STRINGLIST *l = NULL;
RC_STRING *s;
@@ -219,7 +197,7 @@ static void print_services(const char *runlevel, RC_STRINGLIST *svcs,
TAILQ_FOREACH(s, svcs, entries)
if (!runlevel ||
rc_service_in_runlevel(s->value, runlevel))
print_service(s->value, format);
print_service(s->value);
return;
}
if (!types) {
@@ -239,12 +217,13 @@ static void print_services(const char *runlevel, RC_STRINGLIST *svcs,
if (!rc_stringlist_find(svcs, s->value))
continue;
if (!runlevel || rc_service_in_runlevel(s->value, runlevel))
print_service(s->value, format);
print_service(s->value);
}
rc_stringlist_free(l);
}
static void print_stacked_services(const char *runlevel, enum format_t format)
static void
print_stacked_services(const char *runlevel)
{
RC_STRINGLIST *stackedlevels, *servicelist;
RC_STRING *stackedlevel;
@@ -253,9 +232,9 @@ static void print_stacked_services(const char *runlevel, enum format_t format)
TAILQ_FOREACH(stackedlevel, stackedlevels, entries) {
if (rc_stringlist_find(levels, stackedlevel->value) != NULL)
continue;
print_level("Stacked", stackedlevel->value, format);
print_level("Stacked", stackedlevel->value);
servicelist = rc_services_in_runlevel(stackedlevel->value);
print_services(stackedlevel->value, servicelist, format);
print_services(stackedlevel->value, servicelist);
rc_stringlist_free(servicelist);
}
rc_stringlist_free(stackedlevels);
@@ -265,9 +244,7 @@ static void print_stacked_services(const char *runlevel, enum format_t format)
int main(int argc, char **argv)
{
RC_SERVICE state;
RC_STRING *s, *l, *t, *level;
enum format_t format = FORMAT_DEFAULT;
bool levels_given = false;
RC_STRING *s, *l, *t, *level;
bool show_all = false;
char *p, *runlevel = NULL;
int opt, retval = 0;
@@ -290,12 +267,6 @@ int main(int argc, char **argv)
}
goto exit;
/* NOTREACHED */
case 'f':
if (strcasecmp(optarg, "ini") == 0)
format = FORMAT_INI;
else
eerrorx("%s: invalid argument to --format switch\n", applet);
break;
case 'l':
levels = rc_runlevel_list();
TAILQ_FOREACH(l, levels, entries)
@@ -320,7 +291,7 @@ int main(int argc, char **argv)
free(s->value);
free(s);
}
print_services(NULL, services, FORMAT_DEFAULT);
print_services(NULL, services);
goto exit;
case 'r':
runlevel = rc_runlevel_get();
@@ -332,12 +303,12 @@ int main(int argc, char **argv)
TAILQ_FOREACH_SAFE(s, services, entries, t)
if (!rc_service_value_get(s->value, "child_pid"))
TAILQ_REMOVE(services, s, entries);
print_services(NULL, services, FORMAT_DEFAULT);
print_services(NULL, services);
goto exit;
/* NOTREACHED */
case 's':
services = rc_services_in_runlevel(NULL);
print_services(NULL, services, FORMAT_DEFAULT);
print_services(NULL, services);
goto exit;
/* NOTREACHED */
case 'u':
@@ -352,7 +323,7 @@ int main(int argc, char **argv)
break;
}
}
print_services(NULL, services, FORMAT_DEFAULT);
print_services(NULL, services);
goto exit;
/* NOTREACHED */
@@ -364,7 +335,6 @@ int main(int argc, char **argv)
opt = (optind < argc) ? 0 : 1;
while (optind < argc) {
if (rc_runlevel_exists(argv[optind])) {
levels_given = true;
rc_stringlist_add(levels, argv[optind++]);
opt++;
} else
@@ -381,21 +351,21 @@ int main(int argc, char **argv)
deptree = _rc_deptree_load(0, NULL);
TAILQ_FOREACH(l, levels, entries) {
print_level(NULL, l->value, format);
print_level(NULL, l->value);
services = rc_services_in_runlevel(l->value);
print_services(l->value, services, format);
print_stacked_services(l->value, format);
print_services(l->value, services);
print_stacked_services(l->value);
rc_stringlist_free(nservices);
nservices = NULL;
rc_stringlist_free(services);
services = NULL;
}
if (show_all || !levels_given) {
if (show_all || argc < 2) {
/* Show hotplugged services */
print_level("Dynamic", "hotplugged", format);
print_level("Dynamic", "hotplugged");
services = rc_services_in_state(RC_SERVICE_HOTPLUGGED);
print_services(NULL, services, format);
print_services(NULL, services);
rc_stringlist_free(services);
services = NULL;
@@ -452,10 +422,10 @@ int main(int argc, char **argv)
* be added to the list
*/
unsetenv("RC_SVCNAME");
print_level("Dynamic", "needed/wanted", format);
print_services(NULL, nservices, format);
print_level("Dynamic", "manual", format);
print_services(NULL, services, format);
print_level("Dynamic", "needed/wanted");
print_services(NULL, nservices);
print_level("Dynamic", "manual");
print_services(NULL, services);
}
exit:

View File

@@ -43,8 +43,8 @@ void log_wtmp(const char *user, const char *id, pid_t pid, int type,
strncpy(utmp.ut_id , id , sizeof(utmp.ut_id ));
strncpy(utmp.ut_line, line, sizeof(utmp.ut_line));
/* Put the OS version in place of the hostname */
if (uname(&uname_buf) == 0)
/* Put the OS version in place of the hostname */
if (uname(&uname_buf) == 0)
strncpy(utmp.ut_host, uname_buf.release, sizeof(utmp.ut_host));
updwtmp(WTMP_FILE, &utmp);

View File

@@ -492,7 +492,7 @@ int main(int argc, char **argv)
startas = optarg;
break;
case 'w':
if (sscanf(optarg, "%u", &start_wait) != 1)
if (sscanf(optarg, "%d", &start_wait) != 1)
eerrorx("%s: `%s' not a number",
applet, optarg);
break;
@@ -547,7 +547,7 @@ int main(int argc, char **argv)
} else if (name) {
*--argv = name;
++argc;
} else if (exec) {
} else if (exec) {
*--argv = exec;
++argc;
};

View File

@@ -237,7 +237,7 @@ static char * expand_home(const char *home, const char *path)
ppath++;
if (!home) {
free(opath);
free(opath);
return xstrdup(path);
}
if (!ppath) {
@@ -535,7 +535,7 @@ static void supervisor(char *exec, char **argv)
sigaction(SIGTERM, &sa, NULL);
fp = fopen(pidfile, "w");
if (!fp)
if (! fp)
eerrorx("%s: fopen `%s': %s", applet, pidfile, strerror(errno));
fprintf(fp, "%d\n", getpid());
fclose(fp);
@@ -557,10 +557,10 @@ static void supervisor(char *exec, char **argv)
alarm(healthcheckdelay);
else if (healthchecktimer)
alarm(healthchecktimer);
failing = 0;
failing = 0;
while (!exiting) {
healthcheck_respawn = 0;
fifo_fd = open(fifopath, O_RDONLY);
fifo_fd = open(fifopath, O_RDONLY);
if (fifo_fd > 0) {
memset(buf, 0, sizeof(buf));
count = read(fifo_fd, buf, sizeof(buf) - 1);
@@ -604,7 +604,7 @@ static void supervisor(char *exec, char **argv)
healthcheck_respawn = 1;
}
}
if (exiting) {
if (exiting ) {
alarm(0);
syslog(LOG_INFO, "stopping %s, pid %d", exec, child_pid);
nkilled = run_stop_schedule(applet, NULL, NULL, child_pid, 0,
@@ -720,7 +720,7 @@ int main(int argc, char **argv)
eerrorx("%s: The RC_SVCNAME environment variable is not set", applet);
openlog(applet, LOG_PID, LOG_DAEMON);
if (argc <= 1 || strcmp(argv[1], svcname))
if (argc >= 1 && svcname && strcmp(argv[1], svcname))
eerrorx("%s: the first argument is %s and must be %s",
applet, argv[1], svcname);
@@ -1062,8 +1062,8 @@ int main(int argc, char **argv)
c++;
}
xasprintf(&varbuf, "%d", x);
rc_service_value_set(svcname, "argc", varbuf);
free(varbuf);
rc_service_value_set(svcname, "argc", varbuf);
free(varbuf);
rc_service_value_set(svcname, "exec", exec);
supervisor(exec, argv);
} else

6
src/test/.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
einfo.data.out
einfo.funcs.out
librc.funcs.hidden.out
librc.funcs.hidden.list
rc.data.out
rc.funcs.out

1
src/test/einfo.data.list Normal file
View File

@@ -0,0 +1 @@
EINFO_1.0

52
src/test/einfo.funcs.list Normal file
View File

@@ -0,0 +1,52 @@
ebegin
ebegin@@EINFO_1.0
ebeginv
ebeginv@@EINFO_1.0
ebracket
ebracket@@EINFO_1.0
ecolor
ecolor@@EINFO_1.0
eend
eend@@EINFO_1.0
eendv
eendv@@EINFO_1.0
eerror
eerror@@EINFO_1.0
eerrorn
eerrorn@@EINFO_1.0
eerrorx
eerrorx@@EINFO_1.0
eindent
eindent@@EINFO_1.0
eindentv
eindentv@@EINFO_1.0
einfo
einfo@@EINFO_1.0
einfon
einfon@@EINFO_1.0
einfov
einfov@@EINFO_1.0
einfovn
einfovn@@EINFO_1.0
elog
elog@@EINFO_1.0
eoutdent
eoutdent@@EINFO_1.0
eoutdentv
eoutdentv@@EINFO_1.0
eprefix
eprefix@@EINFO_1.0
ewarn
ewarn@@EINFO_1.0
ewarnn
ewarnn@@EINFO_1.0
ewarnv
ewarnv@@EINFO_1.0
ewarnvn
ewarnvn@@EINFO_1.0
ewarnx
ewarnx@@EINFO_1.0
ewend
ewend@@EINFO_1.0
ewendv
ewendv@@EINFO_1.0

3
src/test/rc.data.list Normal file
View File

@@ -0,0 +1,3 @@
RC_1.0
rc_environ_fd
rc_environ_fd@@RC_1.0

116
src/test/rc.funcs.list Normal file
View File

@@ -0,0 +1,116 @@
rc_conf_value
rc_conf_value@@RC_1.0
rc_config_list
rc_config_list@@RC_1.0
rc_config_load
rc_config_load@@RC_1.0
rc_config_value
rc_config_value@@RC_1.0
rc_deptree_depend
rc_deptree_depend@@RC_1.0
rc_deptree_depends
rc_deptree_depends@@RC_1.0
rc_deptree_free
rc_deptree_free@@RC_1.0
rc_deptree_load
rc_deptree_load@@RC_1.0
rc_deptree_load_file
rc_deptree_load_file@@RC_1.0
rc_deptree_order
rc_deptree_order@@RC_1.0
rc_deptree_update
rc_deptree_update@@RC_1.0
rc_deptree_update_needed
rc_deptree_update_needed@@RC_1.0
rc_find_pids
rc_find_pids@@RC_1.0
rc_getfile
rc_getfile@@RC_1.0
rc_getline
rc_getline@@RC_1.0
rc_newer_than
rc_newer_than@@RC_1.0
rc_older_than
rc_older_than@@RC_1.0
rc_proc_getent
rc_proc_getent@@RC_1.0
rc_runlevel_exists
rc_runlevel_exists@@RC_1.0
rc_runlevel_get
rc_runlevel_get@@RC_1.0
rc_runlevel_list
rc_runlevel_list@@RC_1.0
rc_runlevel_set
rc_runlevel_set@@RC_1.0
rc_runlevel_stack
rc_runlevel_stack@@RC_1.0
rc_runlevel_stacks
rc_runlevel_stacks@@RC_1.0
rc_runlevel_starting
rc_runlevel_starting@@RC_1.0
rc_runlevel_stopping
rc_runlevel_stopping@@RC_1.0
rc_runlevel_unstack
rc_runlevel_unstack@@RC_1.0
rc_service_add
rc_service_add@@RC_1.0
rc_service_daemon_set
rc_service_daemon_set@@RC_1.0
rc_service_daemons_crashed
rc_service_daemons_crashed@@RC_1.0
rc_service_delete
rc_service_delete@@RC_1.0
rc_service_description
rc_service_description@@RC_1.0
rc_service_exists
rc_service_exists@@RC_1.0
rc_service_extra_commands
rc_service_extra_commands@@RC_1.0
rc_service_in_runlevel
rc_service_in_runlevel@@RC_1.0
rc_service_mark
rc_service_mark@@RC_1.0
rc_service_resolve
rc_service_resolve@@RC_1.0
rc_service_schedule_clear
rc_service_schedule_clear@@RC_1.0
rc_service_schedule_start
rc_service_schedule_start@@RC_1.0
rc_service_started_daemon
rc_service_started_daemon@@RC_1.0
rc_service_state
rc_service_state@@RC_1.0
rc_service_value_get
rc_service_value_get@@RC_1.0
rc_service_value_set
rc_service_value_set@@RC_1.0
rc_services_in_runlevel
rc_services_in_runlevel@@RC_1.0
rc_services_in_runlevel_stacked
rc_services_in_runlevel_stacked@@RC_1.0
rc_services_in_state
rc_services_in_state@@RC_1.0
rc_services_scheduled
rc_services_scheduled@@RC_1.0
rc_services_scheduled_by
rc_services_scheduled_by@@RC_1.0
rc_stringlist_add
rc_stringlist_add@@RC_1.0
rc_stringlist_addu
rc_stringlist_addu@@RC_1.0
rc_stringlist_delete
rc_stringlist_delete@@RC_1.0
rc_stringlist_find
rc_stringlist_find@@RC_1.0
rc_stringlist_free
rc_stringlist_free@@RC_1.0
rc_stringlist_new
rc_stringlist_new@@RC_1.0
rc_stringlist_sort
rc_stringlist_sort@@RC_1.0
rc_stringlist_split
rc_stringlist_split@@RC_1.0
rc_sys
rc_sys@@RC_1.0
rc_yesno
rc_yesno@@RC_1.0

View File

@@ -1,6 +1,6 @@
#!/bin/sh
top_srcdir=${top_srcdir:-..}
top_srcdir=${top_srcdir:-../..}
. ${top_srcdir}/test/setup_env.sh
libeinfo_srcdir="${srcdir}/../libeinfo"
@@ -27,6 +27,53 @@ fail_on_out() {
fi
}
ebegin "Checking exported symbols in libeinfo.so (data)"
checkit einfo.data $(
readelf -Ws ${libeinfo_builddir}/libeinfo.so \
| awk '$4 == "OBJECT" && $5 == "GLOBAL" && $7 != "UND" {print $NF}' \
| LC_ALL=C sort -u
)
ebegin "Checking exported symbols in libeinfo.so (functions)"
checkit einfo.funcs $(
readelf -Ws ${libeinfo_builddir}/libeinfo.so \
| awk '$4 == "FUNC" && $5 == "GLOBAL" && $7 != "UND" {print $NF}' \
| LC_ALL=C sort -u \
| egrep -v \
-e '^_(init|fini)$'
)
ebegin "Checking exported symbols in librc.so (data)"
checkit rc.data $(
readelf -Ws ${librc_builddir}/librc.so \
| awk '$4 == "OBJECT" && $5 == "GLOBAL" && $7 != "UND" {print $NF}' \
| LC_ALL=C sort -u
)
ebegin "Checking exported symbols in librc.so (functions)"
checkit rc.funcs $(
readelf -Ws ${librc_builddir}/librc.so \
| awk '$4 == "FUNC" && $5 == "GLOBAL" && $7 != "UND" {print $NF}' \
| LC_ALL=C sort -u \
| egrep -v \
-e '^_(init|fini)$'
)
ebegin "Checking hidden functions in librc.so"
sed -n '/^librc_hidden_proto/s:.*(\(.*\))$:\1:p' ${librc_srcdir}/librc.h \
| LC_ALL=C sort -u \
> librc.funcs.hidden.list
readelf -Wr $(grep -l '#include[[:space:]]"librc\.h"' ${librc_srcdir}/*.c | sed 's:\.c$:.o:') \
| egrep -v -e 'R_PARISC_(DP|SEG)REL' \
| awk '$5 ~ /^rc_/ {print $5}' \
| LC_ALL=C sort -u \
| egrep -v '^rc_environ_fd$' \
> librc.funcs.hidden.out
syms=$(diff -u librc.funcs.hidden.list librc.funcs.hidden.out | sed -n '/^+[^+]/s:^+::p')
[ -z "${syms}" ]
eend $? "Missing hidden defs:"$'\n'"${syms}"
: $(( ret += $? ))
ebegin "Checking trailing whitespace in code"
# XXX: Should we check man pages too ?
out=$(cd ${top_srcdir}; find */ \

5
test/skel.runtests.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
# top_srcdir=${top_srcdir:-SET/THIS/PATH/OK!?}
. ${top_srcdir}/test/setup_env.sh

View File

@@ -1,37 +1,27 @@
#compdef rc-service
_rc_services() {
if [[ -n "${opt_args[(i)-l|--list]}" ]]; then
_nothing
else
_values 'service' $(rc-service -l)
fi
}
_rc_actions() {
local service="${line[1]}"
if [[ -n "${opt_args[(i)-e|--exists|-r|--resolve]}" ]] || ! $(rc-service -e $service) ; then
_nothing
else
local -a actions=(${(f)"$(rc-service -C $service describe 2>&1)"})
shift actions
actions=(${actions# \* })
actions=(${actions/:*})
actions=(stop start restart describe zap ${actions[@]})
_describe -V 'action' actions
fi
}
_arguments -C -s \
'(-e --exists)'{-e,--exists}'[tests if the service exists or not]' \
'(-l --list)'{-l,--list}'[list all available services]' \
'(-r --resolve)'{-r,--resolve}'[resolve the service name to an init script]' \
'(-C --nocolor)'{-C,--nocolor}'[Disable color output]' \
'(-v --verbose)'{-v,--verbose}'[Run verbosely]' \
'(-q --quiet)'{-q,--quiet}'[Run quietly]' \
'1:service:_rc_services' \
'2:action:_rc_actions'
if (( CURRENT == 2 )); then
_arguments -s \
'(-e --exists)'{-e,--exists}"[tests if the service exists or not]" \
'(-l --list)'{-l,--list}'[list all available services]' \
'(-r --resolve)'{-r,--resolve}'[resolve the service name to an init script]' \
'(-C --nocolor)'{-C,--nocolor}'[Disable color output]' \
'(-v --verbose)'{-v,--verbose}'[Run verbosely]' \
'(-q --quiet)'{-q,--quiet}'[Run quietly]'
_values "service" $(rc-service --list)
else
case $words[2] in
-e|--exists|-r|--resolve)
(( CURRENT > 3 )) && return 0
_values "service" $(rc-service --list)
;;
-*)
return 0
;;
*)
_values "action" stop start restart describe zap
;;
esac
fi
# vim: set et sw=2 ts=2 ft=zsh: