[zaptel-commits] tzafrir: branch 1.4 r2881 - in /branches/1.4: ./ build_tools/install_prereq

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Fri Aug 17 13:13:57 CDT 2007


Author: tzafrir
Date: Fri Aug 17 13:13:57 2007
New Revision: 2881

URL: http://svn.digium.com/view/zaptel?view=rev&rev=2881
Log:
install_prereq: Don't install packages twice.

Merged revisions 2880 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

Modified:
    branches/1.4/   (props changed)
    branches/1.4/build_tools/install_prereq

Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: branches/1.4/build_tools/install_prereq
URL: http://svn.digium.com/view/zaptel/branches/1.4/build_tools/install_prereq?view=diff&rev=2881&r1=2880&r2=2881
==============================================================================
--- branches/1.4/build_tools/install_prereq (original)
+++ branches/1.4/build_tools/install_prereq Fri Aug 17 13:13:57 2007
@@ -26,6 +26,23 @@
 esac
 
 
+# Fixme: should be done by apt and not by dpkg?
+check_installed_debs() {
+	 dpkg-query -W --showformat '${Status} ${Package}\n' "$@" 2>/dev/null \
+	 | awk '/ not-installed/{print $4}'
+}
+
+# parsing the output of yum is close to impossible.
+# We'll use rpm and hope for the best:
+check_installed_rpms() {
+	for pack in "$@"
+	do
+		if ! rpm -q $pack >/dev/null 2>/dev/null
+		then echo $pack
+		fi
+	done
+}
+
 
 has_kernel_source() {
 	test -r /lib/modules/$KVERS/build/.config
@@ -38,6 +55,7 @@
 handle_debian() {
 	# echo "# Distribution is Debian or compatible"
 	kernel_package=''
+	extra_packs=`check_installed_debs $PACKAGES_DEBIAN`
 	if ! has_kernel_source; then
 		kernel_package="linux-headers-$KVERS"
 		debian_release=`cat /etc/debian_version`
@@ -46,15 +64,16 @@
 		esac
 		echo "# Kernel source not found. Installing $kernel_package"
 	fi
-	$testcmd apt-get install -y $PACKAGES_DEBIAN $kernel_package
+	$testcmd apt-get install -y $extra_packs $kernel_package
 }
 
 handle_rh() {
-	# echo "# Distribution is Debian or compatible"
+	# echo "# Distribution is RedHat or similar."
 	kernel_package=''
+	extra_packs=`check_installed_rpms $PACKAGES_RH`
 	if ! has_kernel_source; then
 		kern_str='' # extra "kernel version"
-		case $KVERS in
+		case "$KVERS" in
 		*smp*) kern_str='-smp';;
 		*PAE*) kern_str='-PAE';;
 		*xen*) kern_str='-xen';;
@@ -68,7 +87,7 @@
 		echo "#"
 		echo "# and then reboot to upgrade to the newly installed kernel."
 	fi
-	$testcmd yum install -y $PACKAGES_RH $kernel_package
+	$testcmd yum install -y $extra_packs $kernel_package
 }
 
 if in_test_mode; then




More information about the zaptel-commits mailing list