[Asterisk-code-review] contrib/scripts/install_prereq.sh - added Linux Mint support. (asterisk[master])

Martin McCarthy asteriskteam at digium.com
Thu Mar 16 10:11:36 CDT 2023


Martin McCarthy has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19974 )


Change subject: contrib/scripts/install_prereq.sh - added Linux Mint support.
......................................................................

contrib/scripts/install_prereq.sh - added Linux Mint support.

List of Changes;

- added Linux Mint support.

ASTERISK-30359 #close

Change-Id: I9c140c7f12ca7dafe65c317f2a26122cf2c72556
---
M contrib/scripts/install_prereq
1 file changed, 347 insertions(+), 641 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/74/19974/1

diff --git a/contrib/scripts/install_prereq b/contrib/scripts/install_prereq
old mode 100755
new mode 100644
index 37141b4..2961673
--- a/contrib/scripts/install_prereq
+++ b/contrib/scripts/install_prereq
@@ -1,351 +1,378 @@
-#!/bin/sh
-# ============================================
-# Prerequisite Installer for Asterisk
-# Revision: 2
-# Amended by Martin McCarthy
-# 01/11/22
-# This script will help prepare your system for installing Asterisk
-# by installing prerequisite packages required to run it.
-# - Supported distros;
-# - Arch Linux
-# - Debian
-# - DragonFly
-# - FreeBSD
-# - Gentoo
-# - OpenBSD
-# - openSUSE
-# - NetBSD
-# - Red Hat Enterprise Linux
-#  ============================================
+#! /bin/sh
+#
+# $Id$
+#
+
+# install_prereq: a script to install distribution-specific
+# prerequirements
+# Linux Mint support added by Martin McCarthy 2023-03-16 14:48:15
+
 set -e
 
-# ============================================
-# Functions - Start
-# ============================================
-# ============================================
-# Function description: this function will handle installation
-# of Debian packages
-# ============================================
-handle_debian() {
-	if ! [ -x "$(command -v aptitude)" ] ; then
-		# Inform the user
-		echo ""
-		echo "Installing aptitude..."
-
-		apt-get install -y aptitude
-	fi
-	extra_packs=`check_installed_debs $PACKAGES_DEBIAN`
-
-	$testcmd aptitude update
-	if [ "$extra_packs" != "x" ] ; then
-		echo ""
-		echo "Installing extra packs...please wait..."
-
-		$testcmd aptitude install -y $extra_packs
-	fi
-
-	return
-}
-
-# ============================================
-# Function description: this function will handle installation
-# of Red Hat packages
-# ============================================
-handle_rh() {
-	extra_packs=`check_installed_rpms $PACKAGES_RH`
-
-	if [ "$extra_packs" != "x" ] ; then
-		echo ""
-		echo "Installing extra packs...please wait..."
-
-		$testcmd yum install --skip-broken --assumeyes $extra_packs
-	fi
-
-	return
-}
-
-# ============================================
-# Function description: this function will handle installation
-# of Gentoo packages
-# ============================================
-handle_gentoo() {
-	extra_packs=`check_installed_equery $PACKAGES_GENTOO`
-
-	if [ "$extra_packs" != "x" ] ; then
-		echo ""
-		echo "Installing extra packs...please wait..."
-
-
-		$testcmd emerge $extra_packs
-	fi
-
-	return
-}
-
-# ============================================
-# Function description: this function will handle installation
-# of Arch Linux packages
-# ============================================
-handle_arch() {
-	extra_packs=`check_installed_pacman $PACKAGES_ARCH`
-
-	if [ "$extra_packs" != "x" ] ; then
-		echo ""
-		echo "Installing extra packs...please wait..."
-
-
-		$testcmd pacman -S --asexplicit --noconfirm $extra_packs
-	fi
-
-	return
-}
-
-# ============================================
-# Function description: this function will handle installation
-# of NetBSD packages
-# ============================================
-handle_nbsd() {
-	extra_packs=`check_installed_pkgs $PACKAGES_NBSD`
-
-	if [ "$extra_packs" != "x" ] ; then
-		if [ -z "$PKG_PATH" ] ; then
-			# See NetBSD Problem Report #48177
-			# (http://gnats.netbsd.org/48177)
-			export PKG_PATH="http://cdn.NetBSD.org/pub/pkgsrc/packages/$(uname -s)/$(uname -p)/$(uname -r)/All"
-		fi
-
-		echo ""
-		echo "Installing extra packs...please wait..."
-
-		$testcmd pkg_add $extra_packs
-	fi
-
-	return
-}
-
-# ============================================
-# Function description: this function will handle installation
-# of OpenBSD packages
-# ============================================
-handle_obsd() {
-	extra_packs=`check_installed_pkgs $PACKAGES_OBSD`
-
-	if [ "$extra_packs" != "x" ] ; then
-		echo ""
-		echo "Installing extra packs...please wait..."
-
-		$testcmd pkg_add $extra_packs
-	fi
-
-	return
-}
-
-# ============================================
-# Function description: this function will handle installation
-# of FreeBSD packages
-# ============================================
-handle_fbsd() {
-	extra_packs=`check_installed_fpkgs $PACKAGES_FBSD`
-
-	if [ "$extra_packs" != "x" ] ; then
-		echo ""
-		echo "Installing extra packs...please wait..."
-
-		$testcmd pkg install -y $extra_packs
-	fi
-
-	return
-}
-
-# ============================================
-# Function description: this function will handle installation
-# of DragonFlyBSD packages
-# ============================================
-handle_dbsd() {
-	extra_packs=`check_installed_fpkgs $PACKAGES_DBSD`
-
-	if [ "$extra_packs" != "x" ] ; then
-		echo ""
-		echo "Installing extra packs...please wait..."
-
-		$testcmd pkg install -y $extra_packs
-	fi
-
-	return
-}
-
-# ============================================
-# Function description: this function will handle installation
-# of openSUSE packages
-# ============================================
-handle_SUSE() {
-	extra_packs=`check_installed_zypper $PACKAGES_SUSE`
-
-	if [ "$extra_packs" != "x" ] ; then
-		echo ""
-		echo "Installing extra packs...please wait..."
-
-		$testcmd zypper install --no-confirm $extra_packs
-	fi
-
-	return
-}
-
-# ============================================
-# Function description: display help information on how to use the script.
-# ============================================
 usage() {
-	# Display help to the user
-	echo "======================================"
-	echo "!!! No command line arguments were passed !!!"
+	echo "$0: a script to install distribution-specific prerequirement"
+	echo "Support distros; Debian, RHEL, openSUSE, Gentoo, Arch Linux"
+	echo "NetBSD, OpenBSD, FreeBSD and Dragonfly BSD"
+	echo 'Revision: $Id$'
 	echo ""
-	echo "Here are some examples of valid arguments;"
-	echo ""
-	echo "$0:				will display this help text."
-	echo "$0 test			prints commands to be run but does not run them."
-	echo "$0 install		 will install the prerequisite packages."
-	echo "$0 install-unpackaged will install the unpackaged requirements."
-	echo ""
-	echo "This script will now exit"
-	echo "======================================"
-
-	return
+	echo "Usage: $0:                    Shows this message."
+	echo "Usage: $0 test                Prints commands it is about to run."
+	echo "Usage: $0 install             Really install."
+	echo "Usage: $0 install-unpackaged  Really install unpackaged requirements."
 }
 
