6 # install_prereq: a script to install distribution-specific
12 echo "$0: a script to install distribution-specific prerequirement"
15 echo "Usage: $0: Shows this message."
16 echo "Usage: $0 test Prints commands it is about to run."
17 echo "Usage: $0 install Really install."
18 echo "Usage: $0 install-unpackaged Really install unpackaged requirements."
22 PACKAGES_DEBIAN="build-essential"
23 # Asterisk: basic requirements:
24 PACKAGES_DEBIAN="$PACKAGES_DEBIAN libncurses-dev libz-dev libssl-dev libxml2-dev"
25 # Asterisk: for addons:
26 PACKAGES_DEBIAN="$PACKAGES_DEBIAN libcurl-dev libspeex-dev libspeexdsp-dev libogg-dev libvorbis-dev libasound2-dev portaudio19-dev libcurl4-openssl-dev"
27 PACKAGES_DEBIAN="$PACKAGES_DEBIAN libpq-dev unixodbc-dev libsqlite0-dev libsqlite3-dev libmysqlclient15-dev libneon27-dev libgmime-2.0-2-dev libusb-dev liblua5.1-0-dev lua5.1"
28 PACKAGES_DEBIAN="$PACKAGES_DEBIAN libopenh323-dev libvpb-dev libgtk2.0-dev libmysqlclient-dev libbluetooth-dev libradiusclient-ng-dev freetds-dev"
29 PACKAGES_DEBIAN="$PACKAGES_DEBIAN libsnmp-dev libiksemel-dev libopenais-dev libnewt-dev libpopt-dev libical-dev libspandsp-dev libjack-dev"
30 PACKAGES_DEBIAN="$PACKAGES_DEBIAN libresample-dev libc-client-dev binutils-dev"
32 PACKAGES_RH="automake gcc gcc-c++ ncurses-devel openssl-devel libxml2-devel unixODBC-devel libcurl-devel libogg-devel libvorbis-devel speex-devel"
33 PACKAGES_RH="$PACKAGES_RH spandsp-devel freetds-devel net-snmp-devel iksemel-devel openais-devel newt-devel popt-devel libtool-ltdl-devel lua-devel"
34 PACKAGES_RH="$PACKAGES_RH libsqlite3x-devel radiusclient-ng-devel portaudio-devel postgresql-devel libresample-devel neon-devel libical-devel"
35 PACKAGES_RH="$PACKAGES_RH openldap-devel gmime22-devel sqlite2-devel mysql-devel bluez-libs-devel jack-audio-connection-kit-devel gsm-devel"
37 PACKAGES_OBSD="popt gmake wget libxml libogg libvorbis curl iksemel spandsp speex iodbc freetds-0.63p1-msdblib mysql-client gmime sqlite sqlite3 jack"
43 install) testcmd='' ;;
44 install-unpackaged) unpackaged="yes" ;;
53 check_installed_debs() {
54 aptitude -F '%c %p' search "$@" 2>/dev/null \
55 | awk '/^p/{print $2}'
58 # parsing the output of yum is close to impossible.
59 # We'll use rpm and hope for the best:
60 check_installed_rpms() {
63 if ! rpm -q $pack >/dev/null 2>/dev/null
69 check_installed_pkgs() {
72 if [ `pkg_info -a | grep $pack | wc -l` = 0 ]; then
79 # echo "# Distribution is Debian or compatible"
80 extra_packs=`check_installed_debs $PACKAGES_DEBIAN`
81 $testcmd aptitude install -y $extra_packs
85 # echo "# Distribution is RedHat-based or compatible"
86 extra_packs=`check_installed_rpms $PACKAGES_RH`
87 # FIXME: is there yum with RHEL 4?
88 $testcmd yum install -y $extra_packs
92 # echo "# Distribution is OpenBSD or compatible"
93 extra_packs=`check_installed_pkgs $PACKAGES_OBSD`
94 $testcmd pkg_add $extra_packs
97 install_unpackaged() {
98 echo "*** Installing NBS (Network Broadcast Sound) ***"
99 svn co http://svn.digium.com/svn/nbs/trunk nbs-trunk
104 echo "*** Installing libresample ***"
105 svn co http://svn.digium.com/svn/thirdparty/libresample/trunk libresample-trunk
107 ./configure && make && make install
111 if in_test_mode; then
112 echo "#############################################"
113 echo "## $1: test mode."
114 echo "## Use the commands here to install your system."
115 echo "#############################################"
116 elif test "${unpackaged}" = "yes" ; then
122 unsupported_distro=''
124 # A number of distributions we don't (yet?) support.
125 if [ "$OS" != 'Linux' -a "$OS" != 'OpenBSD' ]; then
126 echo >&2 "$0: Your OS ($OS) is currently not supported. Aborting."
130 if [ -f /etc/gentoo-release ]; then
131 unsupported_distro='Gentoo'
134 if [ -f /etc/mandrake-release ]; then
135 unsupported_distro='Mandriva'
138 if [ -f /etc/SuSE-release ]; then
139 unsupported_distro='SUSE'
142 if [ -f /etc/slackware-version ]; then
143 unsupported_distro='Slackware'
146 if [ "$unsupported_distro" != '' ]; then
147 echo >&2 "$0: Your distribution ($unsupported_distro) is currently not supported. Aborting."
151 # The distributions we do support:
152 if [ -r /etc/debian_version ]; then
154 elif [ -r /etc/redhat-release ]; then
156 elif [ "$OS" = 'OpenBSD' ]; then
160 if ! in_test_mode; then
161 echo "#############################################"
162 echo "## $1 completed successfully"
163 echo "#############################################"