2008-05-12 20:34:38 +00:00
|
|
|
#! /bin/sh
|
|
|
|
#
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
|
|
|
# install_prereq: a script to install distribution-specific
|
|
|
|
# prerequirements
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
usage() {
|
2013-07-24 18:51:06 +00:00
|
|
|
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."
|
|
|
|
echo "Usage: $0 install-unpackaged Really install unpackaged requirements."
|
2008-05-12 20:34:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Basic build system:
|
2018-02-10 12:39:45 +01:00
|
|
|
PACKAGES_DEBIAN="build-essential pkg-config"
|
2008-05-12 20:34:38 +00:00
|
|
|
# Asterisk: basic requirements:
|
2018-01-05 22:17:05 +01:00
|
|
|
PACKAGES_DEBIAN="$PACKAGES_DEBIAN libedit-dev libjansson-dev libsqlite3-dev uuid-dev libxml2-dev"
|
2010-06-09 10:21:23 +00:00
|
|
|
# Asterisk: for addons:
|
2018-01-05 22:17:05 +01:00
|
|
|
PACKAGES_DEBIAN="$PACKAGES_DEBIAN libspeex-dev libspeexdsp-dev libogg-dev libvorbis-dev libasound2-dev portaudio19-dev libcurl4-openssl-dev xmlstarlet bison flex"
|
2018-01-19 13:19:42 +01:00
|
|
|
PACKAGES_DEBIAN="$PACKAGES_DEBIAN libpq-dev unixodbc-dev libltdl-dev libneon27-dev libgmime-2.6-dev liblua5.2-dev liburiparser-dev libxslt1-dev libssl-dev"
|
|
|
|
PACKAGES_DEBIAN="$PACKAGES_DEBIAN libh323plus-dev libvpb-dev libmysqlclient-dev libbluetooth-dev libradcli-dev freetds-dev libosptk-dev libjack-jackd2-dev bash"
|
2018-01-05 22:17:05 +01:00
|
|
|
PACKAGES_DEBIAN="$PACKAGES_DEBIAN libsnmp-dev libiksemel-dev libcorosync-common-dev libcpg-dev libcfg-dev libnewt-dev libpopt-dev libical-dev libspandsp-dev"
|
2018-01-19 13:19:42 +01:00
|
|
|
PACKAGES_DEBIAN="$PACKAGES_DEBIAN libresample1-dev libc-client2007e-dev binutils-dev libsrtp0-dev libsrtp2-dev libgsm1-dev doxygen graphviz zlib1g-dev libldap2-dev"
|
2018-01-05 22:17:05 +01:00
|
|
|
# Asterisk: for the unpackaged below:
|
|
|
|
PACKAGES_DEBIAN="$PACKAGES_DEBIAN wget subversion"
|
|
|
|
# Asterisk: for ./configure --with-pjproject-bundled:
|
|
|
|
PACKAGES_DEBIAN="$PACKAGES_DEBIAN bzip2 patch python-dev"
|
|
|
|
|
2018-01-19 12:16:15 +01:00
|
|
|
# Basic build system:
|
|
|
|
PACKAGES_RH="make gcc gcc-c++ pkgconfig"
|
|
|
|
# Asterisk: basic requirements:
|
|
|
|
PACKAGES_RH="$PACKAGES_RH libedit-devel jansson-devel libuuid-devel sqlite-devel libxml2-devel"
|
|
|
|
# Asterisk: for addons:
|
|
|
|
PACKAGES_RH="$PACKAGES_RH speex-devel speexdsp-devel libogg-devel libvorbis-devel alsa-lib-devel portaudio-devel libcurl-devel xmlstarlet bison flex"
|
|
|
|
PACKAGES_RH="$PACKAGES_RH postgresql-devel unixODBC-devel libtool-ltdl-devel neon-devel gmime-devel lua-devel uriparser-devel libxslt-devel openssl-devel"
|
|
|
|
PACKAGES_RH="$PACKAGES_RH mysql-devel bluez-libs-devel radcli-devel freetds-devel jack-audio-connection-kit-devel bash"
|
|
|
|
PACKAGES_RH="$PACKAGES_RH net-snmp-devel iksemel-devel corosynclib-devel newt-devel popt-devel libical-devel spandsp-devel"
|
|
|
|
PACKAGES_RH="$PACKAGES_RH libresample-devel uw-imap-devel binutils-devel libsrtp-devel gsm-devel doxygen graphviz zlib-devel openldap-devel hoard"
|
|
|
|
# Asterisk: for the unpackaged below:
|
|
|
|
PACKAGES_RH="$PACKAGES_RH wget subversion"
|
|
|
|
# Asterisk: for ./configure --with-pjproject-bundled:
|
|
|
|
PACKAGES_RH="$PACKAGES_RH bzip2 patch python-devel"
|
2008-05-12 20:34:38 +00:00
|
|
|
|
2013-08-01 17:07:52 +00:00
|
|
|
PACKAGES_OBSD="popt gmake wget libxml libogg libvorbis curl iksemel spandsp speex iodbc freetds-0.63p1-msdblib mysql-client gmime sqlite sqlite3 jack libxslt"
|
2016-04-30 16:52:47 -06:00
|
|
|
PACKAGES_FBSD="autoconf gcc binutils popt gmake wget libxml2 libogg libvorbis curl iksemel spandsp speex unixODBC freetds-devel mysql55-client gmime2 sqlite"
|
|
|
|
PACKAGES_FBSD="$PACKAGES_FBSD sqlite3 libxslt jansson e2fsprogs-libuuid gsm libsrtp libsamplerate"
|
2009-07-26 14:00:52 +00:00
|
|
|
|
2008-05-12 20:34:38 +00:00
|
|
|
KVERS=`uname -r`
|
|
|
|
|
2018-01-30 21:31:51 -05:00
|
|
|
JANSSON_VER=2.11
|
install_prereq: Build jansson from source, when necessary
When r383579 was committed, it made Jansson a required dependency.
While libjansson-dev and jansson-devel are available on recent
distros, some older (but still supported) distros don't have
it. There's a pull request[1] to get it into repoforge, but that still
doesn't help everyone. (And helps no one until the pull request is
merged and packages are built).
This patch adds Jansson install from source to the install_unpackaged()
function. There are a few gotcha's, which makes this change not
completely trivial.
* Since Jansson may be installed by a package, don't install from
source if a package installation can be found
* libresample may also be installed via package, so I added a
similar check to that.
* Since Jansson installs into /usr/local, this patch also adds
/usr/local/lib to /etc/ld.so.conf.d so that the library can be
found.
* The alternative was to install into /usr, but then it gets
complicated having to deal with EL's /usr/lib{32,64} shenanigans.
[1]: https://github.com/repoforge/rpms/pull/250
Review: https://reviewboard.asterisk.org/r/2414/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384488 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-01 20:10:47 +00:00
|
|
|
|
2008-05-12 20:34:38 +00:00
|
|
|
case "$1" in
|
2013-07-24 18:51:06 +00:00
|
|
|
test)
|
|
|
|
testcmd=echo
|
|
|
|
;;
|
|
|
|
install)
|
|
|
|
testcmd=''
|
|
|
|
;;
|
|
|
|
install-unpackaged)
|
|
|
|
unpackaged="yes"
|
|
|
|
;;
|
|
|
|
'')
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
;;
|
2008-05-12 20:34:38 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
in_test_mode() {
|
2013-07-24 18:51:06 +00:00
|
|
|
test "$testcmd" != ''
|
2008-05-12 20:34:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
check_installed_debs() {
|
2016-04-03 10:47:30 -06:00
|
|
|
for pack in "$@" ; do
|
|
|
|
tocheck="${tocheck} ^${pack}$ ~P^${pack}$"
|
2013-01-16 21:13:53 +00:00
|
|
|
done
|
2015-06-03 21:12:50 -04:00
|
|
|
pkgs=$(aptitude -F '%c %p' search ${tocheck} 2>/dev/null | awk '/^p/{print $2}')
|
2016-04-03 10:47:30 -06:00
|
|
|
if [ ${#pkgs} -ne 0 ]; then
|
|
|
|
echo $pkgs | sed -r -e "s/ ?[^ :]+:i386//g"
|
2015-06-03 21:12:50 -04:00
|
|
|
fi
|
2008-05-12 20:34:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# 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
|
|
|
|
}
|
|
|
|
|
2009-07-26 14:00:52 +00:00
|
|
|
check_installed_pkgs() {
|
|
|
|
for pack in "$@"
|
|
|
|
do
|
|
|
|
if [ `pkg_info -a | grep $pack | wc -l` = 0 ]; then
|
|
|
|
echo $pack
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2016-04-30 16:52:47 -06:00
|
|
|
check_installed_fpkgs() {
|
|
|
|
for pack in "$@"
|
|
|
|
do
|
|
|
|
if [ `pkg info -a | grep $pack | wc -l` = 0 ]; then
|
|
|
|
echo $pack
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2008-05-12 20:34:38 +00:00
|
|
|
handle_debian() {
|
2015-06-03 21:12:50 -04:00
|
|
|
if ! [ -x "$(command -v aptitude)" ]; then
|
|
|
|
apt-get install aptitude
|
|
|
|
fi
|
2008-05-12 20:34:38 +00:00
|
|
|
extra_packs=`check_installed_debs $PACKAGES_DEBIAN`
|
2015-10-19 09:11:55 -03:00
|
|
|
$testcmd aptitude update
|
2016-04-30 16:52:47 -06:00
|
|
|
if [ x"$extra_packs" != "x" ] ; then
|
|
|
|
$testcmd aptitude install -y $extra_packs
|
|
|
|
fi
|
2008-05-12 20:34:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
handle_rh() {
|
|
|
|
extra_packs=`check_installed_rpms $PACKAGES_RH`
|
2016-04-30 16:52:47 -06:00
|
|
|
if [ x"$extra_packs" != "x" ] ; then
|
2018-01-19 11:46:21 +01:00
|
|
|
$testcmd yum install --skip-broken --assumeyes $extra_packs
|
2016-04-30 16:52:47 -06:00
|
|
|
fi
|
2008-05-12 20:34:38 +00:00
|
|
|
}
|
|
|
|
|
2009-07-26 14:00:52 +00:00
|
|
|
handle_obsd() {
|
|
|
|
extra_packs=`check_installed_pkgs $PACKAGES_OBSD`
|
2016-04-30 16:52:47 -06:00
|
|
|
if [ x"$extra_packs" != "x" ] ; then
|
|
|
|
$testcmd pkg_add $extra_packs
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
handle_fbsd() {
|
|
|
|
extra_packs=`check_installed_fpkgs $PACKAGES_FBSD`
|
|
|
|
if [ x"$extra_packs" != "x" ] ; then
|
|
|
|
$testcmd pkg install -y $extra_packs
|
|
|
|
fi
|
2009-07-26 14:00:52 +00:00
|
|
|
}
|
|
|
|
|
2010-06-09 10:45:10 +00:00
|
|
|
install_unpackaged() {
|
|
|
|
echo "*** Installing NBS (Network Broadcast Sound) ***"
|
|
|
|
svn co http://svn.digium.com/svn/nbs/trunk nbs-trunk
|
|
|
|
cd nbs-trunk
|
2018-01-05 21:46:51 +01:00
|
|
|
make all install
|
2010-06-09 10:45:10 +00:00
|
|
|
cd ..
|
|
|
|
|
install_prereq: Build jansson from source, when necessary
When r383579 was committed, it made Jansson a required dependency.
While libjansson-dev and jansson-devel are available on recent
distros, some older (but still supported) distros don't have
it. There's a pull request[1] to get it into repoforge, but that still
doesn't help everyone. (And helps no one until the pull request is
merged and packages are built).
This patch adds Jansson install from source to the install_unpackaged()
function. There are a few gotcha's, which makes this change not
completely trivial.
* Since Jansson may be installed by a package, don't install from
source if a package installation can be found
* libresample may also be installed via package, so I added a
similar check to that.
* Since Jansson installs into /usr/local, this patch also adds
/usr/local/lib to /etc/ld.so.conf.d so that the library can be
found.
* The alternative was to install into /usr, but then it gets
complicated having to deal with EL's /usr/lib{32,64} shenanigans.
[1]: https://github.com/repoforge/rpms/pull/250
Review: https://reviewboard.asterisk.org/r/2414/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384488 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-01 20:10:47 +00:00
|
|
|
# Only install libresample if it wasn't installed via package
|
|
|
|
if ! test -f /usr/include/libresample.h; then
|
2013-07-24 18:51:06 +00:00
|
|
|
echo "*** Installing libresample ***"
|
|
|
|
svn co http://svn.digium.com/svn/thirdparty/libresample/trunk libresample-trunk
|
|
|
|
cd libresample-trunk
|
2018-01-05 21:46:51 +01:00
|
|
|
./configure
|
|
|
|
make all install
|
2013-07-24 18:51:06 +00:00
|
|
|
cd ..
|
install_prereq: Build jansson from source, when necessary
When r383579 was committed, it made Jansson a required dependency.
While libjansson-dev and jansson-devel are available on recent
distros, some older (but still supported) distros don't have
it. There's a pull request[1] to get it into repoforge, but that still
doesn't help everyone. (And helps no one until the pull request is
merged and packages are built).
This patch adds Jansson install from source to the install_unpackaged()
function. There are a few gotcha's, which makes this change not
completely trivial.
* Since Jansson may be installed by a package, don't install from
source if a package installation can be found
* libresample may also be installed via package, so I added a
similar check to that.
* Since Jansson installs into /usr/local, this patch also adds
/usr/local/lib to /etc/ld.so.conf.d so that the library can be
found.
* The alternative was to install into /usr, but then it gets
complicated having to deal with EL's /usr/lib{32,64} shenanigans.
[1]: https://github.com/repoforge/rpms/pull/250
Review: https://reviewboard.asterisk.org/r/2414/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384488 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-01 20:10:47 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Only install Jansson if it wasn't installed via package
|
|
|
|
if ! test -f /usr/include/jansson.h; then
|
|
|
|
echo "*** Installing jansson ***"
|
|
|
|
wget -O - http://www.digip.org/jansson/releases/jansson-${JANSSON_VER}.tar.gz | zcat | tar -xf -
|
|
|
|
cd jansson-${JANSSON_VER}
|
2018-01-05 21:46:51 +01:00
|
|
|
./configure
|
|
|
|
make all install
|
install_prereq: Build jansson from source, when necessary
When r383579 was committed, it made Jansson a required dependency.
While libjansson-dev and jansson-devel are available on recent
distros, some older (but still supported) distros don't have
it. There's a pull request[1] to get it into repoforge, but that still
doesn't help everyone. (And helps no one until the pull request is
merged and packages are built).
This patch adds Jansson install from source to the install_unpackaged()
function. There are a few gotcha's, which makes this change not
completely trivial.
* Since Jansson may be installed by a package, don't install from
source if a package installation can be found
* libresample may also be installed via package, so I added a
similar check to that.
* Since Jansson installs into /usr/local, this patch also adds
/usr/local/lib to /etc/ld.so.conf.d so that the library can be
found.
* The alternative was to install into /usr, but then it gets
complicated having to deal with EL's /usr/lib{32,64} shenanigans.
[1]: https://github.com/repoforge/rpms/pull/250
Review: https://reviewboard.asterisk.org/r/2414/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384488 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-01 20:10:47 +00:00
|
|
|
cd ..
|
|
|
|
echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local.conf
|
|
|
|
/sbin/ldconfig
|
|
|
|
fi
|
2013-07-24 18:51:06 +00:00
|
|
|
|
2017-11-04 12:05:36 +01:00
|
|
|
# Only install libsrtp2 if it wasn't installed via package
|
2013-07-24 18:51:06 +00:00
|
|
|
if ! test -f /usr/include/srtp/srtp.h; then
|
2017-11-04 12:05:36 +01:00
|
|
|
if ! test -f /usr/include/srtp2/srtp.h; then
|
|
|
|
echo "*** Installing libsrtp2 ***"
|
|
|
|
wget -O - http://github.com/cisco/libsrtp/archive/v2.tar.gz | zcat | tar -xf -
|
|
|
|
cd libsrtp-2
|
|
|
|
./configure --enable-openssl
|
2018-01-05 21:46:51 +01:00
|
|
|
make shared_library install
|
2017-11-04 12:05:36 +01:00
|
|
|
cd ..
|
|
|
|
echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local.conf
|
|
|
|
/sbin/ldconfig
|
2013-07-24 18:51:06 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! test -f /usr/include/pjlib.h; then
|
2018-01-05 21:46:51 +01:00
|
|
|
echo "PJProject not installed, yet. Therefore, please, run"
|
|
|
|
echo "./configure --with-pjproject-bundled"
|
2013-07-24 18:51:06 +00:00
|
|
|
fi
|
2010-06-09 10:45:10 +00:00
|
|
|
}
|
|
|
|
|
2008-05-12 20:34:38 +00:00
|
|
|
if in_test_mode; then
|
|
|
|
echo "#############################################"
|
|
|
|
echo "## $1: test mode."
|
|
|
|
echo "## Use the commands here to install your system."
|
|
|
|
echo "#############################################"
|
2010-06-09 10:45:10 +00:00
|
|
|
elif test "${unpackaged}" = "yes" ; then
|
|
|
|
install_unpackaged
|
|
|
|
exit 0
|
2008-05-12 20:34:38 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
OS=`uname -s`
|
|
|
|
unsupported_distro=''
|
|
|
|
|
|
|
|
# A number of distributions we don't (yet?) support.
|
2016-04-30 16:52:47 -06:00
|
|
|
if [ "$OS" != 'Linux' -a "$OS" != 'OpenBSD' -a "$OS" != 'FreeBSD' ]; then
|
2013-07-24 18:51:06 +00:00
|
|
|
echo >&2 "$0: Your OS ($OS) is currently not supported. Aborting."
|
|
|
|
exit 1
|
2008-05-12 20:34:38 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f /etc/gentoo-release ]; then
|
2013-07-24 18:51:06 +00:00
|
|
|
unsupported_distro='Gentoo'
|
2008-05-12 20:34:38 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f /etc/mandrake-release ]; then
|
2013-07-24 18:51:06 +00:00
|
|
|
unsupported_distro='Mandriva'
|
2008-05-12 20:34:38 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f /etc/SuSE-release ]; then
|
2013-07-24 18:51:06 +00:00
|
|
|
unsupported_distro='SUSE'
|
2008-05-12 20:34:38 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f /etc/slackware-version ]; then
|
2013-07-24 18:51:06 +00:00
|
|
|
unsupported_distro='Slackware'
|
2008-05-12 20:34:38 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$unsupported_distro" != '' ]; then
|
2013-07-24 18:51:06 +00:00
|
|
|
echo >&2 "$0: Your distribution ($unsupported_distro) is currently not supported. Aborting."
|
|
|
|
exit 1
|
2008-05-12 20:34:38 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# The distributions we do support:
|
|
|
|
if [ -r /etc/debian_version ]; then
|
2013-07-24 18:51:06 +00:00
|
|
|
handle_debian
|
2008-05-12 20:34:38 +00:00
|
|
|
elif [ -r /etc/redhat-release ]; then
|
2013-07-24 18:51:06 +00:00
|
|
|
handle_rh
|
2009-07-26 14:00:52 +00:00
|
|
|
elif [ "$OS" = 'OpenBSD' ]; then
|
2013-07-24 18:51:06 +00:00
|
|
|
handle_obsd
|
2016-04-30 16:52:47 -06:00
|
|
|
elif [ "$OS" = 'FreeBSD' ]; then
|
|
|
|
handle_fbsd
|
2008-05-12 20:34:38 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if ! in_test_mode; then
|
2013-07-24 18:51:06 +00:00
|
|
|
echo "#############################################"
|
|
|
|
echo "## $1 completed successfully"
|
|
|
|
echo "#############################################"
|
2008-05-12 20:34:38 +00:00
|
|
|
fi
|