Last active
June 12, 2020 12:54
-
-
Save XIIIVI/27a691f08b7e358443fa83f10f793747 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# check_installed_packages | |
# | |
check_installed_packages(){ | |
local PACKAGE_LIST=("$@") # Rebuild the array with rest of arguments | |
for index in "${PACKAGE_LIST[@]}"; | |
do | |
TEST_COUNT=$((TEST_COUNT + 1)) | |
IS_INSTALLED=$(awk '/Package:/ {print $2}' ${MNT_DIR}/var/lib/dpkg/status | grep -x ${index} || true) | |
if [ -z "${IS_INSTALLED}" ] | |
then | |
test_failed "The package ${index} is missing" | |
else | |
test_succeeded "The package ${index} has been found" | |
fi | |
done | |
} | |
# | |
# check_missing_packages | |
# | |
check_missing_packages(){ | |
local PACKAGE_LIST=("$@") # Rebuild the array with rest of arguments | |
for index in "${PACKAGE_LIST[@]}"; | |
do | |
TEST_COUNT=$((TEST_COUNT + 1)) | |
IS_INSTALLED=$(awk '/Package:/ {print $2}' ${MNT_DIR}/var/lib/dpkg/status | grep -x ${index} || true) | |
if [ -z "${IS_INSTALLED}" ] | |
then | |
test_succeeded "The package ${index} is missing" | |
else | |
test_failed "The package ${index} has been found" | |
fi | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment