From 28826ac8c02793431203edb4adb961d5521d643d Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 19 Oct 2015 00:52:26 +0200 Subject: [PATCH] debianutils/*: convert to new-style "one file" applets Signed-off-by: Denys Vlasenko --- debianutils/Config.src | 75 --------------------------------- debianutils/Kbuild.src | 5 --- debianutils/mktemp.c | 9 ++++ debianutils/pipe_progress.c | 9 ++++ debianutils/run_parts.c | 34 +++++++++++++++ debianutils/start_stop_daemon.c | 28 ++++++++++++ debianutils/which.c | 10 +++++ include/applets.src.h | 5 --- 8 files changed, 90 insertions(+), 85 deletions(-) diff --git a/debianutils/Config.src b/debianutils/Config.src index cbc09b5ce..61daeb047 100644 --- a/debianutils/Config.src +++ b/debianutils/Config.src @@ -7,79 +7,4 @@ menu "Debian Utilities" INSERT -config MKTEMP - bool "mktemp" - default y - help - mktemp is used to create unique temporary files - -config PIPE_PROGRESS - bool "pipe_progress" - default y - help - Display a dot to indicate pipe activity. - -config RUN_PARTS - bool "run-parts" - default y - help - run-parts is a utility designed to run all the scripts in a directory. - - It is useful to set up a directory like cron.daily, where you need to - execute all the scripts in that directory. - - In this implementation of run-parts some features (such as report - mode) are not implemented. - - Unless you know that run-parts is used in some of your scripts - you can safely say N here. - -config FEATURE_RUN_PARTS_LONG_OPTIONS - bool "Enable long options" - default y - depends on RUN_PARTS && LONG_OPTS - help - Support long options for the run-parts applet. - -config FEATURE_RUN_PARTS_FANCY - bool "Support additional arguments" - default y - depends on RUN_PARTS - help - Support additional options: - -l --list print the names of the all matching files (not - limited to executables), but don't actually run them. - -config START_STOP_DAEMON - bool "start-stop-daemon" - default y - help - start-stop-daemon is used to control the creation and - termination of system-level processes, usually the ones - started during the startup of the system. - -config FEATURE_START_STOP_DAEMON_FANCY - bool "Support additional arguments" - default y - depends on START_STOP_DAEMON - help - Support additional arguments. - -o|--oknodo ignored since we exit with 0 anyway - -v|--verbose - -N|--nicelevel N - -config FEATURE_START_STOP_DAEMON_LONG_OPTIONS - bool "Enable long options" - default y - depends on START_STOP_DAEMON && LONG_OPTS - help - Support long options for the start-stop-daemon applet. - -config WHICH - bool "which" - default y - help - which is used to find programs in your PATH and - print out their pathnames. - endmenu diff --git a/debianutils/Kbuild.src b/debianutils/Kbuild.src index d41b5c8e4..6b4fb7470 100644 --- a/debianutils/Kbuild.src +++ b/debianutils/Kbuild.src @@ -7,8 +7,3 @@ lib-y:= INSERT -lib-$(CONFIG_MKTEMP) += mktemp.o -lib-$(CONFIG_PIPE_PROGRESS) += pipe_progress.o -lib-$(CONFIG_RUN_PARTS) += run_parts.o -lib-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o -lib-$(CONFIG_WHICH) += which.o diff --git a/debianutils/mktemp.c b/debianutils/mktemp.c index 983d7a246..65353697a 100644 --- a/debianutils/mktemp.c +++ b/debianutils/mktemp.c @@ -30,6 +30,15 @@ * a directory: $TMPDIR, if set; else the directory specified via * -p; else /tmp [deprecated] */ +//config:config MKTEMP +//config: bool "mktemp" +//config: default y +//config: help +//config: mktemp is used to create unique temporary files + +//applet:IF_MKTEMP(APPLET(mktemp, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_MKTEMP) += mktemp.o //usage:#define mktemp_trivial_usage //usage: "[-dt] [-p DIR] [TEMPLATE]" diff --git a/debianutils/pipe_progress.c b/debianutils/pipe_progress.c index 2c7444f31..21d330b59 100644 --- a/debianutils/pipe_progress.c +++ b/debianutils/pipe_progress.c @@ -6,6 +6,15 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config PIPE_PROGRESS +//config: bool "pipe_progress" +//config: default y +//config: help +//config: Display a dot to indicate pipe activity. + +//applet:IF_PIPE_PROGRESS(APPLET(pipe_progress, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_PIPE_PROGRESS) += pipe_progress.o //usage:#define pipe_progress_trivial_usage NOUSAGE_STR //usage:#define pipe_progress_full_usage "" diff --git a/debianutils/run_parts.c b/debianutils/run_parts.c index dd6fe7d49..13617c6e1 100644 --- a/debianutils/run_parts.c +++ b/debianutils/run_parts.c @@ -22,6 +22,40 @@ * report mode. As the original run-parts support only long options, I've * broken compatibility because the BusyBox policy doesn't allow them. */ +//config:config RUN_PARTS +//config: bool "run-parts" +//config: default y +//config: help +//config: run-parts is a utility designed to run all the scripts in a directory. +//config: +//config: It is useful to set up a directory like cron.daily, where you need to +//config: execute all the scripts in that directory. +//config: +//config: In this implementation of run-parts some features (such as report +//config: mode) are not implemented. +//config: +//config: Unless you know that run-parts is used in some of your scripts +//config: you can safely say N here. +//config: +//config:config FEATURE_RUN_PARTS_LONG_OPTIONS +//config: bool "Enable long options" +//config: default y +//config: depends on RUN_PARTS && LONG_OPTS +//config: help +//config: Support long options for the run-parts applet. +//config: +//config:config FEATURE_RUN_PARTS_FANCY +//config: bool "Support additional arguments" +//config: default y +//config: depends on RUN_PARTS +//config: help +//config: Support additional options: +//config: -l --list print the names of the all matching files (not +//config: limited to executables), but don't actually run them. + +//applet:IF_RUN_PARTS(APPLET_ODDNAME(run-parts, run_parts, BB_DIR_BIN, BB_SUID_DROP, run_parts)) + +//kbuild:lib-$(CONFIG_RUN_PARTS) += run_parts.o //usage:#define run_parts_trivial_usage //usage: "[-a ARG]... [-u UMASK] " diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c index 7dadc3c9e..42f1943dd 100644 --- a/debianutils/start_stop_daemon.c +++ b/debianutils/start_stop_daemon.c @@ -56,6 +56,34 @@ Misc options: -q,--quiet Quiet -v,--verbose Verbose */ +//config:config START_STOP_DAEMON +//config: bool "start-stop-daemon" +//config: default y +//config: help +//config: start-stop-daemon is used to control the creation and +//config: termination of system-level processes, usually the ones +//config: started during the startup of the system. +//config: +//config:config FEATURE_START_STOP_DAEMON_FANCY +//config: bool "Support additional arguments" +//config: default y +//config: depends on START_STOP_DAEMON +//config: help +//config: Support additional arguments. +//config: -o|--oknodo ignored since we exit with 0 anyway +//config: -v|--verbose +//config: -N|--nicelevel N +//config: +//config:config FEATURE_START_STOP_DAEMON_LONG_OPTIONS +//config: bool "Enable long options" +//config: default y +//config: depends on START_STOP_DAEMON && LONG_OPTS +//config: help +//config: Support long options for the start-stop-daemon applet. + +//applet:IF_START_STOP_DAEMON(APPLET_ODDNAME(start-stop-daemon, start_stop_daemon, BB_DIR_SBIN, BB_SUID_DROP, start_stop_daemon)) + +//kbuild:lib-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o //usage:#define start_stop_daemon_trivial_usage //usage: "[OPTIONS] [-S|-K] ... [-- ARGS...]" diff --git a/debianutils/which.c b/debianutils/which.c index d50e7a0d3..c0f897809 100644 --- a/debianutils/which.c +++ b/debianutils/which.c @@ -5,6 +5,16 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config WHICH +//config: bool "which" +//config: default y +//config: help +//config: which is used to find programs in your PATH and +//config: print out their pathnames. + +//applet:IF_WHICH(APPLET(which, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_WHICH) += which.o //usage:#define which_trivial_usage //usage: "[COMMAND]..." diff --git a/include/applets.src.h b/include/applets.src.h index 9c4f9daa0..f49179996 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -230,7 +230,6 @@ IF_MKFS_VFAT(APPLET_ODDNAME(mkfs.vfat, mkfs_vfat, BB_DIR_SBIN, BB_SUID_DROP, mkf IF_MKNOD(APPLET_NOEXEC(mknod, mknod, BB_DIR_BIN, BB_SUID_DROP, mknod)) IF_CRYPTPW(APPLET_ODDNAME(mkpasswd, cryptpw, BB_DIR_USR_BIN, BB_SUID_DROP, mkpasswd)) IF_MKSWAP(APPLET(mkswap, BB_DIR_SBIN, BB_SUID_DROP)) -IF_MKTEMP(APPLET(mktemp, BB_DIR_BIN, BB_SUID_DROP)) IF_MORE(APPLET(more, BB_DIR_BIN, BB_SUID_DROP)) /* On full-blown systems, requires suid for user mounts. * But it's not unthinkable to have it available in non-suid flavor on some systems, @@ -254,7 +253,6 @@ IF_OPENVT(APPLET(openvt, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_PASSWD(APPLET(passwd, BB_DIR_USR_BIN, BB_SUID_REQUIRE)) IF_PGREP(APPLET(pgrep, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_PIDOF(APPLET(pidof, BB_DIR_BIN, BB_SUID_DROP)) -IF_PIPE_PROGRESS(APPLET(pipe_progress, BB_DIR_BIN, BB_SUID_DROP)) IF_PIVOT_ROOT(APPLET(pivot_root, BB_DIR_SBIN, BB_SUID_DROP)) IF_PKILL(APPLET_ODDNAME(pkill, pgrep, BB_DIR_USR_BIN, BB_SUID_DROP, pkill)) IF_POPMAILDIR(APPLET(popmaildir, BB_DIR_USR_SBIN, BB_SUID_DROP)) @@ -279,7 +277,6 @@ IF_RM(APPLET_NOFORK(rm, rm, BB_DIR_BIN, BB_SUID_DROP, rm)) IF_RMDIR(APPLET_NOFORK(rmdir, rmdir, BB_DIR_BIN, BB_SUID_DROP, rmdir)) IF_ROUTE(APPLET(route, BB_DIR_SBIN, BB_SUID_DROP)) 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_RX(APPLET(rx, BB_DIR_USR_BIN, BB_SUID_DROP)) @@ -308,7 +305,6 @@ IF_SLATTACH(APPLET(slattach, BB_DIR_SBIN, BB_SUID_DROP)) IF_SLEEP(APPLET(sleep, BB_DIR_BIN, BB_SUID_DROP)) 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)) IF_STAT(APPLET(stat, BB_DIR_BIN, BB_SUID_DROP)) IF_STRINGS(APPLET(strings, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_STTY(APPLET(stty, BB_DIR_BIN, BB_SUID_DROP)) @@ -362,7 +358,6 @@ IF_VOLNAME(APPLET(volname, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_WATCH(APPLET(watch, BB_DIR_BIN, BB_SUID_DROP)) IF_WATCHDOG(APPLET(watchdog, BB_DIR_SBIN, BB_SUID_DROP)) IF_WC(APPLET(wc, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_WHICH(APPLET(which, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_WHOAMI(APPLET_NOFORK(whoami, whoami, BB_DIR_USR_BIN, BB_SUID_DROP, whoami)) IF_YES(APPLET_NOFORK(yes, yes, BB_DIR_USR_BIN, BB_SUID_DROP, yes)) IF_ZCIP(APPLET(zcip, BB_DIR_SBIN, BB_SUID_DROP)) -- 2.25.1