|
2 | 2 |
|
3 | 3 | # PhreakScript
|
4 | 4 | # (C) 2021-2024 Naveen Albert, PhreakNet, and others - https://github.com/InterLinked1/phreakscript ; https://portal.phreaknet.org ; https://docs.phreaknet.org
|
5 |
| -# v1.1.6 (2024-09-16) |
| 5 | +# v1.1.7 (2024-09-19) |
6 | 6 |
|
7 | 7 | # Setup (as root):
|
8 | 8 | # cd /usr/local/src
|
|
13 | 13 | # phreaknet install
|
14 | 14 |
|
15 | 15 | ## Begin Change Log:
|
| 16 | +# 2024-09-19 1.1.7 DAHDI: Slipstream critical build fixes, fix build issues on various distros and kernels |
16 | 17 | # 2024-09-16 1.1.6 DAHDI: Add patch to enable building of XPP drivers on 32-bit architectures
|
17 | 18 | # 2024-09-15 1.1.5 DAHDI: Massive overhaul to DAHDI stop/start/restart logic, fixes for manual span assignment
|
18 | 19 | # 2024-09-11 1.1.4 DAHDI: Target DAHDI 3.4.0, update patches
|
@@ -228,10 +229,18 @@ PAC_MAN="apt-get"
|
228 | 229 | AST_SOUNDS_DIR="$AST_VARLIB_DIR/sounds/en"
|
229 | 230 | AST_MOH_DIR="$AST_VARLIB_DIR/moh"
|
230 | 231 | AST_MAKE="make"
|
231 |
| -WGET="wget -q --show-progress" |
| 232 | +WGET="wget -q" |
232 | 233 | XMLSTARLET="/usr/bin/xmlstarlet"
|
233 | 234 | PATH="/sbin:$PATH" # in case su used without path
|
234 | 235 |
|
| 236 | +# Wget2 does not support --show-progress, uses --force-progress instead |
| 237 | +WGET_VERSION=$( wget --version ) |
| 238 | +if [ "${WGET_VERSION#*"Wget2"}" != "$WGET_VERSION" ]; then |
| 239 | + WGET="$WGET --force-progress" |
| 240 | +else |
| 241 | + WGET="$WGET --show-progress" |
| 242 | +fi |
| 243 | + |
235 | 244 | # Defaults
|
236 | 245 | AST_CC=1 # Country Code (default: 1 - NANPA)
|
237 | 246 | AST_USER=""
|
@@ -805,6 +814,7 @@ make_keys_readable() {
|
805 | 814 | }
|
806 | 815 |
|
807 | 816 | install_prereq() {
|
| 817 | + printf "%s\n" "Installing prerequisites..." |
808 | 818 | if [ "$PAC_MAN" = "apt-get" ]; then
|
809 | 819 | # Ubuntu 22.04 prompts for restarts by default, inhibit this: https://askubuntu.com/questions/1367139/apt-get-upgrade-auto-restart-services
|
810 | 820 | if [ -f /etc/needrestart/needrestart.conf ]; then
|
@@ -836,7 +846,7 @@ install_prereq() {
|
836 | 846 | apt-get install -y debconf-utils
|
837 | 847 | apt-get -y autoremove
|
838 | 848 | elif [ "$PAC_MAN" = "yum" ]; then
|
839 |
| - yum install -y git patch |
| 849 | + yum install -y git patch subversion |
840 | 850 | # Stop on RHEL systems without an active subscription
|
841 | 851 | if ! which git > /dev/null; then
|
842 | 852 | if [ -f /etc/redhat-release ]; then
|
@@ -1417,15 +1427,23 @@ install_dahdi() {
|
1417 | 1427 | elif [ "$PAC_MAN" = "yum" ]; then
|
1418 | 1428 | dnf install -y m4 libtool automake autoconf kernel-devel kernel-headers
|
1419 | 1429 | dnf list installed 'kernel*'
|
1420 |
| - if [ -f /etc/redhat-release ]; then |
1421 |
| - # https://access.redhat.com/discussions/4656371?tour=8 |
1422 |
| - # Red Hat may install newer headers than the current system |
1423 |
| - dnf downgrade kernel-headers-$(uname -r) |
1424 |
| - ls -la /usr/src/kernels |
| 1430 | + # Fedora-based systems seem to have a newer kernel-devel present than the actual running kernel. |
| 1431 | + # This includes Red Hat, which may install newer headers than the current system: https://access.redhat.com/discussions/4656371?tour=8 |
| 1432 | + # Try to detect that and fix it. |
| 1433 | + KERNEL_DEVEL_VERSION=$( dnf list installed 'kernel-devel' | grep "kernel-devel" | xargs | cut -d' ' -f2 | cut -d'.' -f1-5 ) |
| 1434 | + kernel_ver=$( uname -r | cut -d'.' -f1-5 ) |
| 1435 | + if [ "$KERNEL_DEVEL_VERSION" != "$kernel_ver" ]; then |
| 1436 | + echoerr "kernel-devel mismatch has been detected. Package provides $KERNEL_DEVEL_VERSION, but running kernel is $kernel_ver" |
| 1437 | + echoerr "Installing specific kernel-devel package to match..." |
| 1438 | + dnf install -y kernel-devel-$(uname -r) |
| 1439 | + rpm -qa | grep kernel |
| 1440 | + KERNEL_DEVEL_VERSION=$( dnf list installed 'kernel-devel' | grep "kernel-devel" | xargs | cut -d' ' -f2 | cut -d'.' -f1-5 ) |
| 1441 | + if [ "$KERNEL_DEVEL_VERSION" != "$kernel_ver" ]; then |
| 1442 | + echoerr "kernel-devel mismatch still present?" |
| 1443 | + fi |
| 1444 | + else |
| 1445 | + echog "kernel-devel is matched with kernel. Package provides $KERNEL_DEVEL_VERSION, and running kernel is $kernel_ver" |
1425 | 1446 | fi
|
1426 |
| - #dnf install -y kernel-headers-$(uname -r) |
1427 |
| - dnf list installed | grep kernel-headers |
1428 |
| - rpm -qa | grep kernel |
1429 | 1447 | else
|
1430 | 1448 | echoerr "Unable to install potential DAHDI prerequisites"
|
1431 | 1449 | sleep 2
|
@@ -1519,7 +1537,12 @@ install_dahdi() {
|
1519 | 1537 | fi
|
1520 | 1538 |
|
1521 | 1539 | # Merged in master, but not yet in a current release
|
1522 |
| - git_custom_patch "https://github.com/asterisk/dahdi-linux/commit/d932d9fbc8b3559829a76fffcedceb78d1fc1887.diff" |
| 1540 | + git_custom_patch "https://github.com/asterisk/dahdi-linux/commit/d7bbc8a96fe767bc4eee15dd43170f298282a4c3.diff" # RHEL fixes for const struct device *dev |
| 1541 | + git_custom_patch "https://github.com/asterisk/dahdi-linux/commit/d932d9fbc8b3559829a76fffcedceb78d1fc1887.diff" # dahdi_spantype fix |
| 1542 | + |
| 1543 | + # Not yet merged |
| 1544 | + git_custom_patch "https://patch-diff.githubusercontent.com/raw/asterisk/dahdi-linux/pull/57.diff" # PR 57: RHEL build fixes |
| 1545 | + git_custom_patch "https://patch-diff.githubusercontent.com/raw/asterisk/dahdi-linux/pull/58.diff" # PR 58: non-RHEL build fixes for older kernels |
1523 | 1546 |
|
1524 | 1547 | KERN_VER_MM=$( uname -r | cut -d. -f1-2 )
|
1525 | 1548 | OS_DIST_2=$( printf "$OS_DIST_INFO" | cut -d' ' -f1-2)
|
@@ -1578,6 +1601,13 @@ install_dahdi() {
|
1578 | 1601 | grep "WGET" drivers/dahdi/firmware/Makefile
|
1579 | 1602 | fi
|
1580 | 1603 |
|
| 1604 | + if [ "$DAHDI_OLD_DRIVERS" = "1" ]; then |
| 1605 | + # For some reason, tor2 won't compile on older kernels due to missing target for "makefw" |
| 1606 | + # But if we compile it by its full name first, that takes care of that |
| 1607 | + # TODO BUGBUG This is a build order bug that should be addressed in the build system |
| 1608 | + make $AST_SOURCE_PARENT_DIR/$DAHDI_LIN_SRC_DIR/drivers/dahdi/makefw $DAHDI_CFLAGS |
| 1609 | + fi |
| 1610 | + |
1581 | 1611 | make -j$(nproc) $DAHDI_CFLAGS
|
1582 | 1612 | if [ $? -ne 0 ]; then
|
1583 | 1613 | echoerr "DAHDI Linux compilation failed, aborting install"
|
@@ -2833,7 +2863,6 @@ elif [ "$cmd" = "install" ]; then
|
2833 | 2863 | # Install Pre-Reqs
|
2834 | 2864 | printf "%s %d\n" "Starting installation with country code" $AST_CC
|
2835 | 2865 | quell_mysql
|
2836 |
| - printf "%s\n" "Installing prerequisites..." |
2837 | 2866 | install_prereq # This must be done before any other packages are installed since we'll skip package install checks if package manager was used recently.
|
2838 | 2867 | if [ "$DEVMODE" = "1" ]; then
|
2839 | 2868 | # Install the Linux headers if we can, but don't abort if we can't.
|
@@ -3204,6 +3233,7 @@ elif [ "$cmd" = "freepbx" ]; then
|
3204 | 3233 | install_freepbx
|
3205 | 3234 | elif [ "$cmd" = "dahdi" ]; then
|
3206 | 3235 | assert_root
|
| 3236 | + install_prereq # Install basic build requirements |
3207 | 3237 | install_dahdi
|
3208 | 3238 | elif [ "$cmd" = "wanpipe" ]; then
|
3209 | 3239 | assert_root
|
|
0 commit comments