BIG-IP F5 wonky version string (EA to translate to semantic version string)

donmontalvo
Esteemed Contributor III

F5 Networks uses a wonky version string like:

$ /usr/bin/defaults read /Applications/BIG-IP Edge Client.app/Contents/Info.plist CFBundleVersion
XXXX.XXXX.XXXX.X

8cb03c9b23764d74a9296f6556cf9fc5

We need to get an actual version number, based on K13757: BIG-IP Edge Client version matrix.

Using the chart, we can translate the first octet in their wonky version string into a usable proper version string.

#!/bin/sh
# Translate F5 Networks' string for actual usable version based on vendor matrix:
#
#   K13757: BIG-IP Edge Client version matrix
#   https://support.f5.com/csp/article/K13757
#
# Translate F5 Networks' string for actual usable version. 20180601 DM

application=/Applications/BIG-IP Edge Client.app

if  [[ -e $application ]]; then
    stringOld=$( /usr/bin/defaults read /Applications/BIG-IP Edge Client.app/Contents/Info CFBundleVersion | cut -f1 -d"." )
    if [ $stringOld -eq 7150 ]; then
        echo "<result>"13.1.0"</result>"
    elif [ $stringOld -eq 7140 ]; then
        echo "<result>"13.0.1"</result>"
    elif [ $stringOld -eq 7140 ]; then
        echo "<result>"13.0.0"</result>"
    elif [ $stringOld -eq 7133 ]; then
        echo "<result>"12.1.3"</result>"
    elif [ $stringOld -eq 7132 ]; then
        echo "<result>"12.1.2"</result>"
    elif [ $stringOld -eq 7131 ]; then
        echo "<result>"12.1.1"</result>"
    elif [ $stringOld -eq 7130 ]; then
        echo "<result>"12.1.0"</result>"
    elif [ $stringOld -eq 7120 ]; then
        echo "<result>"12.0.0"</result>"
    elif [ $stringOld -eq 7112 ]; then
        echo "<result>"11.6.2"</result>"
    elif [ $stringOld -eq 7111 ]; then
        echo "<result>"11.6.1"</result>"
    elif [ $stringOld -eq 7110 ]; then
        echo "<result>"11.6.0"</result>"
    elif [ $stringOld -eq 7105 ]; then
        echo "<result>"11.5.5"</result>"
    elif [ $stringOld -eq 7104 ]; then
        echo "<result>"11.5.4"</result>"
    elif [ $stringOld -eq 7103 ]; then
        echo "<result>"11.5.3"</result>"
    elif [ $stringOld -eq 7102 ]; then
        echo "<result>"11.5.2"</result>"
    elif [ $stringOld -eq 7101 ]; then
        echo "<result>"11.5.1"</result>"
    elif [ $stringOld -eq 7100 ]; then
        echo "<result>"11.5.0"</result>"
    elif [ $stringOld -eq 7091 ]; then
        echo "<result>"11.4.1"</result>"
    elif [ $stringOld -eq 7090 ]; then
        echo "<result>"11.4.0"</result>"
    elif [ $stringOld -eq 7080 ]; then
        echo "<result>"11.3.0"</result>"
    elif [ $stringOld -eq 7071 ]; then
        echo "<result>"11.2.1"</result>"
    elif [ $stringOld -eq 7070 ]; then
        echo "<result>"11.2.0"</result>"
    elif [ $stringOld -eq 7060 ]; then
        echo "<result>"11.1.0"</result>"
    elif [ $stringOld -eq 7050 ]; then
        echo "<result>"11.0.0"</result>"
    elif [ $stringOld -eq 7005 ]; then
        echo "<result>"10.2.4"</result>"
    elif [ $stringOld -eq 7004 ]; then
        echo "<result>"10.2.3"</result>"
    elif [ $stringOld -eq 7003 ]; then
        echo "<result>"10.2.2"</result>"
    elif [ $stringOld -eq 7002 ]; then
        echo "<result>"10.2.1"</result>"
    elif [ $stringOld -eq 6500 ]; then
        echo "<result>"10.2.0"</result>"
    elif [ $stringOld -eq 6035 ]; then
        echo "<result>"10.1.0"</result>"
    else
        echo "<result>UnknownVersion</result>"
    fi
else
    echo "<result>NotInstalled</result>"
fi

exit 0

Queue in our coveted scripting gurus who might have a better way to do this with a loop... ;)

Hope this helps the next person.

Don

--
https://donmontalvo.com
1 REPLY 1

jwojda
Valued Contributor II

thanks!