Skip to content

Commit

Permalink
install: Fix release candidate logic.
Browse files Browse the repository at this point in the history
Fix logic to work properly when a 2nd release candidate
has been released.
  • Loading branch information
InterLinked1 committed Jan 19, 2024
1 parent 9d7ad7d commit 300e3ef
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions phreaknet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ AST_SOURCE_NAME="asterisk-${AST_DEFAULT_MAJOR_VER}-current"
# This was meant to be -testing, but ended up being -testing-rc#,
# if this is fixed, this will need to be adjusted accordingly.
AST_RC_SOURCE_NAME="asterisk-${AST_DEFAULT_MAJOR_VER}-testing-rc1"
AST_RC_SOURCE_NAME2="asterisk-${AST_DEFAULT_MAJOR_VER}-testing-rc2"

DAHDI_VERSION="3.2.0"
DAHLIN_SRC_NAME="dahdi-linux-current.tar.gz"
Expand Down Expand Up @@ -2045,12 +2046,21 @@ get_source() {
rm -f $EFF_SOURCE_NAME.tar.gz # the name itself doesn't guarantee that the version is the same
if [ "$AST_ALT_VER" = "" ]; then # download latest bundled version
if [ "$PREFER_RELEASE_CANDIDATES" = "1" ]; then
EFF_SOURCE_NAME=$AST_RC_SOURCE_NAME
rm -f $EFF_SOURCE_NAME.tar.gz # the name itself doesn't guarantee that the version is the same
# Delete any previous release candidates
rm -f $AST_RC_SOURCE_NAME.tar.gz $AST_RC_SOURCE_NAME2.tar.gz # the name itself doesn't guarantee that the version is the same
$WGET https://downloads.asterisk.org/pub/telephony/asterisk/$AST_RC_SOURCE_NAME.tar.gz
if [ $? -ne 0 ]; then
if [ ! -f $AST_RC_SOURCE_NAME.tar.gz ]; then
# XXX This is a workaround for the -testing tarballs including the rc name (which wasn't the intent)
# Look for a 2nd RC if there is one.
# Very rarely there may be a 3rd one, and this is not yet handled here.
AST_RC_SOURCE_NAME="$AST_RC_SOURCE_NAME2"
$WGET https://downloads.asterisk.org/pub/telephony/asterisk/$AST_RC_SOURCE_NAME.tar.gz
fi
if [ ! -f $AST_RC_SOURCE_NAME.tar.gz ]; then
printf "No release candidate is currently available, installing latest stable version instead\n"
PREFER_RELEASE_CANDIDATES=0
else
EFF_SOURCE_NAME=$AST_RC_SOURCE_NAME
fi
fi
if [ "$PREFER_RELEASE_CANDIDATES" = "0" ]; then
Expand Down Expand Up @@ -2115,7 +2125,10 @@ get_source() {
minor=`echo $ver | cut -d'.' -f2`
patch=`echo $ver | cut -d'.' -f3`
AST_MM_VER=`printf "%02d%02d%02d" "$major" "$minor" "$patch"`
printf "Asterisk MMmmPP: %s\n", "$AST_MM_VER"
printf "Asterisk MMmmPP: %s\n" "$AST_MM_VER"
fi
if [ "$AST_SRC_DIR" = "" ]; then
die "No Asterisk source directory available, aborting..."
fi
printf "%s\n" "Installing production version $AST_SRC_DIR..."
if [ "$AST_ALT_VER" != "git" ]; then
Expand Down

0 comments on commit 300e3ef

Please sign in to comment.