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: very useful addons:
25 PACKAGES_DEBIAN="$PACKAGES_DEBIAN libcurl-dev libspeex-dev libogg-dev libvorbis-dev libasound2-dev"
26 # Asterisk: nice-to-have addons:
27 PACKAGES_DEBIAN="$PACKAGES_DEBIAN libpq-dev unixodbc-dev libsqlite-dev"
29 PACKAGES_DEBIAN="$PACKAGES_DEBIAN libopenh323-dev"
31 PACKAGES_DEBIAN="$PACKAGES_DEBIAN libsnmp-dev libiksemel-dev "
33 PACKAGES_RH="gcc gcc-c++ ncurses-devel openssl-devel"
35 PACKAGES_OBSD="popt gmake wget libxml libogg libvorbis curl iksemel spandsp speex iodbc freetds-0.63p1-msdblib mysql-client gmime sqlite sqlite3 jack"
41 install) testcmd='' ;;
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
95 echo "#############################################"
96 echo "## $1: test mode."
97 echo "## Use the commands here to install your system."
98 echo "#############################################"
102 unsupported_distro=''
104 # A number of distributions we don't (yet?) support.
105 if [ "$OS" != 'Linux' -a "$OS" != 'OpenBSD' ]; then
106 echo >&2 "$0: Your OS ($OS) is currently not supported. Aborting."
110 if [ -f /etc/gentoo-release ]; then
111 unsupported_distro='Gentoo'
114 if [ -f /etc/mandrake-release ]; then
115 unsupported_distro='Mandriva'
118 if [ -f /etc/SuSE-release ]; then
119 unsupported_distro='SUSE'
122 if [ -f /etc/slackware-version ]; then
123 unsupported_distro='Slackware'
126 if [ "$unsupported_distro" != '' ]; then
127 echo >&2 "$0: Your distribution ($unsupported_distro) is currently not supported. Aborting."
131 # The distributions we do support:
132 if [ -r /etc/debian_version ]; then
134 elif [ -r /etc/redhat-release ]; then
136 elif [ "$OS" = 'OpenBSD' ]; then
140 if ! in_test_mode; then
141 echo "#############################################"
142 echo "## $1 completed successfully"
143 echo "#############################################"