1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-24 04:07:55 +01:00

see SF bug #3416900 "Replace command with which". Generated

script (Linux/iptables) used to use "command -v" to check if command
line tools it needs are present on the system. This was used to find
iptables, lsmod, modprobe, ifconfig, vconfig, logger and others. Some
embedded Linux distributions, notably TomatoUSB, come without support
for "command". Switching to "which" that is more ubuquitous and should
be available pretty much everywhere.
This commit is contained in:
Vadim Kurland 2011-10-02 15:45:56 -07:00
parent 71df784112
commit a27cccaba5
9 changed files with 32 additions and 37 deletions

View File

@ -1,3 +1,14 @@
2011-10-02 Vadim Kurland <vadim@netcitadel.com>
* shell_functions: see SF bug #3416900 "Replace `command` with
`which`". Generated script (Linux/iptables) used to use "command
-v" to check if command line tools it needs are present on the
system. This was used to find iptables, lsmod, modprobe, ifconfig,
vconfig, logger and others. Some embedded Linux distributions,
notably TomatoUSB, come without support for "command". Switching to
"which" that is more ubuquitous and should be available pretty
much everywhere.
2011-09-29 Vadim Kurland <vadim@netcitadel.com>
* SSHSession.cpp (startSession): enable fwbuilder to take

View File

@ -28,16 +28,10 @@
## These variables are set in OSConfigurator_linux24::printShellFunctions()
## About using "command" to find programs:
##
## apparently "command" is POSIX compliant and should be widely
## available. Another tool that could be used is "type -P" but that is
## bash built-in
##
## Verified DD-WRT v24 and OpenWRT kamikaze 8.09.2 both have command
## and type (both use busybox)
find_program() {
PGM=$1
command -v $PGM >/dev/null 2>&1 || {
which $PGM >/dev/null 2>&1 || {
echo "$PGM not found"
exit 1
}

View File

@ -27,18 +27,10 @@
##
## These variables are set in OSConfigurator_linux24::printShellFunctions()
##
## About using "command" to find programs:
##
## apparently "command" is POSIX compliant and should be widely
## available. Another tool that could be used is "type -P" but that is
## bash built-in
##
## Verified DD-WRT v24 and OpenWRT kamikaze 8.09.2 both have command
## and type (both use busybox)
find_program() {
PGM=$1
command -v $PGM >/dev/null 2>&1 || {
which $PGM >/dev/null 2>&1 || {
echo "$PGM not found"
exit 1
}

View File

@ -13,7 +13,7 @@
log() {
echo "$1"
command -v "$LOGGER" >/dev/null 2>&1 && $LOGGER -p info "$1"
which "$LOGGER" >/dev/null 2>&1 && $LOGGER -p info "$1"
}
check_file() {

View File

@ -27,18 +27,10 @@
##
## These variables are set in OSConfigurator_linux24::printShellFunctions()
##
## About using "command" to find programs:
##
## apparently "command" is POSIX compliant and should be widely
## available. Another tool that could be used is "type -P" but that is
## bash built-in
##
## Verified DD-WRT v24 and OpenWRT kamikaze 8.09.2 both have command
## and type (both use busybox)
find_program() {
PGM=$1
command -v $PGM >/dev/null 2>&1 || {
which $PGM >/dev/null 2>&1 || {
echo "$PGM not found"
exit 1
}

View File

@ -2,7 +2,7 @@
log() {
echo "$1"
command -v "$LOGGER" >/dev/null 2>&1 && $LOGGER -p info "$1"
which "$LOGGER" >/dev/null 2>&1 && $LOGGER -p info "$1"
}
getInterfaceVarName() {

View File

@ -11,18 +11,10 @@
## {{$var}} is variable expansion
## {{if var}} is conditional operator.
##
## About using "command" to find programs:
##
## apparently "command" is POSIX compliant and should be widely
## available. Another tool that could be used is "type -P" but that is
## bash built-in
##
## Verified DD-WRT v24 and OpenWRT kamikaze 8.09.2 both have command
## and type (both use busybox)
find_program() {
PGM=$1
command -v $PGM >/dev/null 2>&1 || {
which $PGM >/dev/null 2>&1 || {
echo "$PGM not found"
exit 1
}

View File

@ -13,7 +13,7 @@
log() {
echo "$1"
command -v "$LOGGER" >/dev/null 2>&1 && $LOGGER -p info "$1"
which "$LOGGER" >/dev/null 2>&1 && $LOGGER -p info "$1"
}
check_file() {

View File

@ -233,6 +233,20 @@
was used in the "Interface" column of a policy rule.
</p>
</li>
<li>
<p>
see SF bug #3416900 "Replace `command` with `which`". Generated
script (Linux/iptables) used to use "command -v" to check if
command line tools it needs are present on the system. This was
used to find iptables, lsmod, modprobe, ifconfig, vconfig,
logger and others. Some embedded Linux distributions, notably
TomatoUSB, come without support for "command". Switching to
"which" that is more ubuquitous and should be available pretty
much everywhere.
</p>
</li>
</ul>