Skip to content

Commit 7012507

Browse files
committed
install: Make wget ignore IPv6 addresses if IPv6 is disabled.
GitHub Action runners do not support IPv6, so this causes builds to fail occasionally if wget attempts to use IPv6 addresses to download the DAHDI firmware tarballs. This tries to detect a lack of IPv6 support and explicitly disable it for downloads to avoid that.
1 parent 8fda738 commit 7012507

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
run: |
2727
cd /usr/src
2828
sudo apt-get update -y
29-
sudo apt-get install -y wget
29+
sudo apt-get install -y wget procps
3030
sudo wget https://raw.githubusercontent.com/InterLinked1/phreakscript/master/phreaknet.sh
3131
sudo chmod +x phreaknet.sh
3232
sudo ./phreaknet.sh make
@@ -40,7 +40,7 @@ jobs:
4040
run: |
4141
cd /usr/src/
4242
apt-get update -y
43-
apt-get install -y wget
43+
apt-get install -y wget procps
4444
wget https://raw.githubusercontent.com/InterLinked1/phreakscript/master/phreaknet.sh
4545
chmod +x phreaknet.sh
4646
./phreaknet.sh make
@@ -54,7 +54,7 @@ jobs:
5454
run: |
5555
cd /usr/src
5656
apt-get update -y
57-
apt-get install -y wget
57+
apt-get install -y wget procps
5858
wget https://raw.githubusercontent.com/InterLinked1/phreakscript/master/phreaknet.sh
5959
chmod +x phreaknet.sh
6060
./phreaknet.sh make
@@ -68,7 +68,7 @@ jobs:
6868
run: |
6969
cd /usr/src
7070
apt-get update -y
71-
apt-get install -y wget
71+
apt-get install -y wget procps
7272
wget https://raw.githubusercontent.com/InterLinked1/phreakscript/master/phreaknet.sh
7373
chmod +x phreaknet.sh
7474
./phreaknet.sh make

phreaknet.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,17 @@ install_dahdi() {
13491349
sleep 2
13501350
fi
13511351

1352+
# Requests to downloads.digium.com usually use IPv4, but sometimes use IPv6
1353+
# This is problematic on GitHub Action Runners, which have IPv6 disabled,
1354+
# and won't let you enable it
1355+
IPV6_DISABLED=0
1356+
if which sysctl > /dev/null; then
1357+
# See https://github.com/asterisk/asterisk-ci-actions/blob/main/SetupUbuntuRunner/action.yml
1358+
printf "IPv6 Disabled: "
1359+
sysctl net.ipv6.conf.all.disable_ipv6
1360+
IPV6_DISABLED=$( sysctl net.ipv6.conf.all.disable_ipv6 | cut -d '=' -f2 | xargs | tr -d '\n' )
1361+
fi
1362+
13521363
# Check that the kernel sources are really present
13531364
# /usr/src/linux-headers-* on Debian
13541365
# /usr/src/kernels on Rocky Linux
@@ -1458,6 +1469,14 @@ install_dahdi() {
14581469
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
14591470
fi
14601471

1472+
# If IPv6 is disabled, force wget downloads to use the IPv4 address
1473+
# Could also use --prefer-family, but is IPv6 is disabled, we have to use IPv4 anyways
1474+
if [ "$IPV6_DISABLED" = "1" ]; then
1475+
echoerr "IPv6 is disabled, forcing driver downloads to use only IPv4..."
1476+
sed -i 's/WGET_ARGS:=--continue/WGET_ARGS:=--inet4-only --continue/g' drivers/dahdi/firmware/Makefile
1477+
grep "WGET" drivers/dahdi/firmware/Makefile
1478+
fi
1479+
14611480
make -j$(nproc) $DAHDI_CFLAGS
14621481
if [ $? -ne 0 ]; then
14631482
echoerr "DAHDI Linux compilation failed, aborting install"
@@ -2490,7 +2509,7 @@ if which curl > /dev/null; then # only execute if we have curl
24902509
# Only download the first few lines of the file, to get the latest version number, and only check every so often
24912510
recent=$( find /tmp/phreaknet_upstream_version.txt -mmin -720 2>/dev/null | wc -l )
24922511
if [ "$recent" != "1" ]; then
2493-
printf " *** Checking if a more recent version is available..."
2512+
printf " *** Checking if a higher numbered version is available..."
24942513
curl --silent https://raw.githubusercontent.com/InterLinked1/phreakscript/master/phreaknet.sh -r 0-210 > /tmp/phreaknet_upstream_version.txt
24952514
# Compare current version with latest upstream version
24962515
upstream=`grep -m1 "# v" /tmp/phreaknet_upstream_version.txt | cut -d'v' -f2`

0 commit comments

Comments
 (0)