-# ============================================
-# Function description: activate test mode
-# ============================================
+# Basic build system:
+PACKAGES_DEBIAN="build-essential pkg-config"
+# Asterisk: basic requirements:
+PACKAGES_DEBIAN="$PACKAGES_DEBIAN libedit-dev libjansson-dev libsqlite3-dev uuid-dev libxml2-dev"
+# Asterisk: for addons:
+PACKAGES_DEBIAN="$PACKAGES_DEBIAN libspeex-dev libspeexdsp-dev libogg-dev libvorbis-dev libasound2-dev portaudio19-dev libcurl4-openssl-dev xmlstarlet bison flex"
+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"
+PACKAGES_DEBIAN="$PACKAGES_DEBIAN libmysqlclient-dev libbluetooth-dev libradcli-dev freetds-dev libosptk-dev libjack-jackd2-dev bash libcap-dev"
+PACKAGES_DEBIAN="$PACKAGES_DEBIAN libsnmp-dev libiksemel-dev libcorosync-common-dev libcpg-dev libcfg-dev libnewt-dev libpopt-dev libical-dev libspandsp-dev"
+PACKAGES_DEBIAN="$PACKAGES_DEBIAN libresample1-dev libc-client2007e-dev binutils-dev libsrtp0-dev libsrtp2-dev libgsm1-dev doxygen graphviz zlib1g-dev libldap2-dev"
+PACKAGES_DEBIAN="$PACKAGES_DEBIAN libcodec2-dev libfftw3-dev libsndfile1-dev libunbound-dev"
+# Asterisk: for the unpackaged below:
+PACKAGES_DEBIAN="$PACKAGES_DEBIAN wget subversion"
+# Asterisk: for ./configure --with-pjproject-bundled:
+PACKAGES_DEBIAN="$PACKAGES_DEBIAN bzip2 patch"
+
+# Basic build system:
+PACKAGES_RH="make gcc gcc-c++ pkgconfig"
+# Asterisk: basic requirements:
+PACKAGES_RH="$PACKAGES_RH libedit-devel jansson-devel libuuid-devel sqlite-devel libxml2-devel"
+# Asterisk: for addons:
+PACKAGES_RH="$PACKAGES_RH speex-devel speexdsp-devel libogg-devel libvorbis-devel alsa-lib-devel portaudio-devel libcurl-devel xmlstarlet bison flex"
+PACKAGES_RH="$PACKAGES_RH postgresql-devel unixODBC-devel neon-devel gmime-devel lua-devel uriparser-devel libxslt-devel openssl-devel"
+PACKAGES_RH="$PACKAGES_RH mysql-devel bluez-libs-devel radcli-devel freetds-devel jack-audio-connection-kit-devel bash libcap-devel"
+PACKAGES_RH="$PACKAGES_RH net-snmp-devel iksemel-devel corosynclib-devel newt-devel popt-devel libical-devel spandsp-devel"
+PACKAGES_RH="$PACKAGES_RH libresample-devel uw-imap-devel binutils-devel libsrtp-devel gsm-devel doxygen graphviz zlib-devel openldap-devel hoard"
+PACKAGES_RH="$PACKAGES_RH codec2-devel fftw-devel libsndfile-devel unbound-devel"
+# Asterisk: for the unpackaged below:
+PACKAGES_RH="$PACKAGES_RH wget subversion"
+# Asterisk: for ./configure --with-pjproject-bundled:
+PACKAGES_RH="$PACKAGES_RH bzip2 patch"
+
+# Basic build system:
+PACKAGES_SUSE="make gcc gcc-c++ pkg-config"
+# Asterisk: basic requirements:
+PACKAGES_SUSE="$PACKAGES_SUSE libedit-devel libjansson-devel libuuid-devel sqlite3-devel libxml2-devel"
+# Asterisk: for addons:
+PACKAGES_SUSE="$PACKAGES_SUSE speex-devel speexdsp-devel libogg-devel libvorbis-devel alsa-devel portaudio-devel libcurl-devel xmlstarlet bison flex"
+PACKAGES_SUSE="$PACKAGES_SUSE postgresql-devel unixODBC-devel libneon-devel gmime-devel lua-devel liburiparser-devel libxslt-devel libopenssl-devel"
+PACKAGES_SUSE="$PACKAGES_SUSE libmysqlclient-devel bluez-devel freeradius-client-devel freetds-devel bash libcap-devel"
+PACKAGES_SUSE="$PACKAGES_SUSE net-snmp-devel iksemel-devel libcorosync-devel newt-devel popt-devel libical-devel spandsp-devel"
+PACKAGES_SUSE="$PACKAGES_SUSE imap-devel libsrtp2-devel libgsm-devel doxygen graphviz zlib-devel openldap2-devel"
+PACKAGES_SUSE="$PACKAGES_SUSE codec2-devel fftw3-devel libsndfile-devel unbound-devel"
+# Asterisk: for the unpackaged below:
+PACKAGES_SUSE="$PACKAGES_SUSE wget subversion"
+# Asterisk: for ./configure --with-pjproject-bundled:
+PACKAGES_SUSE="$PACKAGES_SUSE bzip2 patch"
+
+# Basic build system:
+PACKAGES_ARCH="make gcc pkg-config"
+# Asterisk: basic requirements:
+PACKAGES_ARCH="$PACKAGES_ARCH libedit jansson libutil-linux libxml2 sqlite"
+# Asterisk: for addons:
+PACKAGES_ARCH="$PACKAGES_ARCH speex speexdsp libogg libvorbis alsa-lib portaudio curl xmlstarlet bison flex"
+PACKAGES_ARCH="$PACKAGES_ARCH postgresql-libs unixodbc neon gmime lua uriparser libxslt openssl"
+PACKAGES_ARCH="$PACKAGES_ARCH libmariadbclient bluez-libs radcli freetds bash libcap"
+PACKAGES_ARCH="$PACKAGES_ARCH net-snmp libnewt popt libical spandsp"
+PACKAGES_ARCH="$PACKAGES_ARCH c-client binutils libsrtp gsm doxygen graphviz zlib libldap"
+PACKAGES_ARCH="$PACKAGES_ARCH fftw libsndfile unbound"
+# Asterisk: for the unpackaged below:
+PACKAGES_ARCH="$PACKAGES_ARCH wget subversion"
+# Asterisk: for ./configure --with-pjproject-bundled:
+PACKAGES_ARCH="$PACKAGES_ARCH bzip2 patch"
+
+# Basic build system:
+PACKAGES_GENTOO="sys-devel/make sys-devel/gcc dev-util/pkgconfig"
+# Asterisk: basic requirements:
+PACKAGES_GENTOO="$PACKAGES_GENTOO dev-libs/libedit dev-libs/jansson sys-libs/e2fsprogs-libs dev-libs/libxml2 dev-db/sqlite"
+# Asterisk: for addons:
+PACKAGES_GENTOO="$PACKAGES_GENTOO media-libs/speex media-libs/speexdsp media-libs/libogg media-libs/libvorbis media-libs/alsa-lib media-libs/portaudio net-misc/curl app-text/xmlstarlet sys-devel/bison sys-devel/flex"
+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"
+PACKAGES_GENTOO="$PACKAGES_GENTOO virtual/libmysqlclient net-wireless/bluez net-dialup/radiusclient-ng dev-db/freetds app-shells/bash sys-libs/libcap"
+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"
+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"
+PACKAGES_GENTOO="$PACKAGES_GENTOO sci-libs/fftw media-libs/libsndfile net-dns/unbound"
+# Asterisk: for the unpackaged below:
+PACKAGES_GENTOO="$PACKAGES_GENTOO net-misc/wget dev-vcs/subversion"
+# Asterisk: for ./configure --with-pjproject-bundled:
+PACKAGES_GENTOO="$PACKAGES_GENTOO app-arch/bzip2 sys-devel/patch"
+
+# Basic build system:
+PACKAGES_NBSD="gmake pkg-config"
+# Asterisk: basic requirements:
+PACKAGES_NBSD="$PACKAGES_NBSD editline jansson sqlite3 libuuid libxml2"
+# Asterisk: for addons:
+PACKAGES_NBSD="$PACKAGES_NBSD speex speexdsp libogg libvorbis alsa-lib portaudio-devel curl bison flex"
+PACKAGES_NBSD="$PACKAGES_NBSD postgresql10-client unixodbc neon gmime lua52 uriparser libxslt openssl"
+PACKAGES_NBSD="$PACKAGES_NBSD mysql-client radiusclient-ng freetds bash"
+PACKAGES_NBSD="$PACKAGES_NBSD net-snmp iksemel popt libical spandsp"
+PACKAGES_NBSD="$PACKAGES_NBSD imap-uw srtp gsm doxygen graphviz libzip openldap-client"
+PACKAGES_NBSD="$PACKAGES_NBSD codec2 fftw libsndfile unbound"
+# Asterisk: for the unpackaged below:
+PACKAGES_NBSD="$PACKAGES_NBSD wget subversion-base"
+# Asterisk: for ./configure --with-pjproject-bundled:
+PACKAGES_NBSD="$PACKAGES_NBSD bzip2 patch"
+
+# Basic build system:
+PACKAGES_OBSD="gmake"
+# Asterisk: basic requirements:
+PACKAGES_OBSD="$PACKAGES_OBSD libxml sqlite3 e2fsprogs jansson"
+# Asterisk: for addons:
+PACKAGES_OBSD="$PACKAGES_OBSD speex speexdsp libogg libvorbis portaudio-svn curl xmlstarlet bison"
+PACKAGES_OBSD="$PACKAGES_OBSD postgresql-client iodbc neon gmime lua%5.2 uriparser libxslt"
+PACKAGES_OBSD="$PACKAGES_OBSD mariadb-client radcli freetds"
+PACKAGES_OBSD="$PACKAGES_OBSD net-snmp iksemel popt libical spandsp"
+PACKAGES_OBSD="$PACKAGES_OBSD c-client libsrtp gsm doxygen graphviz"
+PACKAGES_OBSD="$PACKAGES_OBSD fftw3 libsndfile"
+# Asterisk: for the unpackaged below:
+PACKAGES_OBSD="$PACKAGES_OBSD wget subversion"
+# Asterisk: for ./configure --with-pjproject-bundled:
+PACKAGES_OBSD="$PACKAGES_OBSD bzip2"
+
+# Basic build system:
+PACKAGES_FBSD="gmake pkgconf"
+# Asterisk: basic requirements:
+PACKAGES_FBSD="$PACKAGES_FBSD libedit jansson e2fsprogs-libuuid sqlite3 libxml2"
+# Asterisk: for addons:
+PACKAGES_FBSD="$PACKAGES_FBSD speex speexdsp libogg libvorbis alsa-lib portaudio curl xmlstarlet bison flex"
+PACKAGES_FBSD="$PACKAGES_FBSD postgresql10-client unixODBC neon gmime26 lua52 uriparser libxslt openssl"
+PACKAGES_FBSD="$PACKAGES_FBSD mysql57-client radcli freetds"
+PACKAGES_FBSD="$PACKAGES_FBSD net-snmp iksemel corosync newt popt libical spandsp"
+PACKAGES_FBSD="$PACKAGES_FBSD cclient libbfd libsrtp gsm libilbc doxygen graphviz libzip openldap-client libhoard"
+PACKAGES_FBSD="$PACKAGES_FBSD codec2 fftw3 libsndfile unbound"
+# Asterisk: for the unpackaged below:
+PACKAGES_FBSD="$PACKAGES_FBSD wget subversion"
+# Asterisk: for ./configure --with-pjproject-bundled:
+PACKAGES_FBSD="$PACKAGES_FBSD bzip2 patch"
+
+# Basic build system:
+PACKAGES_DBSD="gmake pkgconf"
+# Asterisk: basic requirements:
+PACKAGES_DBSD="$PACKAGES_DBSD libedit jansson e2fsprogs-libuuid sqlite3 libxml2"
+# Asterisk: for addons:
+PACKAGES_DBSD="$PACKAGES_DBSD speex speexdsp libogg libvorbis alsa-lib portaudio curl xmlstarlet bison flex"
+PACKAGES_DBSD="$PACKAGES_DBSD postgresql10-client unixODBC neon gmime26 lua52 uriparser libxslt libressl"
+PACKAGES_DBSD="$PACKAGES_DBSD mariadb101-client radcli freetds"
+PACKAGES_DBSD="$PACKAGES_DBSD net-snmp iksemel corosync newt popt libical spandsp"
+PACKAGES_DBSD="$PACKAGES_DBSD cclient binutils libsrtp gsm libilbc doxygen graphviz libzip openldap-client libhoard"
+PACKAGES_DBSD="$PACKAGES_DBSD codec2 fftw3 libsndfile unbound"
+# Asterisk: for the unpackaged below:
+PACKAGES_DBSD="$PACKAGES_DBSD wget subversion"
+# Asterisk: for ./configure --with-pjproject-bundled:
+PACKAGES_DBSD="$PACKAGES_DBSD bzip2 patch"
+
+KVERS=`uname -r`
+
+case "$1" in
+test)
+	testcmd=echo
+	;;
+install)
+	testcmd=''
+	;;
+install-unpackaged)
+	unpackaged="yes"
+	;;
+'')
+	usage
+	exit 0
+	;;
+*)
+	usage
+	exit 1
+	;;
+esac
+
 in_test_mode() {
 	test "$testcmd" != ''
-
-	return
 }
 
