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