✨ toolcheck
This commit is contained in:
parent
de101b21e8
commit
2137ab881b
@ -16,7 +16,7 @@ color_white=""
|
||||
|
||||
|
||||
## ONLY IF PRINTING TO A TERMINAL ##
|
||||
if test -t 1; then
|
||||
if test -t 1 && [[ -f $(which tput) ]]; then
|
||||
# check count of supported colors
|
||||
color_count=$(TERM=${TERM:-"dumb"} tput colors)
|
||||
if [[ ! -z "$color_count" && "$color_count" -ge 8 ]]; then
|
||||
|
23
lib/toolcheck
Normal file
23
lib/toolcheck
Normal file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Make sure all required 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
|
||||
|
||||
|
||||
## 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'"
|
||||
fi
|
||||
done
|
||||
}
|
Loading…
Reference in New Issue
Block a user