From 53015152b3a60545106c794120df7a66c3a2df3c Mon Sep 17 00:00:00 2001 From: Tristan PILAT Date: Mon, 25 Mar 2019 17:50:10 +0100 Subject: [PATCH] We now use is_installed function to test whether a package is installed --- evocheck.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/evocheck.sh b/evocheck.sh index ce02c7c..b20c775 100755 --- a/evocheck.sh +++ b/evocheck.sh @@ -275,7 +275,9 @@ if [ "$IS_HISTORY" = 1 ]; then fi if [ "$IS_VIM" = 1 ]; then - pkg_info | grep -q vim || failed "IS_VIM" "vim is not installed! Please add with pkg_add vim" + if ! is_installed vim; then + failed "IS_VIM" "vim is not installed! Please add with pkg_add vim" + fi fi if [ "$IS_TTYC0SECURE" = 1 ]; then @@ -294,15 +296,21 @@ if [ "$IS_SUDOMAINT" = 1 ]; then fi if [ "$IS_POSTGRESQL" = 1 ]; then - pkg_info | grep -q postgresql-client || failed "IS_POSTGRESQL" "postgresql-client is not installed! Please add with pkg_add postgresql-client" + if ! is_installed postgresql-client; then + failed "IS_POSTGRESQL" "postgresql-client is not installed! Please add with pkg_add postgresql-client" + fi fi if [ "$IS_NRPE" = 1 ]; then - ( pkg_info | grep -q monitoring-plugins && pkg_info | grep -q nrpe ) || failed "IS_NRPE" "nrpe and/or monitoring-plugins are not installed! Please add with pkg_add nrpe monitoring-plugins" + if ! is_installed monitoring-plugins || ! is_installed nrpe; then + failed "IS_NRPE" "nrpe and/or monitoring-plugins are not installed! Please add with pkg_add nrpe monitoring-plugins" + fi fi if [ "$IS_RSYNC" = 1 ]; then - pkg_info | grep -q rsync || failed "IS_RSYNC" "rsync is not installed! Please add with pkg_add rsync" + if ! is_installed rsync; then + failed "IS_RSYNC" "rsync is not installed! Please add with pkg_add rsync" + fi fi if [ "$IS_CRONPATH" = 1 ]; then