-# ============================================
-# Function description: check if Debian packages are installed.
-# ============================================
 check_installed_debs() {
 	for pack in "$@" ; do
 		tocheck="${tocheck} ^${pack}$ ~P^${pack}$"
 	done
-
-	echo ""
-	echo "Checking installed packages...please wait..."
-
 	pkgs=$(aptitude -F '%c %p' search ${tocheck} 2>/dev/null | awk '/^p/{print $2}')
-
-	if [ ${#pkgs} -ne 0 ] ; then
+	if [ ${#pkgs} -ne 0 ]; then
 		echo $pkgs | sed -r -e "s/ ?[^ :]+:i386//g"
 	fi
-
-	return
 }
 
-# ==========================================
-# Function description: check if RPM packages are installed.
-# Parsing the output of YUM is close to impossible
-# so we'll use RPM and hope for the best!
-# ==========================================
+# parsing the output of yum is close to impossible.
+# We'll use rpm and hope for the best:
 check_installed_rpms() {
 	for pack in "$@"
 	do
-		if ! [ rpm -q $pack >/dev/null 2>/dev/null ]; then
-			echo $pack
+		if ! rpm -q $pack >/dev/null 2>/dev/null
+		then echo $pack
 		fi
 	done
-
-	return
 }
 
-# ==========================================
-# Function description: Check if Gentoo packages are installed.
-# ==========================================
 check_installed_equery() {
 	for pack in "$@"
 	do
 		# equery --quiet list $pack
-		# is slower and would require the optional app-portage/gentoolkit
+		# is slower and
+		# would require the optional app-portage/gentoolkit
 		# /var/lib/portage/world would be the non-dep list
 		pack_with_version=${pack/:/-} # replace a possible version with '-'
-
-		if [! ls -d /var/db/pkg/${pack_with_version}* >/dev/null 2>/dev/null
-			then
-				echo $pack
+		if ! ls -d /var/db/pkg/${pack_with_version}* >/dev/null 2>/dev/null
+		then echo $pack
 		fi
 	done
-
-	return
 }
 
-# ==========================================
-# Function description: check if Arch Linux packages are installed.
-# ==========================================
 check_installed_pacman() {
 	for pack in "$@"
 	do
-		if ! [ pacman -Q --explicit $pack >/dev/null 2>/dev/null ]; then
-			echo $pack
+		if ! pacman -Q --explicit $pack >/dev/null 2>/dev/null
+		then echo $pack
 		fi
 	done
-
-	return
 }
 
-# ==========================================
-# Function description: check installed packages.
-# ==========================================
 check_installed_pkgs() {
 	for pack in "$@"
 	do
 		if [ `pkg_info -a | grep $pack | wc -l` = 0 ]; then
-			echo $pack
+		echo $pack
 		fi
 	done
-
-	return
 }
 
-# ==========================================
-# Function description: check installed packages.
-# ==========================================
 check_installed_fpkgs() {
 	for pack in "$@"
 	do
 		if [ `pkg info -a | grep $pack | wc -l` = 0 ]; then
-			echo $pack
+		echo $pack
 		fi
 	done
-
-	return
 }
 
-# ==========================================
-# Function description: check installed packages.
-# ==========================================
 check_installed_zypper() {
 	for pack in "$@"
 	do
-		if ! [ zypper se -ixnC $pack >/dev/null 2>/dev/null ]; then
-			echo $pack
+		if ! zypper se -ixnC $pack >/dev/null 2>/dev/null
+		then echo $pack
+		fi
+	done
+}
+
+handle_debian() {
+	if ! [ -x "$(command -v aptitude)" ]; then
+		apt-get install -y aptitude
+	fi
+	extra_packs=`check_installed_debs $PACKAGES_DEBIAN`
+	$testcmd aptitude update
+	if [ x"$extra_packs" != "x" ] ; then
+		$testcmd aptitude install -y $extra_packs
+	fi
+}
+
+handle_linuxmint() {
+	# Store temporary variable to contain list of missing packages
+	missing_packages=""
+
+	# Check installed packages for Mint
+	for package in $PACKAGES_DEBIAN; do
+		if [ "$package" = "libgmime-2.6-dev" ] || [ "$package" = "libsrtp0-dev" ]; then
+			continue
+		fi
+
+		missing_package_check=$(apt list --installed 2>/dev/null | grep  $package | wc -l)
+
+		if [ "$missing_package_check" -eq 0 ]; then
+			echo "This package is missing: "$package
+			missing_packages="${missing_packages} $package"
+		else
+			echo "Package "$package" is present."
 		fi
 	done
 
-	return
+	# Update the packages on our local system
+	echo "==========================="
+	echo "Updating your system's packages"
+	echo "==========================="
+	$testcmd apt update
+
+	# Inform user of packages to be installed
+	echo "==========================="
+	echo "The following packages will be installed on your system;"
+	echo $missing_packages
+	echo "==========================="
+
+	if [ "$missing_packages" != "" ] ; then
+		$testcmd apt -m install -y $missing_packages
+	fi
 }
 
-# ==========================================
-# Function description: install optional extra packages for Asterisk
-# ==========================================
+handle_rh() {
+	extra_packs=`check_installed_rpms $PACKAGES_RH`
+	if [ x"$extra_packs" != "x" ] ; then
+		$testcmd yum install --skip-broken --assumeyes $extra_packs
+	fi
+}
+
+handle_gentoo() {
+	extra_packs=`check_installed_equery $PACKAGES_GENTOO`
+	if [ x"$extra_packs" != "x" ] ; then
+		$testcmd emerge $extra_packs
+	fi
+}
+
+handle_arch() {
+	extra_packs=`check_installed_pacman $PACKAGES_ARCH`
+	if [ x"$extra_packs" != "x" ] ; then
+		$testcmd pacman -S --asexplicit --noconfirm $extra_packs
+	fi
+}
+
+handle_nbsd() {
+	extra_packs=`check_installed_pkgs $PACKAGES_NBSD`
+	if [ x"$extra_packs" != "x" ] ; then
+		if [ -z "$PKG_PATH" ] ; then
+			# see NetBSD Problem Report #48177
+			export PKG_PATH="http://cdn.NetBSD.org/pub/pkgsrc/packages/$(uname -s)/$(uname -p)/$(uname -r)/All"
+		fi
+		$testcmd pkg_add $extra_packs
+	fi
+}
+
+handle_obsd() {
+	extra_packs=`check_installed_pkgs $PACKAGES_OBSD`
+	if [ x"$extra_packs" != "x" ] ; then
+		$testcmd pkg_add $extra_packs
+	fi
+}
+
+handle_fbsd() {
+	extra_packs=`check_installed_fpkgs $PACKAGES_FBSD`
+	if [ x"$extra_packs" != "x" ] ; then
+		$testcmd pkg install -y $extra_packs
+	fi
+}
+
+handle_dbsd() {
+	extra_packs=`check_installed_fpkgs $PACKAGES_DBSD`
+	if [ x"$extra_packs" != "x" ] ; then
+		$testcmd pkg install -y $extra_packs
+	fi
+}
+
+handle_SUSE() {
+	extra_packs=`check_installed_zypper $PACKAGES_SUSE`
+	if [ x"$extra_packs" != "x" ] ; then
+		$testcmd zypper install --no-confirm $extra_packs
+	fi
+}
+
 install_unpackaged() {
-	echo "*** Installing NBS (Network Broadcast Sound) ***"
-
-	svn co https://svn.digium.com/svn/nbs/trunk nbs-trunk
-	cd nbs-trunk
-	make all install
-	cd ..
-
 	# Only install libresample if it wasn't installed via package
-	if ! [ test -f /usr/include/libresample.h ]; then
+	if ! test -f /usr/include/libresample.h; then
 		echo "*** Installing libresample ***"
 		svn co https://svn.digium.com/svn/thirdparty/libresample/trunk libresample-trunk
 		cd libresample-trunk
@@ -354,25 +381,9 @@
 		cd ..
 	fi
 
-	# Only install Jansson if it wasn't installed via package
-	if ! [ test -f /usr/include/jansson.h ]; then
-		echo "*** Installing jansson ***"
-		wget -O - http://www.digip.org/jansson/releases/jansson-${JANSSON_VER}.tar.gz | zcat | tar -xf -
-		cd jansson-${JANSSON_VER}
-		./configure
-		make all install
-		cd ..
-		if test -d /etc/ld.so.conf.d; then
-			echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local.conf
-		else # for example: Slackware 14.2
-			echo "/usr/local/lib" > /etc/ld.so.conf
-		fi
-		/sbin/ldconfig
-	fi
-
 	# Only install libsrtp2 if it wasn't installed via package
-	if ! [ test -f /usr/include/srtp/srtp.h ]; then
-		if ! [ test -f /usr/include/srtp2/srtp.h ]; then
+	if ! test -f /usr/include/srtp/srtp.h; then
+		if ! test -f /usr/include/srtp2/srtp.h; then
 			echo "*** Installing libsrtp2 ***"
 			wget -O - http://github.com/cisco/libsrtp/archive/v2.tar.gz | zcat | tar -xf -
 			cd libsrtp-2
@@ -388,405 +399,85 @@
 		fi
 	fi
 
-	if ! [ test -f /usr/include/pjlib.h ]; then
+	if ! test -f /usr/include/pjlib.h; then
 		echo "PJProject not installed, yet. Therefore, please, run"
 		echo "./configure --with-pjproject-bundled"
 	fi
-
-	return
 }
-# ============================================
-# Functions - End
-# ============================================
 
-# ============================================
-# Global Variables - Start
-# ============================================
-##################
-# DEBIAN PACKAGES
-##################
-# Basic build system
-PACKAGES_DEBIAN="build-essential pkg-config"
-
-# Asterisk - basic prerequisite packages
-PACKAGES_DEBIAN="$PACKAGES_DEBIAN libedit-dev libjansson-dev libsqlite3-dev uuid-dev libxml2-dev"
-
-# Asterisk - addon packages
-PACKAGES_DEBIAN="$PACKAGES_DEBIAN libspeex-dev libspeexdsp-dev libogg-dev libvorbis-dev libasound2-dev portaudio19-dev libcurl4-openssl-dev xmlstarlet bison flex"
-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"
-PACKAGES_DEBIAN="$PACKAGES_DEBIAN libvpb-dev libmysqlclient-dev libbluetooth-dev libradcli-dev freetds-dev libosptk-dev libjack-jackd2-dev bash libcap-dev"
-PACKAGES_DEBIAN="$PACKAGES_DEBIAN libsnmp-dev libiksemel-dev libcorosync-common-dev libcpg-dev libcfg-dev libnewt-dev libpopt-dev libical-dev libspandsp-dev"
-PACKAGES_DEBIAN="$PACKAGES_DEBIAN libresample1-dev libc-client2007e-dev binutils-dev libsrtp0-dev libsrtp2-dev libgsm1-dev doxygen graphviz zlib1g-dev libldap2-dev"
-PACKAGES_DEBIAN="$PACKAGES_DEBIAN libcodec2-dev libfftw3-dev libsndfile1-dev libunbound-dev"
-
-# Asterisk- subversion
-PACKAGES_DEBIAN="$PACKAGES_DEBIAN wget subversion"
-
-# Asterisk - packages to run ./configure --with-pjproject-bundled
-PACKAGES_DEBIAN="$PACKAGES_DEBIAN bzip2 patch"
-
-##################
-# RED HAT PACKAGES
-##################
-# Basic build system
-PACKAGES_RH="make gcc gcc-c++ pkgconfig"
-
-# Asterisk - basic prerequisite packages
-PACKAGES_RH="$PACKAGES_RH libedit-devel jansson-devel libuuid-devel sqlite-devel libxml2-devel"
-
-# Asterisk - addon packages
-PACKAGES_RH="$PACKAGES_RH speex-devel speexdsp-devel libogg-devel libvorbis-devel alsa-lib-devel portaudio-devel libcurl-devel xmlstarlet bison flex"
-PACKAGES_RH="$PACKAGES_RH postgresql-devel unixODBC-devel neon-devel gmime-devel lua-devel uriparser-devel libxslt-devel openssl-devel"
-PACKAGES_RH="$PACKAGES_RH mysql-devel bluez-libs-devel radcli-devel freetds-devel jack-audio-connection-kit-devel bash libcap-devel"
-PACKAGES_RH="$PACKAGES_RH net-snmp-devel iksemel-devel corosynclib-devel newt-devel popt-devel libical-devel spandsp-devel"
-PACKAGES_RH="$PACKAGES_RH libresample-devel uw-imap-devel binutils-devel libsrtp-devel gsm-devel doxygen graphviz zlib-devel openldap-devel hoard"
-PACKAGES_RH="$PACKAGES_RH codec2-devel fftw-devel libsndfile-devel unbound-devel"
-
-# Asterisk- subversion
-PACKAGES_RH="$PACKAGES_RH wget subversion"
-
-# Asterisk - packages to run ./configure --with-pjproject-bundled
-PACKAGES_RH="$PACKAGES_RH bzip2 patch"
-
-##################
-# OpenSUSE PACKAGES
-##################
-# Basic build system
-PACKAGES_SUSE="make gcc gcc-c++ pkg-config"
-
-# Asterisk - basic prerequisite packages
-PACKAGES_SUSE="$PACKAGES_SUSE libedit-devel libjansson-devel libuuid-devel sqlite3-devel libxml2-devel"
-
-# Asterisk - addon packages
-PACKAGES_SUSE="$PACKAGES_SUSE speex-devel speexdsp-devel libogg-devel libvorbis-devel alsa-devel portaudio-devel libcurl-devel xmlstarlet bison flex"
-PACKAGES_SUSE="$PACKAGES_SUSE postgresql-devel unixODBC-devel libneon-devel gmime-devel lua-devel liburiparser-devel libxslt-devel libopenssl-devel"
-PACKAGES_SUSE="$PACKAGES_SUSE libmysqlclient-devel bluez-devel freeradius-client-devel freetds-devel bash libcap-devel"
-PACKAGES_SUSE="$PACKAGES_SUSE net-snmp-devel iksemel-devel libcorosync-devel newt-devel popt-devel libical-devel spandsp-devel"
-PACKAGES_SUSE="$PACKAGES_SUSE imap-devel libsrtp2-devel libgsm-devel doxygen graphviz zlib-devel openldap2-devel"
-PACKAGES_SUSE="$PACKAGES_SUSE codec2-devel fftw3-devel libsndfile-devel unbound-devel"
-
-# Asterisk- subversion
-PACKAGES_SUSE="$PACKAGES_SUSE wget subversion"
-
-# Asterisk - packages to run ./configure --with-pjproject-bundled
-PACKAGES_SUSE="$PACKAGES_SUSE bzip2 patch"
-
-##################
-# ARCH PACKAGES
-##################
-# Basic build system
-PACKAGES_ARCH="make gcc pkg-config"
-
-# Asterisk - basic prerequisite packages
-PACKAGES_ARCH="$PACKAGES_ARCH libedit jansson libutil-linux libxml2 sqlite"
-
-# Asterisk - addon packages
-PACKAGES_ARCH="$PACKAGES_ARCH speex speexdsp libogg libvorbis alsa-lib portaudio curl xmlstarlet bison flex"
-PACKAGES_ARCH="$PACKAGES_ARCH postgresql-libs unixodbc neon gmime lua uriparser libxslt openssl"
-PACKAGES_ARCH="$PACKAGES_ARCH libmariadbclient bluez-libs radcli freetds bash libcap"
-PACKAGES_ARCH="$PACKAGES_ARCH net-snmp libnewt popt libical spandsp"
-PACKAGES_ARCH="$PACKAGES_ARCH c-client binutils libsrtp gsm doxygen graphviz zlib libldap"
-PACKAGES_ARCH="$PACKAGES_ARCH fftw libsndfile unbound"
-
-# Asterisk- subversion
-PACKAGES_ARCH="$PACKAGES_ARCH wget subversion"
-
-# Asterisk - packages to run ./configure --with-pjproject-bundled
-PACKAGES_ARCH="$PACKAGES_ARCH bzip2 patch"
-
-##################
-# GENTOO PACKAGES
-##################
-# Basic build system
-PACKAGES_GENTOO="sys-devel/make sys-devel/gcc dev-util/pkgconfig"
-
-# Asterisk - basic prerequisite packages
-PACKAGES_GENTOO="$PACKAGES_GENTOO dev-libs/libedit dev-libs/jansson sys-libs/e2fsprogs-libs dev-libs/libxml2 dev-db/sqlite"
-
-# Asterisk - addon packages
-PACKAGES_GENTOO="$PACKAGES_GENTOO media-libs/speex media-libs/speexdsp media-libs/libogg media-libs/libvorbis media-libs/alsa-lib media-libs/portaudio net-misc/curl app-text/xmlstarlet sys-devel/bison sys-devel/flex"
-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"
-PACKAGES_GENTOO="$PACKAGES_GENTOO virtual/libmysqlclient net-wireless/bluez net-dialup/radiusclient-ng dev-db/freetds app-shells/bash sys-libs/libcap"
-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"
-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"
-PACKAGES_GENTOO="$PACKAGES_GENTOO sci-libs/fftw media-libs/libsndfile net-dns/unbound"
-
-# Asterisk- subversion
-PACKAGES_GENTOO="$PACKAGES_GENTOO net-misc/wget dev-vcs/subversion"
-
-# Asterisk - packages to run ./configure --with-pjproject-bundled
-PACKAGES_GENTOO="$PACKAGES_GENTOO app-arch/bzip2 sys-devel/patch"
-
-##################
-# NetBSD PACKAGES
-##################
-# Basic build system
-PACKAGES_NBSD="gmake pkg-config"
-
-# Asterisk - basic prerequisite packages
-PACKAGES_NBSD="$PACKAGES_NBSD editline jansson sqlite3 libuuid libxml2"
-
-# Asterisk - addon packages
-PACKAGES_NBSD="$PACKAGES_NBSD speex speexdsp libogg libvorbis alsa-lib portaudio-devel curl bison flex"
-PACKAGES_NBSD="$PACKAGES_NBSD postgresql10-client unixodbc neon gmime lua52 uriparser libxslt openssl"
-PACKAGES_NBSD="$PACKAGES_NBSD mysql-client radiusclient-ng freetds bash"
-PACKAGES_NBSD="$PACKAGES_NBSD net-snmp iksemel popt libical spandsp"
-PACKAGES_NBSD="$PACKAGES_NBSD imap-uw srtp gsm doxygen graphviz libzip openldap-client"
-PACKAGES_NBSD="$PACKAGES_NBSD codec2 fftw libsndfile unbound"
-
-# Asterisk- subversion
-PACKAGES_NBSD="$PACKAGES_NBSD wget subversion-base"
-
-# Asterisk - packages to run ./configure --with-pjproject-bundled
-PACKAGES_NBSD="$PACKAGES_NBSD bzip2 patch"
-
-##################
-# OpenBSD PACKAGES
-##################
-# Basic build system
-PACKAGES_OBSD="gmake"
-
-# Asterisk - basic prerequisite packages
-PACKAGES_OBSD="$PACKAGES_OBSD libxml sqlite3 e2fsprogs jansson"
-
-# Asterisk - addon packages
-PACKAGES_OBSD="$PACKAGES_OBSD speex speexdsp libogg libvorbis portaudio-svn curl xmlstarlet bison"
-PACKAGES_OBSD="$PACKAGES_OBSD postgresql-client iodbc neon gmime lua%5.2 uriparser libxslt"
-PACKAGES_OBSD="$PACKAGES_OBSD mariadb-client radcli freetds"
-PACKAGES_OBSD="$PACKAGES_OBSD net-snmp iksemel popt libical spandsp"
-PACKAGES_OBSD="$PACKAGES_OBSD c-client libsrtp gsm doxygen graphviz"
-PACKAGES_OBSD="$PACKAGES_OBSD fftw3 libsndfile"
-
-# Asterisk- subversion
-PACKAGES_OBSD="$PACKAGES_OBSD wget subversion"
-
-# Asterisk - packages to run ./configure --with-pjproject-bundled
-PACKAGES_OBSD="$PACKAGES_OBSD bzip2"
-
-##################
-# FreeBSD PACKAGES
-##################
-# Basic build system
-PACKAGES_FBSD="gmake pkgconf"
-
-# Asterisk - basic prerequisite packages
-PACKAGES_FBSD="$PACKAGES_FBSD libedit jansson e2fsprogs-libuuid sqlite3 libxml2"
-
-# Asterisk - addon packages
-PACKAGES_FBSD="$PACKAGES_FBSD speex speexdsp libogg libvorbis alsa-lib portaudio curl xmlstarlet bison flex"
-PACKAGES_FBSD="$PACKAGES_FBSD postgresql10-client unixODBC neon gmime26 lua52 uriparser libxslt openssl"
-PACKAGES_FBSD="$PACKAGES_FBSD mysql57-client radcli freetds"
-PACKAGES_FBSD="$PACKAGES_FBSD net-snmp iksemel corosync newt popt libical spandsp"
-PACKAGES_FBSD="$PACKAGES_FBSD cclient libbfd libsrtp gsm libilbc doxygen graphviz libzip openldap-client libhoard"
-PACKAGES_FBSD="$PACKAGES_FBSD codec2 fftw3 libsndfile unbound"
-
-# Asterisk- subversion
-PACKAGES_FBSD="$PACKAGES_FBSD wget subversion"
-
-# Asterisk - packages to run ./configure --with-pjproject-bundled
-PACKAGES_FBSD="$PACKAGES_FBSD bzip2 patch"
-
-##################
-# DragonFly PACKAGES
-##################
-# Basic build system
-PACKAGES_DBSD="gmake pkgconf"
-
-# Asterisk - basic prerequisite packages
-PACKAGES_DBSD="$PACKAGES_DBSD libedit jansson e2fsprogs-libuuid sqlite3 libxml2"
-
-# Asterisk - addon packages
-PACKAGES_DBSD="$PACKAGES_DBSD speex speexdsp libogg libvorbis alsa-lib portaudio curl xmlstarlet bison flex"
-PACKAGES_DBSD="$PACKAGES_DBSD postgresql10-client unixODBC neon gmime26 lua52 uriparser libxslt libressl"
-PACKAGES_DBSD="$PACKAGES_DBSD mariadb101-client radcli freetds"
-PACKAGES_DBSD="$PACKAGES_DBSD net-snmp iksemel corosync newt popt libical spandsp"
-PACKAGES_DBSD="$PACKAGES_DBSD cclient binutils libsrtp gsm libilbc doxygen graphviz libzip openldap-client libhoard"
-PACKAGES_DBSD="$PACKAGES_DBSD codec2 fftw3 libsndfile unbound"
-
-# Asterisk- subversion
-PACKAGES_DBSD="$PACKAGES_DBSD wget subversion"
-
-# Asterisk - packages to run ./configure --with-pjproject-bundled
-PACKAGES_DBSD="$PACKAGES_DBSD bzip2 patch"
-
-##################
-# MISC VARIABLES
-##################
-KVERS=`uname -r`
-JANSSON_VER=2.12
-
-# ============================================
-# Global Variables - End
-# ============================================
-
-# ============================================
-# Main Program Logic - Start
-# ============================================
-# === Algorithm ===
-# - Welcome the user!
-# - Detect and parse runtime arguments
-# - Find distro
-# - Confirm packages to be installed
-# - Attempt to install
-# - Fin!
-##################
-# Welcome!
-##################
-echo "======================================"
-echo "Welcome to the Asterisk Prerequisite Installer!"
-echo ""
-echo "The purpose of this script is to prepare your system"
-echo "for the installation of Asterisk."
-echo ""
-echo "Patches welcome!"
-echo "======================================"
-
-# Arguments
-if [ "$1" -eq "" ] ; then
-	# No arguments passed...display the help text and exit
-	usage
-
-	# Let's get out of here!
+if in_test_mode; then
+	echo "#############################################"
+	echo "## $1: test mode."
+	echo "## Use the commands here to install your system."
+	echo "#############################################"
+elif test "${unpackaged}" = "yes" ; then
+	install_unpackaged
 	exit 0
 fi
 
-# Main script logic starts here
-case "$1" in
-test)
-	testcmd=echo
-	;;
-install)
-	testcmd=""
-	;;
-install-unpackaged)
-	unpackaged="yes"
-	;;
-"")
-	# No arguments passed...display the help text and exit
-	usage
-
-	# Exit!
-	exit 0
-	;;
-*)
-	# No arguments passed...display the help text and exit
-	usage
-
-	# Exit!
-	exit 1
-	;;
-esac
-
-# Grab OS name
 OS=`uname -s`
