Skip to content

Commit

Permalink
install: Ensure that dahdi_tool is always built.
Browse files Browse the repository at this point in the history
dahdi_tool requires the newt development packages, which
were installed when Asterisk was installed, but not when
DAHDI was installed. This meant dahdi_tool wouldn't be
built the first time DAHDI was compiled on a new system,
but it would be on future compilations. To ensure it's
always built, explicitly install the newt development
dependencies before compiling DAHDI Tools. Also, verify
that dahdi_tool has been built and fail the build if not.

PHREAKSCRIPT-55 #close
  • Loading branch information
InterLinked1 committed Nov 3, 2024
1 parent 954bd7d commit 36c6535
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions phreaknet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -912,8 +912,9 @@ install_prereq() {
PREREQ_PACKAGES=""
RHEL_MAJOR_VERSION_8=0
printf "Installing prerequisites for %s..." "$OS_DIST_INFO"
# libnewt-dev is needed for newt, which dahdi_tool requires. If it's not available, it won't get built.
if [ "$PAC_MAN" = "apt-get" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES git patch gcc pkg-config autoconf automake m4 libtool build-essential"
PREREQ_PACKAGES="$PREREQ_PACKAGES git patch gcc pkg-config autoconf automake m4 libtool build-essential libnewt-dev"
if [ "$1" = "1" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES curl subversion libcurl4-openssl-dev"
if [ "$ENHANCED_INSTALL" = "1" ]; then
Expand All @@ -932,26 +933,26 @@ install_prereq() {
if [ -f /etc/redhat-release ] && [ "$RHEL_MAJOR_VERSION" = "8" ]; then # RHEL or Rocky Linux major version 8
RHEL_MAJOR_VERSION_8=1
fi
PREREQ_PACKAGES="$PREREQ_PACKAGES git patch gcc gcc-c++ pkg-config autoconf automake m4 libtool"
PREREQ_PACKAGES="$PREREQ_PACKAGES git patch gcc gcc-c++ pkg-config autoconf automake m4 libtool libnewt-devel"
if [ "$1" = "1" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES subversion libuuid-devel libxml2-devel sqlite-devel"
if [ $RHEL_MAJOR_VERSION_8 -eq 0 ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES libedit-devel" # Required on Fedora, may fail initially on Rocky Linux 8.9
fi
fi
elif [ "$PAC_MAN" = "zypper" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES git-core make patch gawk subversion bzip2 gcc-c++"
PREREQ_PACKAGES="$PREREQ_PACKAGES git-core make patch gawk subversion bzip2 gcc-c++ newt-devel"
if [ "$1" = "1" ]; then
# TODO Some of these should be in Asterisk's install_prereq script
PREREQ_PACKAGES="$PREREQ_PACKAGES libedit-devel libuuid-devel libxml2-devel sqlite3-devel"
fi
elif [ "$PAC_MAN" = "pacman" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES git make patch gcc pkg-config autoconf automake m4 libtool"
PREREQ_PACKAGES="$PREREQ_PACKAGES git make patch gcc pkg-config autoconf automake m4 libtool libnewt"
if [ "$1" = "1" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES subversion libedit"
fi
elif [ "$PAC_MAN" = "pkg" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES git gmake"
PREREQ_PACKAGES="$PREREQ_PACKAGES git gmake newt"
if [ "$1" = "1" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES curl subversion e2fsprogs-libuuid sqlite3 xmlstarlet libsysinfo"
if [ "$ENHANCED_INSTALL" = "1" ]; then
Expand Down Expand Up @@ -1876,6 +1877,13 @@ install_dahdi() {
cp tonezone.h /usr/include/dahdi
fi

# Ensure that dahdi_tool is installed, since it's not built if the prereqs weren't available at compile time.
if ! which "dahdi_tool" > /dev/null; then
if [ "$FORCE_INSTALL" != "1" ]; then
die "dahdi_tool does not appear to have been built successfully... newt development package missing?"
fi
fi

# All right, here we go...
dahdi_scan -vvvvv
if [ ! -f /etc/dahdi/system.conf ]; then
Expand Down

0 comments on commit 36c6535

Please sign in to comment.