[Asterisk-code-review] install prereq: Check if is installed aptitude otherwise to ... (asterisk[13])

Kevin Harwell asteriskteam at digium.com
Thu Mar 17 14:19:03 CDT 2016


Kevin Harwell has uploaded a new change for review.

  https://gerrit.asterisk.org/2431

Change subject: install_prereq: Check if is installed aptitude otherwise to install.
......................................................................

install_prereq: Check if is installed aptitude otherwise to install.

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 <decipher.hk at gmail.com>

Change-Id: Iebdff55805d3917166e5e08e0a1e2176f36ff27f
(cherry picked from commit 6737ded0581a9e1256bdfe30c1d747e7ca93f8b3)
---
M contrib/scripts/install_prereq
1 file changed, 7 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/31/2431/1

diff --git a/contrib/scripts/install_prereq b/contrib/scripts/install_prereq
index a47f38b..f8d5c53 100755
--- a/contrib/scripts/install_prereq
+++ b/contrib/scripts/install_prereq
@@ -70,9 +70,10 @@
 	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 @@
 }
 
 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
 }

-- 
To view, visit https://gerrit.asterisk.org/2431
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iebdff55805d3917166e5e08e0a1e2176f36ff27f
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Rodrigo Ramirez Norambuena <a at rodrigoramirez.com>



More information about the asterisk-code-review mailing list