-unsupported_distro=""
+unsupported_distro=''
 
 # A number of distributions we don't (yet?) support.
-if [ "$OS" != "Linux" -a "$OS" != "NetBSD" -a "$OS" != "OpenBSD" -a "$OS" != "FreeBSD" -a "$OS" != "DragonFly" ] ; then
-	echo >&2 "Unfortunately, $OS is not currently supported. Please post a patched version or reach out to Asterisk support."
-
-	# Exit!
+if [ "$OS" != 'Linux' -a "$OS" != 'NetBSD' -a "$OS" != 'OpenBSD' -a "$OS" != 'FreeBSD' -a "$OS" != 'DragonFly' ]; then
+	echo >&2 "$0: Your OS ($OS) is currently not supported. Aborting."
 	exit 1
 fi
 
 if [ -f /etc/mandrake-release ]; then
-	unsupported_distro="Mandriva"
+	unsupported_distro='Mandriva'
 fi
 
 if [ -f /etc/slackware-version ] || ([ -f /etc/os-release ] && . /etc/os-release && [ "$ID" = "slackware" ]); then
-	echo >&2 "Unfortunately, $OS is not currently supported. Please post a patched version or reach out to Asterisk support."
-	echo "Try manually:"
+	echo >&2 "$0: Your distribution (Slackware) is currently not supported. Aborting. Try manually:"
 	# libedit requires a newer version than Slackware 14.2, for example Slackware-current
 	# or you build it manually: <http://thrysoee.dk/editline/>
