| 1 | #! /bin/sh |
| 2 | |
| 3 | # install_prereq: a script to install distribution-specific |
| 4 | # prerequisites |
| 5 | |
| 6 | set -e |
| 7 | |
| 8 | usage() { |
| 9 | echo "$0: a script to install distribution-specific prerequisites" |
| 10 | echo |
| 11 | echo "$0 : Shows this message" |
| 12 | echo "$0 test : Prints commands it is about to run" |
| 13 | echo "$0 install : Really install" |
| 14 | echo "$0 install-unpackaged : Really install unpackaged requirements" |
| 15 | echo "$0 minimal : Install only the packages necessary for build tool generation and a basic build" |
| 16 | } |
| 17 | |
| 18 | # Basic build system: |
| 19 | PACKAGES_DEBIAN_BUILD="build-essential pkg-config autoconf-archive" |
| 20 | PACKAGES_DEBIAN="$PACKAGES_DEBIAN_BUILD" |
| 21 | # Asterisk: basic requirements: |
| 22 | PACKAGES_DEBIAN="$PACKAGES_DEBIAN libedit-dev libjansson-dev libsqlite3-dev uuid-dev libxml2-dev" |
| 23 | # Asterisk: for addons: |
| 24 | PACKAGES_DEBIAN="$PACKAGES_DEBIAN libspeex-dev libspeexdsp-dev libogg-dev libvorbis-dev libasound2-dev portaudio19-dev libcurl4-openssl-dev xmlstarlet bison flex" |
| 25 | PACKAGES_DEBIAN="$PACKAGES_DEBIAN libpq-dev unixodbc-dev libneon27-dev libgmime-2.6-dev libgmime-3.0-dev liblua5.2-dev liburiparser-dev libxslt1-dev libssl-dev" |
| 26 | PACKAGES_DEBIAN="$PACKAGES_DEBIAN libmysqlclient-dev libbluetooth-dev libradcli-dev freetds-dev libjack-jackd2-dev bash libcap-dev" |
| 27 | PACKAGES_DEBIAN="$PACKAGES_DEBIAN libsnmp-dev libiksemel-dev libcorosync-common-dev libcpg-dev libcfg-dev libnewt-dev libpopt-dev libical-dev libspandsp-dev" |
| 28 | PACKAGES_DEBIAN="$PACKAGES_DEBIAN libresample1-dev libc-client2007e-dev binutils-dev libsrtp0-dev libsrtp2-dev libgsm1-dev doxygen graphviz zlib1g-dev libldap2-dev" |
| 29 | PACKAGES_DEBIAN="$PACKAGES_DEBIAN libcodec2-dev libfftw3-dev libsndfile1-dev libunbound-dev" |
| 30 | # Asterisk: for the unpackaged below: |
| 31 | PACKAGES_DEBIAN="$PACKAGES_DEBIAN wget subversion" |
| 32 | # Asterisk: for ./configure --with-pjproject-bundled: |
| 33 | PACKAGES_DEBIAN="$PACKAGES_DEBIAN bzip2 patch" |
| 34 | |
| 35 | # Basic build system: |
| 36 | PACKAGES_RH_BUILD="make gcc gcc-c++ pkgconfig autoconf-archive" |
| 37 | PACKAGES_RH="$PACKAGES_RH_BUILD" |
| 38 | # Asterisk: basic requirements: |
| 39 | PACKAGES_RH="$PACKAGES_RH libedit-devel jansson-devel libuuid-devel sqlite-devel libxml2-devel" |
| 40 | # Asterisk: for addons: |
| 41 | PACKAGES_RH="$PACKAGES_RH speex-devel speexdsp-devel libogg-devel libvorbis-devel portaudio-devel libcurl-devel xmlstarlet bison flex" |
| 42 | PACKAGES_RH="$PACKAGES_RH postgresql-devel unixODBC-devel neon-devel gmime-devel lua-devel uriparser-devel libxslt-devel openssl-devel" |
| 43 | PACKAGES_RH="$PACKAGES_RH mysql-devel bluez-libs-devel radcli-devel freetds-devel jack-audio-connection-kit-devel bash libcap-devel" |
| 44 | PACKAGES_RH="$PACKAGES_RH net-snmp-devel iksemel-devel corosynclib-devel newt-devel popt-devel libical-devel spandsp-devel" |
| 45 | PACKAGES_RH="$PACKAGES_RH libresample-devel uw-imap-devel binutils-devel libsrtp-devel gsm-devel doxygen graphviz zlib-devel openldap-devel hoard" |
| 46 | PACKAGES_RH="$PACKAGES_RH codec2-devel fftw-devel libsndfile-devel unbound-devel" |
| 47 | # Asterisk: for the unpackaged below: |
| 48 | PACKAGES_RH="$PACKAGES_RH wget subversion" |
| 49 | # Asterisk: for ./configure --with-pjproject-bundled: |
| 50 | PACKAGES_RH="$PACKAGES_RH bzip2 patch" |
| 51 | |
| 52 | # Basic build system: |
| 53 | PACKAGES_SUSE_BUILD="make gcc gcc-c++ pkg-config autoconf-archive" |
| 54 | PACKAGES_SUSE="$PACKAGES_SUSE_BUILD" |
| 55 | # Asterisk: basic requirements: |
| 56 | PACKAGES_SUSE="$PACKAGES_SUSE libedit-devel libjansson-devel libuuid-devel sqlite3-devel libxml2-devel" |
| 57 | # Asterisk: for addons: |
| 58 | PACKAGES_SUSE="$PACKAGES_SUSE speex-devel speexdsp-devel libogg-devel libvorbis-devel portaudio-devel libcurl-devel xmlstarlet bison flex" |
| 59 | PACKAGES_SUSE="$PACKAGES_SUSE postgresql-devel unixODBC-devel libneon-devel gmime-devel lua-devel liburiparser-devel libxslt-devel libopenssl-devel" |
| 60 | PACKAGES_SUSE="$PACKAGES_SUSE libmysqlclient-devel bluez-devel freeradius-client-devel freetds-devel bash libcap-devel" |
| 61 | PACKAGES_SUSE="$PACKAGES_SUSE net-snmp-devel iksemel-devel libcorosync-devel newt-devel popt-devel libical-devel spandsp-devel" |
| 62 | PACKAGES_SUSE="$PACKAGES_SUSE imap-devel libsrtp2-devel libgsm-devel doxygen graphviz zlib-devel openldap2-devel" |
| 63 | PACKAGES_SUSE="$PACKAGES_SUSE codec2-devel fftw3-devel libsndfile-devel unbound-devel" |
| 64 | # Asterisk: for the unpackaged below: |
| 65 | PACKAGES_SUSE="$PACKAGES_SUSE wget subversion" |
| 66 | # Asterisk: for ./configure --with-pjproject-bundled: |
| 67 | PACKAGES_SUSE="$PACKAGES_SUSE bzip2 patch" |
| 68 | |
| 69 | # Basic build system: |
| 70 | PACKAGES_ARCH_BUILD="make gcc pkg-config autoconf-archive" |
| 71 | PACKAGES_ARCH="$PACKAGES_ARCH_BUILD" |
| 72 | # Asterisk: basic requirements: |
| 73 | PACKAGES_ARCH="$PACKAGES_ARCH libedit jansson libutil-linux libxml2 sqlite" |
| 74 | # Asterisk: for addons: |
| 75 | PACKAGES_ARCH="$PACKAGES_ARCH speex speexdsp libogg libvorbis portaudio curl xmlstarlet bison flex" |
| 76 | PACKAGES_ARCH="$PACKAGES_ARCH postgresql-libs unixodbc neon gmime lua uriparser libxslt openssl" |
| 77 | PACKAGES_ARCH="$PACKAGES_ARCH libmariadbclient bluez-libs radcli freetds bash libcap" |
| 78 | PACKAGES_ARCH="$PACKAGES_ARCH net-snmp libnewt popt libical spandsp" |
| 79 | PACKAGES_ARCH="$PACKAGES_ARCH c-client binutils libsrtp gsm doxygen graphviz zlib libldap" |
| 80 | PACKAGES_ARCH="$PACKAGES_ARCH fftw libsndfile unbound" |
| 81 | # Asterisk: for the unpackaged below: |
| 82 | PACKAGES_ARCH="$PACKAGES_ARCH wget subversion" |
| 83 | # Asterisk: for ./configure --with-pjproject-bundled: |
| 84 | PACKAGES_ARCH="$PACKAGES_ARCH bzip2 patch" |
| 85 | |
| 86 | # Basic build system: |
| 87 | PACKAGES_GENTOO_BUILD="sys-devel/make sys-devel/gcc dev-util/pkgconfig" |
| 88 | PACKAGES_GENTOO="$PACKAGES_GENTOO_BUILD" |
| 89 | # Asterisk: basic requirements: |
| 90 | PACKAGES_GENTOO="$PACKAGES_GENTOO dev-libs/libedit dev-libs/jansson sys-libs/e2fsprogs-libs dev-libs/libxml2 dev-db/sqlite" |
| 91 | # Asterisk: for addons: |
| 92 | PACKAGES_GENTOO="$PACKAGES_GENTOO media-libs/speex media-libs/speexdsp media-libs/libogg media-libs/libvorbis media-libs/portaudio net-misc/curl app-text/xmlstarlet sys-devel/bison sys-devel/flex" |
| 93 | PACKAGES_GENTOO="$PACKAGES_GENTOO dev-db/postgresql dev-db/unixODBC net-libs/neon dev-libs/gmime dev-lang/lua dev-libs/uriparser dev-libs/libxslt dev-libs/openssl" |
| 94 | PACKAGES_GENTOO="$PACKAGES_GENTOO virtual/libmysqlclient net-wireless/bluez net-dialup/radiusclient-ng dev-db/freetds app-shells/bash sys-libs/libcap" |
| 95 | PACKAGES_GENTOO="$PACKAGES_GENTOO net-analyzer/net-snmp dev-libs/iksemel sys-cluster/corosync dev-libs/newt dev-libs/popt dev-libs/libical media-libs/spandsp" |
| 96 | PACKAGES_GENTOO="$PACKAGES_GENTOO net-libs/c-client sys-devel/binutils net-libs/libsrtp media-sound/gsm media-libs/libilbc app-doc/doxygen sys-libs/zlib net-nds/openldap" |
| 97 | PACKAGES_GENTOO="$PACKAGES_GENTOO sci-libs/fftw media-libs/libsndfile net-dns/unbound" |
| 98 | # Asterisk: for the unpackaged below: |
| 99 | PACKAGES_GENTOO="$PACKAGES_GENTOO net-misc/wget dev-vcs/subversion" |
| 100 | # Asterisk: for ./configure --with-pjproject-bundled: |
| 101 | PACKAGES_GENTOO="$PACKAGES_GENTOO app-arch/bzip2 sys-devel/patch" |
| 102 | |
| 103 | # Basic build system: |
| 104 | PACKAGES_NBSD_BUILD="gmake pkg-config" |
| 105 | PACKAGES_NBSD="$PACKAGES_NBSD_BUILD" |
| 106 | # Asterisk: basic requirements: |
| 107 | PACKAGES_NBSD="$PACKAGES_NBSD editline jansson sqlite3 libuuid libxml2" |
| 108 | # Asterisk: for addons: |
| 109 | PACKAGES_NBSD="$PACKAGES_NBSD speex speexdsp libogg libvorbis portaudio-devel curl bison flex" |
| 110 | PACKAGES_NBSD="$PACKAGES_NBSD postgresql10-client unixodbc neon gmime lua52 uriparser libxslt openssl" |
| 111 | PACKAGES_NBSD="$PACKAGES_NBSD mysql-client radiusclient-ng freetds bash" |
| 112 | PACKAGES_NBSD="$PACKAGES_NBSD net-snmp iksemel popt libical spandsp" |
| 113 | PACKAGES_NBSD="$PACKAGES_NBSD imap-uw srtp gsm doxygen graphviz libzip openldap-client" |
| 114 | PACKAGES_NBSD="$PACKAGES_NBSD codec2 fftw libsndfile unbound" |
| 115 | # Asterisk: for the unpackaged below: |
| 116 | PACKAGES_NBSD="$PACKAGES_NBSD wget subversion-base" |
| 117 | # Asterisk: for ./configure --with-pjproject-bundled: |
| 118 | PACKAGES_NBSD="$PACKAGES_NBSD bzip2 patch" |
| 119 | |
| 120 | # Basic build system: |
| 121 | PACKAGES_OBSD_BUILD="gmake" |
| 122 | PACKAGES_OBSD="$PACKAGES_OBSD_BUILD" |
| 123 | # Asterisk: basic requirements: |
| 124 | PACKAGES_OBSD="$PACKAGES_OBSD libxml sqlite3 e2fsprogs jansson" |
| 125 | # Asterisk: for addons: |
| 126 | PACKAGES_OBSD="$PACKAGES_OBSD speex speexdsp libogg libvorbis portaudio-svn curl xmlstarlet bison" |
| 127 | PACKAGES_OBSD="$PACKAGES_OBSD postgresql-client iodbc neon gmime lua%5.2 uriparser libxslt" |
| 128 | PACKAGES_OBSD="$PACKAGES_OBSD mariadb-client radcli freetds" |
| 129 | PACKAGES_OBSD="$PACKAGES_OBSD net-snmp iksemel popt libical spandsp" |
| 130 | PACKAGES_OBSD="$PACKAGES_OBSD c-client libsrtp gsm doxygen graphviz" |
| 131 | PACKAGES_OBSD="$PACKAGES_OBSD fftw3 libsndfile" |
| 132 | # Asterisk: for the unpackaged below: |
| 133 | PACKAGES_OBSD="$PACKAGES_OBSD wget subversion" |
| 134 | # Asterisk: for ./configure --with-pjproject-bundled: |
| 135 | PACKAGES_OBSD="$PACKAGES_OBSD bzip2" |
| 136 | |
| 137 | # Basic build system: |
| 138 | PACKAGES_FBSD_BUILD="gmake pkgconf autoconf-archive" |
| 139 | PACKAGES_FBSD="$PACKAGES_FBSD_BUILD" |
| 140 | # Asterisk: basic requirements: |
| 141 | PACKAGES_FBSD="$PACKAGES_FBSD libedit jansson e2fsprogs-libuuid sqlite3 libxml2" |
| 142 | # Asterisk: for addons: |
| 143 | PACKAGES_FBSD="$PACKAGES_FBSD speex speexdsp libogg libvorbis portaudio curl xmlstarlet bison flex" |
| 144 | PACKAGES_FBSD="$PACKAGES_FBSD postgresql10-client unixODBC neon gmime26 lua52 uriparser libxslt openssl" |
| 145 | PACKAGES_FBSD="$PACKAGES_FBSD mysql57-client radcli freetds" |
| 146 | PACKAGES_FBSD="$PACKAGES_FBSD net-snmp iksemel corosync newt popt libical spandsp" |
| 147 | PACKAGES_FBSD="$PACKAGES_FBSD cclient libbfd libsrtp gsm libilbc doxygen graphviz libzip openldap-client libhoard" |
| 148 | PACKAGES_FBSD="$PACKAGES_FBSD codec2 fftw3 libsndfile unbound" |
| 149 | # Asterisk: for the unpackaged below: |
| 150 | PACKAGES_FBSD="$PACKAGES_FBSD wget subversion" |
| 151 | # Asterisk: for ./configure --with-pjproject-bundled: |
| 152 | PACKAGES_FBSD="$PACKAGES_FBSD bzip2 patch" |
| 153 | |
| 154 | # Basic build system: |
| 155 | PACKAGES_DBSD_BUILD="gmake pkgconf" |
| 156 | PACKAGES_DBSD="$PACKAGES_DBSD_BUILD" |
| 157 | # Asterisk: basic requirements: |
| 158 | PACKAGES_DBSD="$PACKAGES_DBSD libedit jansson e2fsprogs-libuuid sqlite3 libxml2" |
| 159 | # Asterisk: for addons: |
| 160 | PACKAGES_DBSD="$PACKAGES_DBSD speex speexdsp libogg libvorbis portaudio curl xmlstarlet bison flex" |
| 161 | PACKAGES_DBSD="$PACKAGES_DBSD postgresql10-client unixODBC neon gmime26 lua52 uriparser libxslt libressl" |
| 162 | PACKAGES_DBSD="$PACKAGES_DBSD mariadb101-client radcli freetds" |
| 163 | PACKAGES_DBSD="$PACKAGES_DBSD net-snmp iksemel corosync newt popt libical spandsp" |
| 164 | PACKAGES_DBSD="$PACKAGES_DBSD cclient binutils libsrtp gsm libilbc doxygen graphviz libzip openldap-client libhoard" |
| 165 | PACKAGES_DBSD="$PACKAGES_DBSD codec2 fftw3 libsndfile unbound" |
| 166 | # Asterisk: for the unpackaged below: |
| 167 | PACKAGES_DBSD="$PACKAGES_DBSD wget subversion" |
| 168 | # Asterisk: for ./configure --with-pjproject-bundled: |
| 169 | PACKAGES_DBSD="$PACKAGES_DBSD bzip2 patch" |
| 170 | |
| 171 | KVERS=`uname -r` |
| 172 | |
| 173 | case "$1" in |
| 174 | test) |
| 175 | testcmd=echo |
| 176 | ;; |
| 177 | install) |
| 178 | testcmd='' |
| 179 | ;; |
| 180 | install-unpackaged) |
| 181 | unpackaged="yes" |
| 182 | ;; |
| 183 | minimal) |
| 184 | # Overwrite the package lists and let the rest of the package handling |
| 185 | # plumbing do its magic |
| 186 | PACKAGES_ARCH="$PACKAGES_ARCH_BUILD" |
| 187 | PACKAGES_DBSD="$PACKAGES_DBSD_BUILD" |
| 188 | PACKAGES_DEBIAN="$PACKAGES_DEBIAN_BUILD" |
| 189 | PACKAGES_FBSD="$PACKAGES_FBSD_BUILD" |
| 190 | PACKAGES_GENTOO="$PACKAGES_GENTOO_BUILD" |
| 191 | PACKAGES_NBSD="$PACKAGES_NBSD_BUILD" |
| 192 | PACKAGES_OBSD="$PACKAGES_OBSD_BUILD" |
| 193 | PACKAGES_RH="$PACKAGES_RH_BUILD" |
| 194 | PACKAGES_SUSE="$PACKAGES_SUSE_BUILD" |
| 195 | ;; |
| 196 | '') |
| 197 | usage |
| 198 | exit 0 |
| 199 | ;; |
| 200 | *) |
| 201 | usage |
| 202 | exit 1 |
| 203 | ;; |
| 204 | esac |
| 205 | |
| 206 | in_test_mode() { |
| 207 | test "$testcmd" != '' |
| 208 | } |
| 209 | |
| 210 | check_installed_debs() { |
| 211 | for pack in "$@" ; do |
| 212 | tocheck="${tocheck} ^${pack}$ ~P^${pack}$" |
| 213 | done |
| 214 | aptitude -F '%c %p' search $tocheck 2>/dev/null | awk '/^p/{print $2}' | grep -vF : |
| 215 | } |
| 216 | |
| 217 | # parsing the output of yum is close to impossible. |
| 218 | # We'll use rpm and hope for the best: |
| 219 | check_installed_rpms() { |
| 220 | for pack in "$@" |
| 221 | do |
| 222 | if ! rpm -q $pack >/dev/null 2>/dev/null |
| 223 | then echo $pack |
| 224 | fi |
| 225 | done |
| 226 | } |
| 227 | |
| 228 | check_installed_equery() { |
| 229 | for pack in "$@" |
| 230 | do |
| 231 | # equery --quiet list $pack |
| 232 | # is slower and |
| 233 | # would require the optional app-portage/gentoolkit |
| 234 | # /var/lib/portage/world would be the non-dep list |
| 235 | pack_with_version=${pack/:/-} # replace a possible version with '-' |
| 236 | if ! ls -d /var/db/pkg/${pack_with_version}* >/dev/null 2>/dev/null |
| 237 | then echo $pack |
| 238 | fi |
| 239 | done |
| 240 | } |
| 241 | |
| 242 | check_installed_pacman() { |
| 243 | for pack in "$@" |
| 244 | do |
| 245 | if ! pacman -Q --explicit $pack >/dev/null 2>/dev/null |
| 246 | then echo $pack |
| 247 | fi |
| 248 | done |
| 249 | } |
| 250 | |
| 251 | check_installed_pkgs() { |
| 252 | for pack in "$@" |
| 253 | do |
| 254 | if [ `pkg_info -a | grep $pack | wc -l` = 0 ]; then |
| 255 | echo $pack |
| 256 | fi |
| 257 | done |
| 258 | } |
| 259 | |
| 260 | check_installed_fpkgs() { |
| 261 | for pack in "$@" |
| 262 | do |
| 263 | if [ `pkg info -a | grep $pack | wc -l` = 0 ]; then |
| 264 | echo $pack |
| 265 | fi |
| 266 | done |
| 267 | } |
| 268 | |
| 269 | check_installed_zypper() { |
| 270 | for pack in "$@" |
| 271 | do |
| 272 | if ! zypper se -ixnC $pack >/dev/null 2>/dev/null |
| 273 | then echo $pack |
| 274 | fi |
| 275 | done |
| 276 | } |
| 277 | |
| 278 | handle_debian() { |
| 279 | if ! [ -x "$(command -v aptitude)" ]; then |
| 280 | apt-get install -y aptitude |
| 281 | fi |
| 282 | extra_packs=`check_installed_debs $PACKAGES_DEBIAN` |
| 283 | $testcmd aptitude update |
| 284 | if [ x"$extra_packs" != "x" ] ; then |
| 285 | $testcmd aptitude install -y $extra_packs |
| 286 | fi |
| 287 | } |
| 288 | |
| 289 | handle_linuxmint() { |
| 290 | # Store temporary variable to contain list of missing packages |
| 291 | missing_packages="" |
| 292 | |
| 293 | # Check installed packages for Mint |
| 294 | for package in $PACKAGES_DEBIAN; do |
| 295 | if [ "$package" = "libgmime-2.6-dev" ] || [ "$package" = "libsrtp0-dev" ]; then |
| 296 | continue |
| 297 | fi |
| 298 | |
| 299 | missing_package_check=$(apt list --installed 2>/dev/null | grep -c $package) |
| 300 | |
| 301 | if [ "$missing_package_check" -eq 0 ]; then |
| 302 | echo "This package is missing: "$package |
| 303 | missing_packages="${missing_packages} $package" |
| 304 | else |
| 305 | echo "Package "$package" is present." |
| 306 | fi |
| 307 | done |
| 308 | |
| 309 | # Update the packages on our local system |
| 310 | echo "===========================" |
| 311 | echo "Updating your system's packages" |
| 312 | echo "===========================" |
| 313 | $testcmd apt update |
| 314 | |
| 315 | # Inform user of packages to be installed |
| 316 | echo "===========================" |
| 317 | echo "The following packages will be installed on your system:" |
| 318 | echo $missing_packages |
| 319 | echo "===========================" |
| 320 | |
| 321 | if [ "$missing_packages" != "" ] ; then |
| 322 | $testcmd apt -m install -y $missing_packages |
| 323 | fi |
| 324 | } |
| 325 | |
| 326 | handle_rh() { |
| 327 | extra_packs=`check_installed_rpms $PACKAGES_RH` |
| 328 | if [ x"$extra_packs" != "x" ] ; then |
| 329 | $testcmd yum install --skip-broken --assumeyes $extra_packs |
| 330 | fi |
| 331 | } |
| 332 | |
| 333 | handle_gentoo() { |
| 334 | extra_packs=`check_installed_equery $PACKAGES_GENTOO` |
| 335 | if [ x"$extra_packs" != "x" ] ; then |
| 336 | $testcmd emerge $extra_packs |
| 337 | fi |
| 338 | } |
| 339 | |
| 340 | handle_arch() { |
| 341 | extra_packs=`check_installed_pacman $PACKAGES_ARCH` |
| 342 | if [ x"$extra_packs" != "x" ] ; then |
| 343 | $testcmd pacman -S --asexplicit --noconfirm $extra_packs |
| 344 | fi |
| 345 | } |
| 346 | |
| 347 | handle_nbsd() { |
| 348 | extra_packs=`check_installed_pkgs $PACKAGES_NBSD` |
| 349 | if [ x"$extra_packs" != "x" ] ; then |
| 350 | if [ -z "$PKG_PATH" ] ; then |
| 351 | # see NetBSD Problem Report #48177 |
| 352 | export PKG_PATH="http://cdn.NetBSD.org/pub/pkgsrc/packages/$(uname -s)/$(uname -p)/$(uname -r)/All" |
| 353 | fi |
| 354 | $testcmd pkg_add $extra_packs |
| 355 | fi |
| 356 | } |
| 357 | |
| 358 | handle_obsd() { |
| 359 | extra_packs=`check_installed_pkgs $PACKAGES_OBSD` |
| 360 | if [ x"$extra_packs" != "x" ] ; then |
| 361 | $testcmd pkg_add $extra_packs |
| 362 | fi |
| 363 | } |
| 364 | |
| 365 | handle_fbsd() { |
| 366 | extra_packs=`check_installed_fpkgs $PACKAGES_FBSD` |
| 367 | if [ x"$extra_packs" != "x" ] ; then |
| 368 | $testcmd pkg install -y $extra_packs |
| 369 | fi |
| 370 | } |
| 371 | |
| 372 | handle_dbsd() { |
| 373 | extra_packs=`check_installed_fpkgs $PACKAGES_DBSD` |
| 374 | if [ x"$extra_packs" != "x" ] ; then |
| 375 | $testcmd pkg install -y $extra_packs |
| 376 | fi |
| 377 | } |
| 378 | |
| 379 | handle_SUSE() { |
| 380 | extra_packs=`check_installed_zypper $PACKAGES_SUSE` |
| 381 | if [ x"$extra_packs" != "x" ] ; then |
| 382 | $testcmd zypper install --no-confirm $extra_packs |
| 383 | fi |
| 384 | } |
| 385 | |
| 386 | install_unpackaged() { |
| 387 | # Only install libresample if it wasn't installed via package |
| 388 | if ! test -f /usr/include/libresample.h; then |
| 389 | echo "*** Installing libresample ***" |
| 390 | svn co https://svn.digium.com/svn/thirdparty/libresample/trunk libresample-trunk |
| 391 | cd libresample-trunk |
| 392 | ./configure |
| 393 | make all install |
| 394 | cd .. |
| 395 | fi |
| 396 | |
| 397 | # Only install libsrtp2 if it wasn't installed via package |
| 398 | if ! test -f /usr/include/srtp/srtp.h; then |
| 399 | if ! test -f /usr/include/srtp2/srtp.h; then |
| 400 | echo "*** Installing libsrtp2 ***" |
| 401 | wget -O - http://github.com/cisco/libsrtp/archive/v2.tar.gz | zcat | tar -xf - |
| 402 | cd libsrtp-2 |
| 403 | ./configure --enable-openssl |
| 404 | make shared_library install |
| 405 | cd .. |
| 406 | if test -d /etc/ld.so.conf.d; then |
| 407 | echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local.conf |
| 408 | else # for example: Slackware 14.2 |
| 409 | echo "/usr/local/lib" > /etc/ld.so.conf |
| 410 | fi |
| 411 | /sbin/ldconfig |
| 412 | fi |
| 413 | fi |
| 414 | |
| 415 | if ! test -f /usr/include/pjlib.h; then |
| 416 | echo "PJProject not installed, yet. Therefore, please, run" |
| 417 | echo "./configure --with-pjproject-bundled" |
| 418 | fi |
| 419 | } |
| 420 | |
| 421 | if in_test_mode; then |
| 422 | echo "#############################################" |
| 423 | echo "## $1: test mode." |
| 424 | echo "## Use the commands here to install your system." |
| 425 | echo "#############################################" |
| 426 | elif test "${unpackaged}" = "yes" ; then |
| 427 | install_unpackaged |
| 428 | exit 0 |
| 429 | fi |
| 430 | |
| 431 | OS=`uname -s` |
| 432 | unsupported_distro='' |
| 433 | |
| 434 | # A number of distributions we don't (yet?) support. |
| 435 | if [ "$OS" != 'Linux' -a "$OS" != 'NetBSD' -a "$OS" != 'OpenBSD' -a "$OS" != 'FreeBSD' -a "$OS" != 'DragonFly' ]; then |
| 436 | echo >&2 "$0: Your OS ($OS) is currently not supported. Aborting." |
| 437 | exit 1 |
| 438 | fi |
| 439 | |
| 440 | if [ -f /etc/mandrake-release ]; then |
| 441 | unsupported_distro='Mandriva' |
| 442 | fi |
| 443 | |
| 444 | if [ -f /etc/slackware-version ] || ([ -f /etc/os-release ] && . /etc/os-release && [ "$ID" = "slackware" ]); then |
| 445 | echo >&2 "$0: Your distribution (Slackware) is currently not supported. Aborting. Try manually:" |
| 446 | # libedit requires a newer version than Slackware 14.2, for example Slackware-current |
| 447 | # or you build it manually: <http://thrysoee.dk/editline/> |
| 448 | echo >&2 "$0: # slackpkg install make gcc pkg-config libedit util-linux sqlite libxml2 patch wget" |
| 449 | # required for libjansson |
| 450 | echo >&2 "$0: # ./contrib/scripts/install_prereq install-unpackaged" |
| 451 | exit 1 |
| 452 | fi |
| 453 | |
| 454 | if [ "$unsupported_distro" != '' ]; then |
| 455 | echo >&2 "$0: Your distribution ($unsupported_distro) is currently not supported. Aborting." |
| 456 | exit 1 |
| 457 | fi |
| 458 | |
| 459 | # The distributions we do support: |
| 460 | if [ -r /etc/debian_version ]; then |
| 461 | if [ -f /etc/linuxmint/info ]; then |
| 462 | handle_linuxmint |
| 463 | else |
| 464 | handle_debian |
| 465 | fi |
| 466 | elif [ -r /etc/redhat-release ]; then |
| 467 | handle_rh |
| 468 | elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then |
| 469 | handle_SUSE |
| 470 | elif [ -f /etc/os-release ] && . /etc/os-release && [ "$ID" = "opensuse" ]; then |
| 471 | handle_SUSE |
| 472 | elif [ -r /etc/arch-release ]; then |
| 473 | handle_arch |
| 474 | elif [ -f /etc/os-release ] && . /etc/os-release && [ "$ID_LIKE" = "archlinux" ]; then |
| 475 | handle_arch # $ID=arch |
| 476 | elif [ -f /etc/gentoo-release ]; then |
| 477 | handle_gentoo |
| 478 | elif [ -f /etc/os-release ] && . /etc/os-release && [ "$ID" = "gentoo" ]; then |
| 479 | handle_gentoo |
| 480 | elif [ "$OS" = 'NetBSD' ]; then |
| 481 | handle_nbsd |
| 482 | elif [ "$OS" = 'OpenBSD' ]; then |
| 483 | handle_obsd |
| 484 | elif [ "$OS" = 'FreeBSD' ]; then |
| 485 | handle_fbsd |
| 486 | elif [ "$OS" = 'DragonFly' ]; then |
| 487 | handle_dbsd |
| 488 | fi |
| 489 | |
| 490 | if ! in_test_mode; then |
| 491 | echo "#############################################" |
| 492 | echo "## $1 completed successfully" |
| 493 | echo "#############################################" |
| 494 | fi |