Skip to content

Commit 2c33640

Browse files
authored
install: Ensure that dahdi_tool is always built. (#47)
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
1 parent 954bd7d commit 2c33640

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

phreaknet.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -912,8 +912,9 @@ install_prereq() {
912912
PREREQ_PACKAGES=""
913913
RHEL_MAJOR_VERSION_8=0
914914
printf "Installing prerequisites for %s..." "$OS_DIST_INFO"
915+
# libnewt-dev is needed for newt, which dahdi_tool requires. If it's not available, it won't get built.
915916
if [ "$PAC_MAN" = "apt-get" ]; then
916-
PREREQ_PACKAGES="$PREREQ_PACKAGES git patch gcc pkg-config autoconf automake m4 libtool build-essential"
917+
PREREQ_PACKAGES="$PREREQ_PACKAGES git patch gcc pkg-config autoconf automake m4 libtool build-essential libnewt-dev"
917918
if [ "$1" = "1" ]; then
918919
PREREQ_PACKAGES="$PREREQ_PACKAGES curl subversion libcurl4-openssl-dev"
919920
if [ "$ENHANCED_INSTALL" = "1" ]; then
@@ -932,26 +933,26 @@ install_prereq() {
932933
if [ -f /etc/redhat-release ] && [ "$RHEL_MAJOR_VERSION" = "8" ]; then # RHEL or Rocky Linux major version 8
933934
RHEL_MAJOR_VERSION_8=1
934935
fi
935-
PREREQ_PACKAGES="$PREREQ_PACKAGES git patch gcc gcc-c++ pkg-config autoconf automake m4 libtool"
936+
PREREQ_PACKAGES="$PREREQ_PACKAGES git patch gcc gcc-c++ pkg-config autoconf automake m4 libtool newt-devel"
936937
if [ "$1" = "1" ]; then
937938
PREREQ_PACKAGES="$PREREQ_PACKAGES subversion libuuid-devel libxml2-devel sqlite-devel"
938939
if [ $RHEL_MAJOR_VERSION_8 -eq 0 ]; then
939940
PREREQ_PACKAGES="$PREREQ_PACKAGES libedit-devel" # Required on Fedora, may fail initially on Rocky Linux 8.9
940941
fi
941942
fi
942943
elif [ "$PAC_MAN" = "zypper" ]; then
943-
PREREQ_PACKAGES="$PREREQ_PACKAGES git-core make patch gawk subversion bzip2 gcc-c++"
944+
PREREQ_PACKAGES="$PREREQ_PACKAGES git-core make patch gawk subversion bzip2 gcc-c++ newt-devel"
944945
if [ "$1" = "1" ]; then
945946
# TODO Some of these should be in Asterisk's install_prereq script
946947
PREREQ_PACKAGES="$PREREQ_PACKAGES libedit-devel libuuid-devel libxml2-devel sqlite3-devel"
947948
fi
948949
elif [ "$PAC_MAN" = "pacman" ]; then
949-
PREREQ_PACKAGES="$PREREQ_PACKAGES git make patch gcc pkg-config autoconf automake m4 libtool"
950+
PREREQ_PACKAGES="$PREREQ_PACKAGES git make patch gcc pkg-config autoconf automake m4 libtool libnewt"
950951
if [ "$1" = "1" ]; then
951952
PREREQ_PACKAGES="$PREREQ_PACKAGES subversion libedit"
952953
fi
953954
elif [ "$PAC_MAN" = "pkg" ]; then
954-
PREREQ_PACKAGES="$PREREQ_PACKAGES git gmake"
955+
PREREQ_PACKAGES="$PREREQ_PACKAGES git gmake newt"
955956
if [ "$1" = "1" ]; then
956957
PREREQ_PACKAGES="$PREREQ_PACKAGES curl subversion e2fsprogs-libuuid sqlite3 xmlstarlet libsysinfo"
957958
if [ "$ENHANCED_INSTALL" = "1" ]; then
@@ -1876,6 +1877,15 @@ install_dahdi() {
18761877
cp tonezone.h /usr/include/dahdi
18771878
fi
18781879

1880+
# Ensure that dahdi_tool is installed, since it's not built if the prereqs weren't available at compile time.
1881+
if ! which "dahdi_tool" > /dev/null; then
1882+
echoerr "dahdi_tool does not appear to have been built successfully... newt development package missing?"
1883+
if [ "$FORCE_INSTALL" != "1" ] && [ "$PAC_MAN" != "pacman" ]; then
1884+
# Even though we successfully install the newt dev package on Arch Linux, for some reason this still fails, so don't make it fatal on Arch
1885+
exit 1
1886+
fi
1887+
fi
1888+
18791889
# All right, here we go...
18801890
dahdi_scan -vvvvv
18811891
if [ ! -f /etc/dahdi/system.conf ]; then

0 commit comments

Comments
 (0)