-	echo >&2 "# slackpkg install make gcc pkg-config libedit util-linux sqlite libxml2 patch wget"
-
-	# Required for libjansson
-	echo >&2 "# ./contrib/scripts/install_prereq install-unpackaged"
-
-	# Exit!
+	echo >&2 "$0: # slackpkg install make gcc pkg-config libedit util-linux sqlite libxml2 patch wget"
+	# required for libjansson
+	echo >&2 "$0: # ./contrib/scripts/install_prereq install-unpackaged"
 	exit 1
 fi
 
 if [ "$unsupported_distro" != '' ]; then
-	echo "======================================"
-	echo >&2 "Unfortunately, $OS is not currently supported. Please post a patched version or reach out to Asterisk support."
-	echo "======================================"
-
-	# Exit!
+	echo >&2 "$0: Your distribution ($unsupported_distro) is currently not supported. Aborting."
 	exit 1
 fi
 
 # The distributions we do support:
 if [ -r /etc/debian_version ]; then
-	if [ -r /etc/linuxmint/info ]; then
-		# Alert user of OS detection
+	if [ -f /etc/linuxmint/info ]; then
+		echo "We've detected you're using Linux Mint. Welcome Minty one."
 		echo ""
-		echo "We've detected you're using Linux Mint. Linux Mint is currently not supported."
-		echo ""
-		echo "Patches welcome! This script will now exit."
+		handle_linuxmint
 	else
