Skip to content

Commit

Permalink
install: Make wget ignore IPv6 addresses if IPv6 is disabled.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
InterLinked1 committed Mar 23, 2024
1 parent 8fda738 commit ab02f78
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: |
cd /usr/src
sudo apt-get update -y
sudo apt-get install -y wget
sudo apt-get install -y wget procps
sudo wget https://raw.githubusercontent.com/InterLinked1/phreakscript/master/phreaknet.sh
sudo chmod +x phreaknet.sh
sudo ./phreaknet.sh make
Expand All @@ -40,7 +40,7 @@ jobs:
run: |
cd /usr/src/
apt-get update -y
apt-get install -y wget
apt-get install -y wget procps
wget https://raw.githubusercontent.com/InterLinked1/phreakscript/master/phreaknet.sh
chmod +x phreaknet.sh
./phreaknet.sh make
Expand All @@ -54,7 +54,7 @@ jobs:
run: |
cd /usr/src
apt-get update -y
apt-get install -y wget
apt-get install -y wget procps
wget https://raw.githubusercontent.com/InterLinked1/phreakscript/master/phreaknet.sh
chmod +x phreaknet.sh
./phreaknet.sh make
Expand All @@ -68,7 +68,7 @@ jobs:
run: |
cd /usr/src
apt-get update -y
apt-get install -y wget
apt-get install -y wget procps
wget https://raw.githubusercontent.com/InterLinked1/phreakscript/master/phreaknet.sh
chmod +x phreaknet.sh
./phreaknet.sh make
Expand Down
23 changes: 22 additions & 1 deletion phreaknet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1349,6 +1349,19 @@ install_dahdi() {
sleep 2
fi

# Requests to downloads.digium.com usually use IPv4, but sometimes use IPv6
# This is problematic on GitHub Action Runners, which have IPv6 disabled,
# and won't let you enable it
IPV6_DISABLED=0
if which sysctl > /dev/null; then
# See https://github.com/asterisk/asterisk-ci-actions/blob/main/SetupUbuntuRunner/action.yml
printf "IPv6 Disabled: "
sysctl net.ipv6.conf.all.disable_ipv6
IPV6_DISABLED=$( sysctl net.ipv6.conf.all.disable_ipv6 | cut -d '=' -f2 | xargs | tr -d '\n' )
fi

/sys/module/ipv6/parameters/disable

# Check that the kernel sources are really present
# /usr/src/linux-headers-* on Debian
# /usr/src/kernels on Rocky Linux
Expand Down Expand Up @@ -1458,6 +1471,14 @@ install_dahdi() {
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

# If IPv6 is disabled, force wget downloads to use the IPv4 address
# Could also use --prefer-family, but is IPv6 is disabled, we have to use IPv4 anyways
if [ "$IPV6_DISABLED" = "1" ]; then
echoerr "IPv6 is disabled, forcing driver downloads to use only IPv4..."
sed -i 's/WGET_ARGS:=--continue/WGET_ARGS:=--inet4-only --continue/g' drivers/dahdi/firmware/Makefile
grep "WGET" drivers/dahdi/firmware/Makefile
fi

make -j$(nproc) $DAHDI_CFLAGS
if [ $? -ne 0 ]; then
echoerr "DAHDI Linux compilation failed, aborting install"
Expand Down Expand Up @@ -2490,7 +2511,7 @@ if which curl > /dev/null; then # only execute if we have curl
# Only download the first few lines of the file, to get the latest version number, and only check every so often
recent=$( find /tmp/phreaknet_upstream_version.txt -mmin -720 2>/dev/null | wc -l )
if [ "$recent" != "1" ]; then
printf " *** Checking if a more recent version is available..."
printf " *** Checking if a higher numbered version is available..."
curl --silent https://raw.githubusercontent.com/InterLinked1/phreakscript/master/phreaknet.sh -r 0-210 > /tmp/phreaknet_upstream_version.txt
# Compare current version with latest upstream version
upstream=`grep -m1 "# v" /tmp/phreaknet_upstream_version.txt | cut -d'v' -f2`
Expand Down

0 comments on commit ab02f78

Please sign in to comment.