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