Skip to content

Commit 1f58601

Browse files
committed
Wireguard: suppress errors if Docker is not yet installed
1 parent 260b8d7 commit 1f58601

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tools/modules/software/module_wireguard.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,24 +257,30 @@ function module_wireguard () {
257257
fi
258258
;;
259259
"${commands[6]}")
260-
local image=$(docker image ls -a | mawk '/wireguard?( |$)/{print $3}')
260+
if pkg_installed docker-ce; then
261+
local image=$(docker image ls -a | mawk '/wireguard?( |$)/{print $3}')
262+
fi
261263
if [[ "${image}" ]]; then
262264
return 0
263265
else
264266
return 1
265267
fi
266268
;;
267269
"${commands[7]}")
268-
local container=$(docker container ls -a | mawk '/wireguard?( |$)/{print $1}')
270+
if pkg_installed docker-ce; then
271+
local container=$(docker container ls -a | mawk '/wireguard?( |$)/{print $1}')
272+
fi
269273
if [[ "${container}" ]]; then
270274
return 0
271275
else
272276
return 1
273277
fi
274278
;;
275279
"${commands[8]}")
276-
local container=$(docker container ls -a | mawk '/wireguard?( |$)/{print $1}')
277-
local image=$(docker image ls -a | mawk '/wireguard?( |$)/{print $3}')
280+
if pkg_installed docker-ce; then
281+
local container=$(docker container ls -a | mawk '/wireguard?( |$)/{print $1}')
282+
local image=$(docker image ls -a | mawk '/wireguard?( |$)/{print $3}')
283+
fi
278284
if [[ "${container}" && "${image}" && -f "${WIREGUARD_BASE}/config/wg_confs/wg0.conf" ]]; then
279285
return 0
280286
else

0 commit comments

Comments
 (0)