summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-ddns/root/usr
diff options
context:
space:
mode:
authorPaul Spooren <mail@aparcar.org>2020-08-09 13:42:09 -1000
committerPaul Spooren <mail@aparcar.org>2020-08-20 15:54:54 -1000
commitc4a4e43e2e97065dcda53c9ac7ee49c05171dbd8 (patch)
tree5f2e877793a63c9e639410ce868d2f755f5db695 /applications/luci-app-ddns/root/usr
parent03253c23090a9928c15ab8d80c18b734e3e814ed (diff)
treewide: replace `which` with `command -v`
Fix shellcheck SC2230 > which is non-standard. Use builtin 'command -v' instead. Once applied to everything concerning OpenWrt we can disable the busybox feature `which` and save 3.8kB. Signed-off-by: Paul Spooren <mail@aparcar.org>
Diffstat (limited to 'applications/luci-app-ddns/root/usr')
-rwxr-xr-xapplications/luci-app-ddns/root/usr/libexec/rpcd/luci.ddns22
1 files changed, 11 insertions, 11 deletions
diff --git a/applications/luci-app-ddns/root/usr/libexec/rpcd/luci.ddns b/applications/luci-app-ddns/root/usr/libexec/rpcd/luci.ddns
index 8ba4ad3165..7710ee66f4 100755
--- a/applications/luci-app-ddns/root/usr/libexec/rpcd/luci.ddns
+++ b/applications/luci-app-ddns/root/usr/libexec/rpcd/luci.ddns
@@ -179,23 +179,23 @@ local methods = {
local cache = {}
local function has_wget()
- return (sys.call( [[which wget >/dev/null 2>&1]] ) == 0)
+ return (sys.call( [[command -v wget >/dev/null 2>&1]] ) == 0)
end
local function has_wgetssl()
if cache['has_wgetssl'] then return cache['has_wgetssl'] end
- local res = (sys.call( [[which wget-ssl >/dev/null 2>&1]] ) == 0)
+ local res = (sys.call( [[command -v wget-ssl >/dev/null 2>&1]] ) == 0)
cache['has_wgetssl'] = res
return res
end
local function has_curlssl()
- return (sys.call( [[$(which curl) -V 2>&1 | grep -qF "https"]] ) == 0)
+ return (sys.call( [[$(command -v curl) -V 2>&1 | grep -qF "https"]] ) == 0)
end
local function has_fetch()
if cache['has_fetch'] then return cache['has_fetch'] end
- local res = (sys.call( [[which uclient-fetch >/dev/null 2>&1]] ) == 0)
+ local res = (sys.call( [[command -v uclient-fetch >/dev/null 2>&1]] ) == 0)
cache['has_fetch'] = res
return res
end
@@ -206,7 +206,7 @@ local methods = {
local function has_curl()
if cache['has_curl'] then return cache['has_curl'] end
- local res = (sys.call( [[which curl >/dev/null 2>&1]] ) == 0)
+ local res = (sys.call( [[command -v curl >/dev/null 2>&1]] ) == 0)
cache['has_curl'] = res
return res
end
@@ -216,7 +216,7 @@ local methods = {
end
local function has_bbwget()
- return (sys.call( [[$(which wget) -V 2>&1 | grep -iqF "busybox"]] ) == 0)
+ return (sys.call( [[$(command -v wget) -V 2>&1 | grep -iqF "busybox"]] ) == 0)
end
res['has_wget'] = has_wget() or false
@@ -229,17 +229,17 @@ local methods = {
local function has_bindhost()
if cache['has_bindhost'] then return cache['has_bindhost'] end
- local res = (sys.call( [[which host >/dev/null 2>&1]] ) == 0)
+ local res = (sys.call( [[command -v host >/dev/null 2>&1]] ) == 0)
if res then
cache['has_bindhost'] = res
return true
end
- res = (sys.call( [[which khost >/dev/null 2>&1]] ) == 0)
+ res = (sys.call( [[command -v khost >/dev/null 2>&1]] ) == 0)
if res then
cache['has_bindhost'] = res
return true
end
- res = (sys.call( [[which drill >/dev/null 2>&1]] ) == 0)
+ res = (sys.call( [[command -v drill >/dev/null 2>&1]] ) == 0)
if res then
cache['has_bindhost'] = res
return true
@@ -251,11 +251,11 @@ local methods = {
res['has_bindhost'] = cache['has_bindhost'] or has_bindhost() or false
local function has_hostip()
- return (sys.call( [[which hostip >/dev/null 2>&1]] ) == 0)
+ return (sys.call( [[command -v hostip >/dev/null 2>&1]] ) == 0)
end
local function has_nslookup()
- return (sys.call( [[which nslookup >/dev/null 2>&1]] ) == 0)
+ return (sys.call( [[command -v nslookup >/dev/null 2>&1]] ) == 0)
end
res['has_dnsserver'] = cache['has_bindhost'] or has_nslookup() or has_hostip() or has_bindhost() or false