From c4a4e43e2e97065dcda53c9ac7ee49c05171dbd8 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Sun, 9 Aug 2020 13:42:09 -1000 Subject: 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 --- .../luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'applications/luci-app-dockerman/luasrc/model/cbi') diff --git a/applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua b/applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua index 37be23e0d..ec3f9201a 100644 --- a/applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua +++ b/applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua @@ -664,8 +664,8 @@ elseif action == "logs" then elseif action == "console" then m.submit = false m.reset = false - local cmd_docker = luci.util.exec("which docker"):match("^.+docker") or nil - local cmd_ttyd = luci.util.exec("which ttyd"):match("^.+ttyd") or nil + local cmd_docker = luci.util.exec("command -v docker"):match("^.+docker") or nil + local cmd_ttyd = luci.util.exec("command -v ttyd"):match("^.+ttyd") or nil if cmd_docker and cmd_ttyd and container_info.State.Status == "running" then local cmd = "/bin/sh" @@ -697,8 +697,8 @@ elseif action == "console" then Button.render(self, section, scope) end o.write = function(self, section) - local cmd_docker = luci.util.exec("which docker"):match("^.+docker") or nil - local cmd_ttyd = luci.util.exec("which ttyd"):match("^.+ttyd") or nil + local cmd_docker = luci.util.exec("command -v docker"):match("^.+docker") or nil + local cmd_ttyd = luci.util.exec("command -v ttyd"):match("^.+ttyd") or nil if not cmd_docker or not cmd_ttyd or cmd_docker:match("^%s+$") or cmd_ttyd:match("^%s+$")then return -- cgit v1.2.3