[asterisk-commits] tzafrir: branch group/zapata_conf r84886 - /team/group/zapata_conf/contrib/sc...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 5 19:24:15 CDT 2007


Author: tzafrir
Date: Fri Oct  5 19:24:14 2007
New Revision: 84886

URL: http://svn.digium.com/view/asterisk?view=rev&rev=84886
Log:
Add install_prereq from bug #10523 to the branch team/group/zapata_conf .

This script is intended to sort out what needs to be installed for
building Asterisk.
Not related to this branch, but separate enough.

Added:
    team/group/zapata_conf/contrib/scripts/install_prereq   (with props)

Added: team/group/zapata_conf/contrib/scripts/install_prereq
URL: http://svn.digium.com/view/asterisk/team/group/zapata_conf/contrib/scripts/install_prereq?view=auto&rev=84886
==============================================================================
--- team/group/zapata_conf/contrib/scripts/install_prereq (added)
+++ team/group/zapata_conf/contrib/scripts/install_prereq Fri Oct  5 19:24:14 2007
@@ -1,0 +1,103 @@
+#! /bin/sh
+
+# install_prereq: a script to install distribution-specific
+# prerequirements
+
+set -e
+
+usage() {
+  echo "$0: a script to install distribution-specific prerequirement"
+  echo 'Revision: $Id$'
+  echo ""
+  echo "Usage: $0:         Shows this message."
+  echo "Usage: $0 test     Prints commands it is about to run."
+  echo "Usage: $0 install  Really install."
+}
+
+# Basic build system:
+PACKAGES_DEBIAN="build-essential"
+# Asterisk: basic requirements:
+PACKAGES_DEBIAN="$PACKAGES_DEBIAN bison libncurses-dev libz-dev libssl-dev"
+# Asterisk: very useful addons:
+PACKAGES_DEBIAN="$PACKAGES_DEBIAN libcurl-dev libspeex-dev libogg-dev libvorbis-dev libasound2-dev"
+# Asterisk: nice-to-have addons:
+PACKAGES_DEBIAN="$PACKAGES_DEBIAN libpq-dev unixodbc-dev libsqlite-dev"
+# Not so nice addon:
+PACKAGES_DEBIAN="$PACKAGES_DEBIAN libopenh323-dev"
+# Extras for 1.4:
+PACKAGES_DEBIAN="$PACKAGES_DEBIAN libsnmp-dev libiksemel-dev "
+
+PACKAGES_RH="gcc gcc-c++ bison ncurses-devel openssl-devel"
+
+KVERS=`uname -r`
+
+case "$1" in
+test)    testcmd=echo ;;
+install) testcmd='' ;;
+'') usage; exit 0 ;;
+*) usage; exit 1 ;;
+esac
+
+in_test_mode() {
+  test "$testcmd" != ''
+}
+
+# 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
+}
+
+handle_debian() {
+	# echo "# Distribution is Debian or compatible"
+	extra_packs=`check_installed_debs $PACKAGES_DEBIAN`
+	
+	if [ "$kernel_package" = '' ]; then
+		return
+	fi
+	
+	$testcmd apt-get install -y $extra_packs
+}
+
+handle_rh() {
+	# echo "# Distribution is Debian or compatible"
+	extra_packs=`check_installed_rpms $PACKAGES_RH`
+
+	if [ "$kernel_package" = '' ]; then
+		return
+	fi
+	
+	$testcmd yum install -y $extra_packs
+}
+
+if in_test_mode; then
+	echo "#############################################"
+	echo "## $1: test mode."
+	echo "## Use the commands here to install your system."
+	echo "#############################################"
+fi
+
+# handle the easy case of Debians first
+if [ -r /etc/debian_version ]; then
+  handle_debian
+elif [ -r /etc/redhat-release ]; then
+  handle_rh
+fi
+
+echo "#############################################"
+echo "## $1 completed successfully"
+if in_test_mode; then
+	echo "## (in test mode)"
+fi
+echo "#############################################"

Propchange: team/group/zapata_conf/contrib/scripts/install_prereq
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/group/zapata_conf/contrib/scripts/install_prereq
------------------------------------------------------------------------------
    svn:executable = *

Propchange: team/group/zapata_conf/contrib/scripts/install_prereq
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/group/zapata_conf/contrib/scripts/install_prereq
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the asterisk-commits mailing list