-		# Alert user of OS detection
-		echo ""
-		echo "We've detected you're using Debian...will install Debian packages...please wait..."
 		handle_debian
 	fi
 elif [ -r /etc/redhat-release ]; then
-	echo ""
-	echo "We've detected you're using Red Hat...will install Red Hat packages...please wait..."
 	handle_rh
 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then
-	echo ""
-	echo "We've detected you're using openSUSE...will install openSUSE packages...please wait..."
 	handle_SUSE
 elif [ -f /etc/os-release ] && . /etc/os-release && [ "$ID" = "opensuse" ]; then
-	echo ""
-	echo "We've detected you're using openSUSE...will install openSUSE packages...please wait..."
 	handle_SUSE
 elif [ -r /etc/arch-release ]; then
-	echo ""
-	echo "We've detected you're using Arch Linux...will install Arch Linux packages...please wait..."
 	handle_arch
 elif [ -f /etc/os-release ] && . /etc/os-release && [ "$ID_LIKE" = "archlinux" ]; then
-	echo ""
-	echo "We've detected you're using Arch Linux...will install Arch Linux packages...please wait..."
 	handle_arch # $ID=arch
 elif [ -f /etc/gentoo-release ]; then
-	echo ""
-	echo "We've detected you're using Gentoo...will install Gentoo packages...please wait..."
 	handle_gentoo
 elif [ -f /etc/os-release ] && . /etc/os-release && [ "$ID" = "gentoo" ]; then
