🧱 dont rely on dpkg
This commit is contained in:
parent
2137ab881b
commit
7b4d46601f
@ -1,23 +1,34 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#
|
#
|
||||||
# Make sure all required tools are installed.
|
# Make sure tools are installed.
|
||||||
#
|
#
|
||||||
workplace_toolcheck(){
|
toolcheck(){
|
||||||
## BINARIES IN PATH ##
|
for b in $2; do
|
||||||
bin_tool_list=("grep")
|
if [[ ! -f $(which "$b" 2> /dev/null) ]]; then
|
||||||
for b in $bin_tool_list; do
|
case $1 in
|
||||||
if [[ ! -f $(which "$b") ]]; then
|
error)
|
||||||
log_error "Missing tool '$b'"
|
log_error "Missing tool '$b'"
|
||||||
fi
|
;;
|
||||||
done
|
|
||||||
|
warn)
|
||||||
|
log_warn "Missing tool '$b'"
|
||||||
## DPKG PACKAGES ##
|
return 1
|
||||||
dpkg_tool_list=("sed iptables iproute2")
|
;;
|
||||||
for d in $dpkg_tool_list; do
|
|
||||||
if ! dpkg -s $d 2>&1 | grep -q "Status: install ok installed"; then
|
info)
|
||||||
log_error "Missing tool '$d'"
|
log_info "Missing tool '$b'"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
silent)
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
log_error "Unknown log level '$1'"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user