From bbefe9f6fa1dc48faf06cc3a03cd739e78c190e2 Mon Sep 17 00:00:00 2001 From: InterLinked1 <24227567+InterLinked1@users.noreply.github.com> Date: Thu, 23 Jan 2025 18:06:26 -0500 Subject: [PATCH] install: Target Asterisk 22.2.0. --- .github/workflows/main.yml | 2 +- patches/sms.diff | 15 ++++++++++++ phreaknet.sh | 50 +++++++++++++++++++++----------------- 3 files changed, 44 insertions(+), 23 deletions(-) create mode 100644 patches/sms.diff diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e259732..5a559cf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,7 +2,7 @@ name: CI on: push: - branches: [ master ] + branches: [ master, dev ] pull_request: branches: [ master ] # Retest weekly to ensure nothing has broken diff --git a/patches/sms.diff b/patches/sms.diff new file mode 100644 index 0000000..3f78368 --- /dev/null +++ b/patches/sms.diff @@ -0,0 +1,15 @@ +diff --git a/apps/app_sms.c b/apps/app_sms.c +index e02e82287e..dfae5108e0 100644 +--- a/apps/app_sms.c ++++ b/apps/app_sms.c +@@ -467,7 +467,10 @@ static int packsms8(unsigned char *o, int udhl, unsigned char *udh, int udl, uns + if (u < 0 || u > 0xFF) { + return -1; /* not valid */ + } ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wstringop-overflow" + o[p++] = u; ++#pragma GCC diagnostic pop + if (p >= SMSLEN_8) { + return p; + } diff --git a/phreaknet.sh b/phreaknet.sh index 9a714f4..bc6d40a 100755 --- a/phreaknet.sh +++ b/phreaknet.sh @@ -1,8 +1,8 @@ #!/bin/sh # PhreakScript -# (C) 2021-2024 Naveen Albert, PhreakNet, and others - https://github.com/InterLinked1/phreakscript ; https://portal.phreaknet.org ; https://docs.phreaknet.org -# v1.2.1 (2024-12-30) +# (C) 2021-2025 Naveen Albert, PhreakNet, and others - https://github.com/InterLinked1/phreakscript ; https://portal.phreaknet.org ; https://docs.phreaknet.org +# v1.2.2 (2025-01-23) # Setup (as root): # cd /usr/local/src @@ -13,6 +13,7 @@ # phreaknet install ## Begin Change Log: +# 2025-01-23 1.2.2 Asterisk: Target 22.2.0 # 2024-12-30 1.2.1 DAHDI Linux: Work around compilation failure for newer kernels # 2024-11-03 1.2.0 Asterisk: Install Asterisk 22 by default # 2024-10-16 1.1.8 wanpipe: Installation procedure improvements @@ -1493,24 +1494,26 @@ github_pr() { # $2 = 1 to force asterisk_pr() { - wget -q "https://patch-diff.githubusercontent.com/raw/asterisk/asterisk/pull/$1.diff" -O /tmp/$1.pr.diff --no-cache + PR_PATCH_FILE=/tmp/$1.pr.diff + wget -q "https://patch-diff.githubusercontent.com/raw/asterisk/asterisk/pull/$1.diff" -O $PR_PATCH_FILE --no-cache if [ $? -ne 0 ]; then echoerr "Failed to download https://patch-diff.githubusercontent.com/raw/asterisk/asterisk/pull/$1.diff" fi if [ "$2" = "1" ]; then - git apply -v "/tmp/$1.pr.diff" + git apply -v $PR_PATCH_FILE if [ $? -ne 0 ]; then echoerr "Failed to apply patch using git apply, retrying directly using patch..." - patch -p1 -F 3 -f --verbose < "/tmp/$1.pr.diff" + patch -p1 -F 3 -f --verbose < $PR_PATCH_FILE fi else - git apply "/tmp/$1.pr.diff" + git apply $PR_PATCH_FILE fi if [ $? -ne 0 ]; then echoerr "Failed to apply Asterisk PR... this should be reported..." + cat $PR_PATCH_FILE exit 2 fi - rm "/tmp/$1.pr.diff" + rm $PR_PATCH_FILE } git_custom_patch() { @@ -1888,15 +1891,15 @@ install_dahdi() { git_custom_patch "https://patch-diff.githubusercontent.com/raw/asterisk/dahdi-linux/pull/32.patch" # PR 32: xpp: Fix 32-bit builds # Fix or skip compilation of the XPP driver for 32-bit - OS_ARCH=$( uname -m ) - printf "Detected architecture: %s\n" "$OS_ARCH" - if [ "$OS_ARCH" = "armv7l" ]; then + # OS_ARCH=$( uname -m ) + # printf "Detected architecture: %s\n" "$OS_ARCH" + #if [ "$OS_ARCH" = "armv7l" ]; then # I can't test this build at the moment, so to play it safe, I'm going to keep it disabled in this case, # given that the xpp drivers are seldom used and especially unlikely to be used by someone with this architecture. # TODO Slightly related, once GitHub allows free arm64 builds, do more testing: https://github.com/orgs/community/discussions/19197 - echoerr "Skipping compilation of XPP driver for this 32-bit architecture! ($OS_ARCH)" - mv $AST_SOURCE_PARENT_DIR/$DAHDI_LIN_SRC_DIR/drivers/dahdi/xpp/Kbuild $AST_SOURCE_PARENT_DIR/$DAHDI_LIN_SRC_DIR/drivers/dahdi/xpp/Bad-Kbuild - fi + #echoerr "Skipping compilation of XPP driver for this 32-bit architecture! ($OS_ARCH)" + #mv $AST_SOURCE_PARENT_DIR/$DAHDI_LIN_SRC_DIR/drivers/dahdi/xpp/Kbuild $AST_SOURCE_PARENT_DIR/$DAHDI_LIN_SRC_DIR/drivers/dahdi/xpp/Bad-Kbuild + #fi KERN_VER_MM=$( uname -r | cut -d. -f1-2 ) OS_DIST_2=$( printf "$OS_DIST_INFO" | cut -d' ' -f1-2) @@ -2355,17 +2358,18 @@ phreak_patches() { # $1 = $PATCH_DIR, $2 = $AST_SRC_DIR asterisk_pr_if 961 220200 210700 201200 182700 # config.c: fix template inheritance/overrides asterisk_pr_if 994 220200 210700 201200 182700 # FGD regression fix asterisk_pr_if 245 220200 210700 201200 182700 # config.c: fix template inheritance/overrides + asterisk_pr_if 971 220200 210700 201200 182700 # config.c fix issues w/ whitespace in comments asterisk_pr_if 414 220200 210700 201200 182700 # IAX2 loopback warning asterisk_pr_if 1030 220200 210700 201200 182700 # chan_dahdi: Fix wrong channel state when RINGING recieved + asterisk_pr_if 1055 220200 210700 201200 182700 # chan_iax2: Avoid unnecessarily backlogging frames + #asterisk_pr_if 918 220200 210700 201200 182700 # config.c #tryinclude fixes. Temporarily disabled since patch fails to apply: main/config.c:2750 + #asterisk_pr_if 438 220200 210700 201200 182700 # Last Number Redial. This now conflicts with 272, so temp. disabled. ## Unmerged patches: remove or switch to asterisk_pr_if once merged - #asterisk_pr_unconditional 918 # config.c #tryinclude fixes. Temporarily disabled since patch fails to apply: main/config.c:2750 - asterisk_pr_unconditional 971 # config.c fix issues w/ whitespace in comments - asterisk_pr_unconditional 1055 # chan_iax2: Avoid unnecessarily backlogging frames - + asterisk_pr_unconditional 1086 # Fix for Fedora 42 (old style definitions for libdb) + git_custom_patch "https://raw.githubusercontent.com/InterLinked1/phreakscript/refs/heads/dev/patches/sms.diff" #asterisk_pr_unconditional 272 # Call Waiting Deluxe. This also now conflicts (with the latest revisions), so temp. disabled. - #asterisk_pr_unconditional 438 # Last Number Redial. This now conflicts with 272, so temp. disabled. - asterisk_pr_unconditional 292 # GROUP VARs + #asterisk_pr_unconditional 292 # GROUP VARs # Disabled temporarily as patch does not apply anymore git_custom_patch "https://code.phreaknet.org/asterisk/dahdicleanup.diff" if [ $AST_MAJOR_VER -lt 21 ]; then @@ -3405,9 +3409,11 @@ elif [ "$cmd" = "install" ]; then fi if [ $? -ne 0 ]; then - $AST_MAKE NOISY_BUILD=1 # show actual compilation command that failed - if [ ! -f channels/chan_dahdi.o ]; then - echoerr "Compilation of chan_dahdi failed?" + gcc -v + $AST_MAKE # Finish compiling antyhing that would build successfully, from the parallel build, so the noisy build only builds the offending target + $AST_MAKE NOISY_BUILD=1 # show actual compilation command that failed, with no parallelism + if [ -f channels/chan_audiosocket.o ] && [ ! -f channels/chan_dahdi.o ]; then + echoerr "Compilation of chan_dahdi failed?" # Only suggest this if we got around to compiling some channel drivers to begin with ls -la /usr/include/dahdi # Debug failed chan_dahdi compilation # chan_dahdi.c:7677:18: error: unused variable 'x' [-Werror=unused-variable]