-	echo ""
-	echo "We've detected you're using Gentoo...will install Gentoo packages...please wait..."
 	handle_gentoo
 elif [ "$OS" = 'NetBSD' ]; then
-	echo ""
-	echo "We've detected you're using $OS...will install $OS packages...please wait..."
 	handle_nbsd
 elif [ "$OS" = 'OpenBSD' ]; then
-	echo ""
-	echo "We've detected you're using $OS...will install $OS packages...please wait..."
 	handle_obsd
 elif [ "$OS" = 'FreeBSD' ]; then
-	echo ""
-	echo "We've detected you're using $OS...will install $OS packages...please wait..."
 	handle_fbsd
 elif [ "$OS" = 'DragonFly' ]; then
-	echo ""
-	echo "We've detected you're using $OS...will install $OS packages...please wait..."
 	handle_dbsd
 fi
 
-if ! [ in_test_mode ]; then
-	echo "======================================"
-	echo "$1 completed successfully."
-	echo ""
-	echo "Thanks for using this script!"
-	echo "You should be good to start installing Asterisk!"
-	echo "======================================"
-
-	exit 0
+if ! in_test_mode; then
+	echo "#############################################"
+	echo "## $1 completed successfully"
+	echo "#############################################"
 fi
-
-# ============================================
-# Main Program Logic - End
-# ============================================

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19974
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I9c140c7f12ca7dafe65c317f2a26122cf2c72556
Gerrit-Change-Number: 19974
Gerrit-PatchSet: 1
Gerrit-Owner: Martin McCarthy <martin.c.mccarthy at outlook.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20230316/008273b9/attachment-0001.html>


More information about the asterisk-code-review mailing list