Update T-rex to v2.29
[csit.git] / resources / tools / trex / trex_installer.sh
1 #!/bin/sh
2
3 TREX_VERSION="2.29"
4
5 TREX_DOWNLOAD_REPO="https://github.com/cisco-system-traffic-generator/trex-core/archive/"
6 TREX_DOWNLOAD_PACKAGE="v${TREX_VERSION}.zip"
7 TREX_PACKAGE_URL="${TREX_DOWNLOAD_REPO}${TREX_DOWNLOAD_PACKAGE}"
8 TARGET_DIR="/opt/"
9 TREX_DIR="trex-core-${TREX_VERSION}/"
10 TREX_INSTALL_DIR="${TARGET_DIR}${TREX_DIR}"
11
12 if test "$(id -u)" -ne 0
13 then
14     echo "Please use root or sudo to be able to access target installation directory: ${TARGET_DIR}"
15     exit 1
16 fi
17
18 WORKING_DIR=$(mktemp -d)
19 test $? -eq 0 || exit 1
20
21 cleanup () {
22     rm -r ${WORKING_DIR}
23 }
24
25 trap cleanup EXIT
26
27 test -d ${TREX_INSTALL_DIR} && echo "T-REX aleready installed: ${TREX_INSTALL_DIR}" && exit 0
28
29 wget -P ${WORKING_DIR} ${TREX_PACKAGE_URL}
30 test $? -eq 0 || exit 1
31
32 unzip ${WORKING_DIR}/${TREX_DOWNLOAD_PACKAGE} -d ${TARGET_DIR}
33 test $? -eq 0 || exit 1
34
35 cd ${TREX_INSTALL_DIR}/linux_dpdk/ && ./b configure && ./b build || exit 1
36 cd ${TREX_INSTALL_DIR}/scripts/ko/src && make && make install || exit 1
37

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.