diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2020-11-16 17:30:43 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2020-11-17 17:57:42 +0100 |
commit | 3f1109bf2af2cf4977689a33ea481afaaac8dc98 (patch) | |
tree | e6fe442f66d52b39890d7501f9b9d3145481494a /package/base-files/files/etc | |
parent | 21dfdfd78b31a4a330514a5c0126e267be1c7fc3 (diff) | |
download | upstream-3f1109bf2af2cf4977689a33ea481afaaac8dc98.tar.gz upstream-3f1109bf2af2cf4977689a33ea481afaaac8dc98.tar.bz2 upstream-3f1109bf2af2cf4977689a33ea481afaaac8dc98.zip |
base-files: fix backwards compatiblity of rc.common EXTRA_COMMANDS
Avoid needlessly breaking old initscripts that set EXTRA_COMMANDS. This
will aid in debugging (as it simplifies reverting to an older version of
a package) and unbreaks third-party feeds (and packages that maintain
their OpenWrt initscripts as part of the software's repo instead of the
OpenWrt feed like fastd).
Without this, initscripts that set EXTRA_COMMANDS become completely
unusable, as all default commands like start/stop cease working.
Fixes: 1a69f50dc627 ("base-files: fix rc.common help alignment")
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Diffstat (limited to 'package/base-files/files/etc')
-rwxr-xr-x | package/base-files/files/etc/rc.common | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common index d3d91ef250..f39b69464e 100755 --- a/package/base-files/files/etc/rc.common +++ b/package/base-files/files/etc/rc.common @@ -62,15 +62,15 @@ depends() { return 0 } -EXTRA_HELP="" -EXTRA_COMMANDS="boot shutdown depends" +ALL_HELP="" +ALL_COMMANDS="boot shutdown depends" extra_command() { local cmd="$1" local help="$2" local extra="$(printf "%-16s%s" "${cmd}" "${help}")" - EXTRA_HELP="${EXTRA_HELP}\t${extra}\n" - EXTRA_COMMANDS="${EXTRA_COMMANDS} ${cmd}" + ALL_HELP="${ALL_HELP}\t${extra}\n" + ALL_COMMANDS="${ALL_COMMANDS} ${cmd}" } help() { @@ -79,7 +79,7 @@ Syntax: $initscript [command] Available commands: EOF - echo -e "$EXTRA_HELP" + echo -e "$ALL_HELP" } # for procd @@ -175,6 +175,7 @@ extra_command "enabled" "Check if service is started on boot" } } -ALL_COMMANDS="${EXTRA_COMMANDS}" +ALL_COMMANDS="${ALL_COMMANDS} ${EXTRA_COMMANDS}" +ALL_HELP="${ALL_HELP}${EXTRA_HELP}" list_contains ALL_COMMANDS "$action" || action=help $action "$@" |