[asterisk-commits] install prereq: Check if is installed aptitude otherwise to ... (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 11 18:44:21 CDT 2015


Matt Jordan has submitted this change and it was merged.

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
---
M contrib/scripts/install_prereq
1 file changed, 7 insertions(+), 3 deletions(-)

Approvals:
  Scott Griepentrog: Looks good to me, but someone else must approve
  Matt Jordan: Looks good to me, approved; Verified



diff --git a/contrib/scripts/install_prereq b/contrib/scripts/install_prereq
index 58ef05c..b0caab8 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/508
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iebdff55805d3917166e5e08e0a1e2176f36ff27f
Gerrit-PatchSet: 3
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Rodrigo Ramirez Norambuena <decipher.hk at gmail.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Rodrigo Ramirez Norambuena <decipher.hk at gmail.com>
Gerrit-Reviewer: Scott Griepentrog <sgriepentrog at digium.com>



More information about the asterisk-commits mailing list