From 0863e1a576c4b26bb87564b3a403f1094814f1aa Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 19 Oct 2015 00:41:28 +0200 Subject: [PATCH] runit/*: convert to new-style "one file" applets Signed-off-by: Denys Vlasenko --- include/applets.src.h | 9 ----- runit/Config.src | 79 ------------------------------------------- runit/Kbuild.src | 11 ------ runit/chpst.c | 45 +++++++++++++++++++++++- runit/runsv.c | 12 ++++++- runit/runsvdir.c | 22 +++++++++++- runit/sv.c | 20 ++++++++++- runit/svlogd.c | 13 ++++++- 8 files changed, 107 insertions(+), 104 deletions(-) diff --git a/include/applets.src.h b/include/applets.src.h index c1ed0e82f..d243d89e1 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -95,7 +95,6 @@ IF_CHGRP(APPLET_NOEXEC(chgrp, chgrp, BB_DIR_BIN, BB_SUID_DROP, chgrp)) IF_CHMOD(APPLET_NOEXEC(chmod, chmod, BB_DIR_BIN, BB_SUID_DROP, chmod)) IF_CHOWN(APPLET_NOEXEC(chown, chown, BB_DIR_BIN, BB_SUID_DROP, chown)) IF_CHPASSWD(APPLET(chpasswd, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_CHPST(APPLET(chpst, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_CHROOT(APPLET(chroot, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_CHRT(APPLET(chrt, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_CHVT(APPLET(chvt, BB_DIR_USR_BIN, BB_SUID_DROP)) @@ -129,8 +128,6 @@ IF_DUMPLEASES(APPLET(dumpleases, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_ECHO(APPLET_NOFORK(echo, echo, BB_DIR_BIN, BB_SUID_DROP, echo)) IF_EJECT(APPLET(eject, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_ENV(APPLET_NOEXEC(env, env, BB_DIR_USR_BIN, BB_SUID_DROP, env)) -IF_ENVDIR(APPLET_ODDNAME(envdir, chpst, BB_DIR_USR_BIN, BB_SUID_DROP, envdir)) -IF_ENVUIDGID(APPLET_ODDNAME(envuidgid, chpst, BB_DIR_USR_BIN, BB_SUID_DROP, envuidgid)) IF_ETHER_WAKE(APPLET_ODDNAME(ether-wake, ether_wake, BB_DIR_USR_SBIN, BB_SUID_DROP, ether_wake)) IF_EXPAND(APPLET(expand, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_EXPR(APPLET(expr, BB_DIR_USR_BIN, BB_SUID_DROP)) @@ -288,8 +285,6 @@ IF_RTCWAKE(APPLET(rtcwake, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_RUN_PARTS(APPLET_ODDNAME(run-parts, run_parts, BB_DIR_BIN, BB_SUID_DROP, run_parts)) IF_RUNCON(APPLET(runcon, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_RUNLEVEL(APPLET(runlevel, BB_DIR_SBIN, BB_SUID_DROP)) -IF_RUNSV(APPLET(runsv, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_RUNSVDIR(APPLET(runsvdir, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_RX(APPLET(rx, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_SCRIPT(APPLET(script, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_SCRIPTREPLAY(APPLET(scriptreplay, BB_DIR_BIN, BB_SUID_DROP)) @@ -306,7 +301,6 @@ IF_SETKEYCODES(APPLET(setkeycodes, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_SETLOGCONS(APPLET(setlogcons, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_SETSEBOOL(APPLET(setsebool, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_SETSID(APPLET(setsid, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_SETUIDGID(APPLET_ODDNAME(setuidgid, chpst, BB_DIR_USR_BIN, BB_SUID_DROP, setuidgid)) IF_SHA1SUM(APPLET_NOEXEC(sha1sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, sha1sum)) IF_SHA3SUM(APPLET_NOEXEC(sha3sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, sha3sum)) IF_SHA256SUM(APPLET_NOEXEC(sha256sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, sha256sum)) @@ -315,7 +309,6 @@ IF_SHOWKEY(APPLET(showkey, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_SLATTACH(APPLET(slattach, BB_DIR_SBIN, BB_SUID_DROP)) /* Do not make this applet NOFORK. It breaks ^C-ing of pauses in shells: */ IF_SLEEP(APPLET(sleep, BB_DIR_BIN, BB_SUID_DROP)) -IF_SOFTLIMIT(APPLET_ODDNAME(softlimit, chpst, BB_DIR_USR_BIN, BB_SUID_DROP, softlimit)) IF_SORT(APPLET_NOEXEC(sort, sort, BB_DIR_USR_BIN, BB_SUID_DROP, sort)) IF_SPLIT(APPLET(split, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_START_STOP_DAEMON(APPLET_ODDNAME(start-stop-daemon, start_stop_daemon, BB_DIR_SBIN, BB_SUID_DROP, start_stop_daemon)) @@ -326,8 +319,6 @@ IF_STTY(APPLET(stty, BB_DIR_BIN, BB_SUID_DROP)) IF_SU(APPLET(su, BB_DIR_BIN, BB_SUID_REQUIRE)) IF_SULOGIN(APPLET(sulogin, BB_DIR_SBIN, BB_SUID_DROP)) IF_SUM(APPLET(sum, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_SV(APPLET(sv, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_SVLOGD(APPLET(svlogd, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_SWAPONOFF(APPLET_ODDNAME(swapoff, swap_on_off, BB_DIR_SBIN, BB_SUID_DROP, swapoff)) IF_SWAPONOFF(APPLET_ODDNAME(swapon, swap_on_off, BB_DIR_SBIN, BB_SUID_DROP, swapon)) IF_SWITCH_ROOT(APPLET(switch_root, BB_DIR_SBIN, BB_SUID_DROP)) diff --git a/runit/Config.src b/runit/Config.src index 9db974002..8cde89680 100644 --- a/runit/Config.src +++ b/runit/Config.src @@ -7,83 +7,4 @@ menu "Runit Utilities" INSERT -config RUNSV - bool "runsv" - default y - help - runsv starts and monitors a service and optionally an appendant log - service. - -config RUNSVDIR - bool "runsvdir" - default y - help - runsvdir starts a runsv process for each subdirectory, or symlink to - a directory, in the services directory dir, up to a limit of 1000 - subdirectories, and restarts a runsv process if it terminates. - -config FEATURE_RUNSVDIR_LOG - bool "Enable scrolling argument log" - depends on RUNSVDIR - default n - help - Enable feature where second parameter of runsvdir holds last error - message (viewable via top/ps). Otherwise (feature is off - or no parameter), error messages go to stderr only. - -config SV - bool "sv" - default y - help - sv reports the current status and controls the state of services - monitored by the runsv supervisor. - -config SV_DEFAULT_SERVICE_DIR - string "Default directory for services" - default "/var/service" - depends on SV - help - Default directory for services. - Defaults to "/var/service" - -config SVLOGD - bool "svlogd" - default y - help - svlogd continuously reads log data from its standard input, optionally - filters log messages, and writes the data to one or more automatically - rotated logs. - -config CHPST - bool "chpst" - default y - help - chpst changes the process state according to the given options, and - execs specified program. - -config SETUIDGID - bool "setuidgid" - default y - help - Sets soft resource limits as specified by options - -config ENVUIDGID - bool "envuidgid" - default y - help - Sets $UID to account's uid and $GID to account's gid - -config ENVDIR - bool "envdir" - default y - help - Sets various environment variables as specified by files - in the given directory - -config SOFTLIMIT - bool "softlimit" - default y - help - Sets soft resource limits as specified by options - endmenu diff --git a/runit/Kbuild.src b/runit/Kbuild.src index 0fce95507..6b4fb7470 100644 --- a/runit/Kbuild.src +++ b/runit/Kbuild.src @@ -7,14 +7,3 @@ lib-y:= INSERT - -lib-$(CONFIG_RUNSV) += runsv.o -lib-$(CONFIG_RUNSVDIR) += runsvdir.o -lib-$(CONFIG_SV) += sv.o -lib-$(CONFIG_SVLOGD) += svlogd.o -lib-$(CONFIG_CHPST) += chpst.o - -lib-$(CONFIG_ENVDIR) += chpst.o -lib-$(CONFIG_ENVUIDGID) += chpst.o -lib-$(CONFIG_SETUIDGID) += chpst.o -lib-$(CONFIG_SOFTLIMIT) += chpst.o diff --git a/runit/chpst.c b/runit/chpst.c index 71af29f66..301cdd08a 100644 --- a/runit/chpst.c +++ b/runit/chpst.c @@ -26,7 +26,50 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* Busyboxed by Denys Vlasenko */ -/* Dependencies on runit_lib.c removed */ + +//config:config CHPST +//config: bool "chpst" +//config: default y +//config: help +//config: chpst changes the process state according to the given options, and +//config: execs specified program. +//config: +//config:config SETUIDGID +//config: bool "setuidgid" +//config: default y +//config: help +//config: Sets soft resource limits as specified by options +//config: +//config:config ENVUIDGID +//config: bool "envuidgid" +//config: default y +//config: help +//config: Sets $UID to account's uid and $GID to account's gid +//config: +//config:config ENVDIR +//config: bool "envdir" +//config: default y +//config: help +//config: Sets various environment variables as specified by files +//config: in the given directory +//config: +//config:config SOFTLIMIT +//config: bool "softlimit" +//config: default y +//config: help +//config: Sets soft resource limits as specified by options + +//applet:IF_CHPST(APPLET(chpst, BB_DIR_USR_BIN, BB_SUID_DROP)) +//applet:IF_ENVDIR(APPLET_ODDNAME(envdir, chpst, BB_DIR_USR_BIN, BB_SUID_DROP, envdir)) +//applet:IF_ENVUIDGID(APPLET_ODDNAME(envuidgid, chpst, BB_DIR_USR_BIN, BB_SUID_DROP, envuidgid)) +//applet:IF_SETUIDGID(APPLET_ODDNAME(setuidgid, chpst, BB_DIR_USR_BIN, BB_SUID_DROP, setuidgid)) +//applet:IF_SOFTLIMIT(APPLET_ODDNAME(softlimit, chpst, BB_DIR_USR_BIN, BB_SUID_DROP, softlimit)) + +//kbuild:lib-$(CONFIG_CHPST) += chpst.o +//kbuild:lib-$(CONFIG_ENVDIR) += chpst.o +//kbuild:lib-$(CONFIG_ENVUIDGID) += chpst.o +//kbuild:lib-$(CONFIG_SETUIDGID) += chpst.o +//kbuild:lib-$(CONFIG_SOFTLIMIT) += chpst.o //usage:#define chpst_trivial_usage //usage: "[-vP012] [-u USER[:GRP]] [-U USER[:GRP]] [-e DIR]\n" diff --git a/runit/runsv.c b/runit/runsv.c index 6cf5bcc29..4b18d12d5 100644 --- a/runit/runsv.c +++ b/runit/runsv.c @@ -26,7 +26,17 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* Busyboxed by Denys Vlasenko */ -/* TODO: depends on runit_lib.c - review and reduce/eliminate */ + +//config:config RUNSV +//config: bool "runsv" +//config: default y +//config: help +//config: runsv starts and monitors a service and optionally an appendant log +//config: service. + +//applet:IF_RUNSV(APPLET(runsv, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_RUNSV) += runsv.o //usage:#define runsv_trivial_usage //usage: "DIR" diff --git a/runit/runsvdir.c b/runit/runsvdir.c index b4c0b2ef0..b3d9e7390 100644 --- a/runit/runsvdir.c +++ b/runit/runsvdir.c @@ -26,7 +26,27 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* Busyboxed by Denys Vlasenko */ -/* TODO: depends on runit_lib.c - review and reduce/eliminate */ + +//config:config RUNSVDIR +//config: bool "runsvdir" +//config: default y +//config: help +//config: runsvdir starts a runsv process for each subdirectory, or symlink to +//config: a directory, in the services directory dir, up to a limit of 1000 +//config: subdirectories, and restarts a runsv process if it terminates. +//config: +//config:config FEATURE_RUNSVDIR_LOG +//config: bool "Enable scrolling argument log" +//config: depends on RUNSVDIR +//config: default n +//config: help +//config: Enable feature where second parameter of runsvdir holds last error +//config: message (viewable via top/ps). Otherwise (feature is off +//config: or no parameter), error messages go to stderr only. + +//applet:IF_RUNSVDIR(APPLET(runsvdir, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_RUNSVDIR) += runsvdir.o //usage:#define runsvdir_trivial_usage //usage: "[-P] [-s SCRIPT] DIR" diff --git a/runit/sv.c b/runit/sv.c index 825e9d45b..de8a0d8a4 100644 --- a/runit/sv.c +++ b/runit/sv.c @@ -151,7 +151,25 @@ Exit Codes */ /* Busyboxed by Denys Vlasenko */ -/* TODO: depends on runit_lib.c - review and reduce/eliminate */ + +//config:config SV +//config: bool "sv" +//config: default y +//config: help +//config: sv reports the current status and controls the state of services +//config: monitored by the runsv supervisor. +//config: +//config:config SV_DEFAULT_SERVICE_DIR +//config: string "Default directory for services" +//config: default "/var/service" +//config: depends on SV +//config: help +//config: Default directory for services. +//config: Defaults to "/var/service" + +//applet:IF_SV(APPLET(sv, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_SV) += sv.o //usage:#define sv_trivial_usage //usage: "[-v] [-w SEC] CMD SERVICE_DIR..." diff --git a/runit/svlogd.c b/runit/svlogd.c index c080b9acc..dbe8df65c 100644 --- a/runit/svlogd.c +++ b/runit/svlogd.c @@ -26,7 +26,6 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* Busyboxed by Denys Vlasenko */ -/* TODO: depends on runit_lib.c - review and reduce/eliminate */ /* Config files @@ -125,6 +124,18 @@ log message, you can use a pattern like this instead -*: *: pid * */ +//config:config SVLOGD +//config: bool "svlogd" +//config: default y +//config: help +//config: svlogd continuously reads log data from its standard input, optionally +//config: filters log messages, and writes the data to one or more automatically +//config: rotated logs. + +//applet:IF_SVLOGD(APPLET(svlogd, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_SVLOGD) += svlogd.o + //usage:#define svlogd_trivial_usage //usage: "[-ttv] [-r C] [-R CHARS] [-l MATCHLEN] [-b BUFLEN] DIR..." //usage:#define svlogd_full_usage "\n\n" -- 2.25.1