mirror of
https://github.com/opencv/opencv.git
synced 2024-12-20 04:28:02 +08:00
43 lines
1.2 KiB
Plaintext
43 lines
1.2 KiB
Plaintext
|
#!/bin/bash
|
||
|
###########################################################################################
|
||
|
#
|
||
|
# This script checks for the required Debian packages are installed
|
||
|
# to build OpenCV.
|
||
|
# Commandline parameters:
|
||
|
# $@ - These are the names of the packages to check with 'dpkg'
|
||
|
#
|
||
|
# Returns:
|
||
|
# 0 - All packages installed (success)
|
||
|
# 1 - One or more packages missing (failure)
|
||
|
#
|
||
|
# Kerry Billingham <contact (at) avionicengineers (d0t) com>
|
||
|
# 20 April 2016
|
||
|
#
|
||
|
###########################################################################################
|
||
|
red=$'\e[1;31m'
|
||
|
green=$'\e[1;32m'
|
||
|
end=$'\e[0m'
|
||
|
check_message="Checking for 'dpkg'"
|
||
|
dpkg -? &>/dev/null
|
||
|
if [ $? -ne 0 ]; then
|
||
|
printf "%-80s%s\n" "${check_message}" "${red} MISSING.${end}"
|
||
|
exit 1
|
||
|
else
|
||
|
printf "%-80s%s\n" "${check_message}" "${green} INSTALLED.${end}"
|
||
|
fi
|
||
|
|
||
|
declare -i packageMissing=0
|
||
|
packageArray=( "$@" )
|
||
|
for package in ${packageArray[@]}; do
|
||
|
check_message="Checking for package ${package}"
|
||
|
dpkg -s ${package} &>/dev/null
|
||
|
if [ $? -ne 0 ]; then
|
||
|
printf "%-80s%s\n" "${check_message}" "${red} MISSING.${end}"
|
||
|
packageMissing=1
|
||
|
else
|
||
|
printf "%-80s%s\n" "${check_message}" "${green} INSTALLED.${end}"
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
exit $packageMissing
|