Adds check for docker executable and adds snap to path

This commit is contained in:
anuragpeshne 2023-01-01 10:51:09 -08:00 committed by Chai Feng
parent a273ac9d51
commit 17e6047590
2 changed files with 8 additions and 1 deletions

View File

@ -15,6 +15,9 @@ source "$working_dir"/bach/bach.sh
@mock iptables --version @mock iptables --version
@mocktrue grep -F '(legacy)' @mocktrue grep -F '(legacy)'
@mocktrue docker -v
@mock docker -v === @stdout Docker version 0.0.0, build dummy
@ignore remove_blank_lines @ignore remove_blank_lines
@ignore echo @ignore echo
@ignore err @ignore err

View File

@ -5,7 +5,7 @@ set -euo pipefail
LANG=en_US.UTF-8 LANG=en_US.UTF-8
LANGUAGE=en_US: LANGUAGE=en_US:
LC_ALL=en_US.UTF-8 LC_ALL=en_US.UTF-8
PATH="/bin:/usr/bin:/sbin:/usr/sbin" PATH="/bin:/usr/bin:/sbin:/usr/sbin:/snap/bin/"
GREP_REGEXP_INSTANCE_NAME="[-_.[:alnum:]]\\+" GREP_REGEXP_INSTANCE_NAME="[-_.[:alnum:]]\\+"
DEFAULT_PROTO=tcp DEFAULT_PROTO=tcp
@ -424,6 +424,10 @@ if ! ufw status 2>/dev/null | grep -Fq "Status: active" ; then
die "UFW is disabled or you are not root user, or mismatched iptables legacy/nf_tables, current $(iptables --version)" die "UFW is disabled or you are not root user, or mismatched iptables legacy/nf_tables, current $(iptables --version)"
fi fi
if ! docker -v &> /dev/null; then
die "Docker executable not found."
fi
ufw_action="${1:-help}" ufw_action="${1:-help}"
case "$ufw_action" in case "$ufw_action" in