From efcf9a96db6c40ea658f597714d0ff841ec0d412 Mon Sep 17 00:00:00 2001 From: Rodrigo Ramírez Norambuena Date: Wed, 3 Jun 2015 21:12:50 -0400 Subject: install_prereq: Check if is installed aptitude otherwise to install. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If in Debian or system based, dont have aptitude installed the script do nothing. This patch checked if aptitude installed, if not installed. Also, if execute script with all packages installed yet, the script not show nothing and return exit 1 because the command 'grep' get nothing from pipe from 'awk'. ASTERISK-25113 #close Reported By: Rodrigo Ramírez Norambuena Change-Id: Iebdff55805d3917166e5e08e0a1e2176f36ff27f (cherry picked from commit 6737ded0581a9e1256bdfe30c1d747e7ca93f8b3) --- contrib/scripts/install_prereq | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'contrib/scripts/install_prereq') diff --git a/contrib/scripts/install_prereq b/contrib/scripts/install_prereq index a47f38b10..f8d5c534d 100755 --- a/contrib/scripts/install_prereq +++ b/contrib/scripts/install_prereq @@ -70,9 +70,10 @@ check_installed_debs() { do tocheck="${tocheck} ^${pack}$" done - aptitude -F '%c %p' search ${tocheck} 2>/dev/null \ - | awk '/^p/{print $2}' \ - | grep -v ':i386$' + pkgs=$(aptitude -F '%c %p' search ${tocheck} 2>/dev/null | awk '/^p/{print $2}') + if ! [ ${#pkgs} -eq 0 ]; then + echo $pkgs | grep -v ':i386$' + fi } # parsing the output of yum is close to impossible. @@ -96,6 +97,9 @@ check_installed_pkgs() { } handle_debian() { + if ! [ -x "$(command -v aptitude)" ]; then + apt-get install aptitude + fi extra_packs=`check_installed_debs $PACKAGES_DEBIAN` $testcmd aptitude install -y $extra_packs } -- cgit v1.2.3