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"
32 PACKAGES_RH="gcc gcc-c++ ncurses-devel openssl-devel mysql-devel"
34 PACKAGES_OBSD="popt gmake wget libxml libogg libvorbis curl iksemel spandsp speex iodbc freetds-0.63p1-msdblib mysql-client gmime sqlite sqlite3 jack"
40 install) testcmd='' ;;
41 install-unpackaged) unpackaged="yes" ;;
50 check_installed_debs() {
51 aptitude -F '%c %p' search "$@" 2>/dev/null \
52 | awk '/^p/{print $2}'
55 # parsing the output of yum is close to impossible.
56 # We'll use rpm and hope for the best:
57 check_installed_rpms() {
60 if ! rpm -q $pack >/dev/null 2>/dev/null
66 check_installed_pkgs() {
69 if [ `pkg_info -a | grep $pack | wc -l` = 0 ]; then
76 # echo "# Distribution is Debian or compatible"
77 extra_packs=`check_installed_debs $PACKAGES_DEBIAN`
78 $testcmd aptitude install -y $extra_packs
82 # echo "# Distribution is RedHat-based or compatible"
83 extra_packs=`check_installed_rpms $PACKAGES_RH`
84 # FIXME: is there yum with RHEL 4?
85 $testcmd yum install -y $extra_packs
89 # echo "# Distribution is OpenBSD or compatible"
90 extra_packs=`check_installed_pkgs $PACKAGES_OBSD`
91 $testcmd pkg_add $extra_packs
94 install_unpackaged() {
95 echo "*** Installing NBS (Network Broadcast Sound) ***"
96 svn co http://svn.digium.com/svn/nbs/trunk nbs-trunk
101 echo "*** Installing libresample ***"
102 svn co http://svn.digium.com/svn/thirdparty/libresample/trunk libresample-trunk
104 ./configure && make && make install
108 if in_test_mode; then
109 echo "#############################################"
110 echo "## $1: test mode."
111 echo "## Use the commands here to install your system."
112 echo "#############################################"
113 elif test "${unpackaged}" = "yes" ; then
119 unsupported_distro=''
121 # A number of distributions we don't (yet?) support.
122 if [ "$OS" != 'Linux' -a "$OS" != 'OpenBSD' ]; then
123 echo >&2 "$0: Your OS ($OS) is currently not supported. Aborting."
127 if [ -f /etc/gentoo-release ]; then
128 unsupported_distro='Gentoo'
131 if [ -f /etc/mandrake-release ]; then
132 unsupported_distro='Mandriva'
135 if [ -f /etc/SuSE-release ]; then
136 unsupported_distro='SUSE'
139 if [ -f /etc/slackware-version ]; then
140 unsupported_distro='Slackware'
143 if [ "$unsupported_distro" != '' ]; then
144 echo >&2 "$0: Your distribution ($unsupported_distro) is currently not supported. Aborting."
148 # The distributions we do support:
149 if [ -r /etc/debian_version ]; then
151 elif [ -r /etc/redhat-release ]; then
153 elif [ "$OS" = 'OpenBSD' ]; then
157 if ! in_test_mode; then
158 echo "#############################################"
159 echo "## $1 completed successfully"
160 echo "#############################################"