1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/OpenSecurity/bin/download_initial_image.sh Mon Mar 10 13:01:08 2014 +0100
1.3 @@ -0,0 +1,47 @@
1.4 +#!/bin/bash
1.5 +
1.6 +# ------------------------------------------------------------
1.7 +# download initial VM for
1.8 +#
1.9 +# OpenSecurity V0.2
1.10 +#
1.11 +# (C)opyright 2014, AIT Austrian Instiitute of Technology
1.12 +# ------------------------------------------------------------
1.13 +
1.14 +# ------------------------------------------------------------
1.15 +# code
1.16 +
1.17 +
1.18 +# download the ionitial OsecVM.ova from the X-Net servers
1.19 +# and place the file in the folder specified by ${1}
1.20 +
1.21 +
1.22 +# ------------------------------
1.23 +# main ...
1.24 +#
1.25 +
1.26 +# check if we do have elevated rights
1.27 +# that is "Run as Administrator" invocation
1.28 +id -G | grep 544 &> /dev/null
1.29 +if [ "${?}" != 0 ]; then
1.30 + echo "Insufficient privileges."
1.31 + echo "Is this script executed with 'Run As Administrator'?"
1.32 + exit 1
1.33 +fi
1.34 +
1.35 +TARGET_FOLDER="${1}"
1.36 +echo "fetching OpenSecurity initial VM at " $(date)
1.37 +echo "target folder: ${TARGET_FOLDER}"
1.38 +
1.39 +# sanity check
1.40 +mkdir -p "${TARGET_FOLDER}"
1.41 +if [ ! -d "${TARGET_FOLDER}" ]; then
1.42 + echo "failed to access target folder."
1.43 + exit 1
1.44 +fi
1.45 +
1.46 +# start download
1.47 +URL="http://service.x-net.at/opensecurity/OsecVM_latest.ova"
1.48 +wget --progress=dot:mega ${URL} -O "${TARGET_FOLDER}"/OsecVM.ova
1.49 +
1.50 +