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."
21 PACKAGES_DEBIAN="build-essential"
22 # Asterisk: basic requirements:
23 PACKAGES_DEBIAN="$PACKAGES_DEBIAN libncurses-dev libz-dev libssl-dev libxml2-dev"
24 # Asterisk: for addons:
25 PACKAGES_DEBIAN="$PACKAGES_DEBIAN libcurl-dev libspeex-dev libspeexdsp-dev libogg-dev libvorbis-dev libasound2-dev portaudio19-dev"
26 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"
27 PACKAGES_DEBIAN="$PACKAGES_DEBIAN libopenh323-dev libvpb-dev libgtk2.0-dev libmysqlclient-dev libbluetooth-dev libradiusclient-ng-dev"
28 PACKAGES_DEBIAN="$PACKAGES_DEBIAN libsnmp-dev libiksemel-dev "
30 PACKAGES_RH="gcc gcc-c++ ncurses-devel openssl-devel"
32 PACKAGES_OBSD="popt gmake wget libxml libogg libvorbis curl iksemel spandsp speex iodbc freetds-0.63p1-msdblib mysql-client gmime sqlite sqlite3 jack"
38 install) testcmd='' ;;
47 check_installed_debs() {
48 aptitude -F '%c %p' search "$@" 2>/dev/null \
49 | awk '/^p/{print $2}'
52 # parsing the output of yum is close to impossible.
53 # We'll use rpm and hope for the best:
54 check_installed_rpms() {
57 if ! rpm -q $pack >/dev/null 2>/dev/null
63 check_installed_pkgs() {
66 if [ `pkg_info -a | grep $pack | wc -l` = 0 ]; then
73 # echo "# Distribution is Debian or compatible"
74 extra_packs=`check_installed_debs $PACKAGES_DEBIAN`
75 $testcmd aptitude install -y $extra_packs
79 # echo "# Distribution is RedHat-based or compatible"
80 extra_packs=`check_installed_rpms $PACKAGES_RH`
81 # FIXME: is there yum with RHEL 4?
82 $testcmd yum install -y $extra_packs
86 # echo "# Distribution is OpenBSD or compatible"
87 extra_packs=`check_installed_pkgs $PACKAGES_OBSD`
88 $testcmd pkg_add $extra_packs
92 echo "#############################################"
93 echo "## $1: test mode."
94 echo "## Use the commands here to install your system."
95 echo "#############################################"
101 # A number of distributions we don't (yet?) support.
102 if [ "$OS" != 'Linux' -a "$OS" != 'OpenBSD' ]; then
103 echo >&2 "$0: Your OS ($OS) is currently not supported. Aborting."
107 if [ -f /etc/gentoo-release ]; then
108 unsupported_distro='Gentoo'
111 if [ -f /etc/mandrake-release ]; then
112 unsupported_distro='Mandriva'
115 if [ -f /etc/SuSE-release ]; then
116 unsupported_distro='SUSE'
119 if [ -f /etc/slackware-version ]; then
120 unsupported_distro='Slackware'
123 if [ "$unsupported_distro" != '' ]; then
124 echo >&2 "$0: Your distribution ($unsupported_distro) is currently not supported. Aborting."
128 # The distributions we do support:
129 if [ -r /etc/debian_version ]; then
131 elif [ -r /etc/redhat-release ]; then
133 elif [ "$OS" = 'OpenBSD' ]; then
137 if ! in_test_mode; then
138 echo "#############################################"
139 echo "## $1 completed successfully"
140 echo "#############################################"