toolcheck

This commit is contained in:
DrMaxNix 2024-05-25 00:27:22 +02:00
parent de101b21e8
commit 2137ab881b
3 changed files with 25 additions and 2 deletions

View File

@ -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
View 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
}

2
xynat
View File

@ -15,7 +15,7 @@ VERSION=$(cat ${SCRIPT_DIR}/VERSION | xargs)
# load libraries
source "${SCRIPT_DIR}/lib/color"
source "${SCRIPT_DIR}/lib/log"
#source "${SCRIPT_DIR}/lib/toolcheck"
source "${SCRIPT_DIR}/lib/toolcheck"
source "${SCRIPT_DIR}/lib/sudocheck"
# regex definitions