#!/bin/bash # This is a "meta script", it will download the latest version of the measurement script # (that will be placed in a temp dir and then, run it. # At the end of the execution the created directory will be deleted # Checking if some of the mandatory tools are available command -v curl >/dev/null 2>&1 || { echo >&2 "The script require curl but it's not installed. Aborting."; exit 1; } # If you want to customise the script, enter the path WITHOUT the trailing / # FYI we are adding a timestamp to the end of the dirname trying to be kind of "unique" # it's a dirty trick, right! SCRIPT_PATH="$HOME/.mptcp_measures" TIMESTAMP=`date +%s` SCRIPT_PATH="${SCRIPT_PATH}-${TIMESTAMP}/" # Try to download the latest version from the MPTCP Website mkdir ${SCRIPT_PATH} create_return=$? if [[ $create_return -eq 1 ]]; then echo "There was a problem creating the temp dir..."; exit 1; fi curl -s -L http://www.multipath-tcp.org/vboxtests/mptcp_measures_script -o ${SCRIPT_PATH}mptcp_measures_script dl_return=$? if [[ $dl_return -eq 0 ]]; then # Download succeded, installing the new version chmod +x ${SCRIPT_PATH}mptcp_measures_script echo "[infos] download ok, launching script..." ${SCRIPT_PATH}mptcp_measures_script "$@" echo "[infos] script terminated, removing temp files" rm -Rf ${SCRIPT_PATH} else echo "[infos] there was a problem downloading the script please check your Internet connection" fi