author | Oliver Maurhart <oliver.maurhart@ait.ac.at> |
Mon, 10 Mar 2014 13:01:08 +0100 | |
changeset 91 | a26757850ea9 |
child 112 | 9cd4654c040b |
permissions | -rw-r--r-- |
oliver@91 | 1 |
#!/bin/bash |
oliver@91 | 2 |
|
oliver@91 | 3 |
# ------------------------------------------------------------ |
oliver@91 | 4 |
# download initial VM for |
oliver@91 | 5 |
# |
oliver@91 | 6 |
# OpenSecurity V0.2 |
oliver@91 | 7 |
# |
oliver@91 | 8 |
# (C)opyright 2014, AIT Austrian Instiitute of Technology |
oliver@91 | 9 |
# ------------------------------------------------------------ |
oliver@91 | 10 |
|
oliver@91 | 11 |
# ------------------------------------------------------------ |
oliver@91 | 12 |
# code |
oliver@91 | 13 |
|
oliver@91 | 14 |
|
oliver@91 | 15 |
# download the ionitial OsecVM.ova from the X-Net servers |
oliver@91 | 16 |
# and place the file in the folder specified by ${1} |
oliver@91 | 17 |
|
oliver@91 | 18 |
|
oliver@91 | 19 |
# ------------------------------ |
oliver@91 | 20 |
# main ... |
oliver@91 | 21 |
# |
oliver@91 | 22 |
|
oliver@91 | 23 |
# check if we do have elevated rights |
oliver@91 | 24 |
# that is "Run as Administrator" invocation |
oliver@91 | 25 |
id -G | grep 544 &> /dev/null |
oliver@91 | 26 |
if [ "${?}" != 0 ]; then |
oliver@91 | 27 |
echo "Insufficient privileges." |
oliver@91 | 28 |
echo "Is this script executed with 'Run As Administrator'?" |
oliver@91 | 29 |
exit 1 |
oliver@91 | 30 |
fi |
oliver@91 | 31 |
|
oliver@91 | 32 |
TARGET_FOLDER="${1}" |
oliver@91 | 33 |
echo "fetching OpenSecurity initial VM at " $(date) |
oliver@91 | 34 |
echo "target folder: ${TARGET_FOLDER}" |
oliver@91 | 35 |
|
oliver@91 | 36 |
# sanity check |
oliver@91 | 37 |
mkdir -p "${TARGET_FOLDER}" |
oliver@91 | 38 |
if [ ! -d "${TARGET_FOLDER}" ]; then |
oliver@91 | 39 |
echo "failed to access target folder." |
oliver@91 | 40 |
exit 1 |
oliver@91 | 41 |
fi |
oliver@91 | 42 |
|
oliver@91 | 43 |
# start download |
oliver@91 | 44 |
URL="http://service.x-net.at/opensecurity/OsecVM_latest.ova" |
oliver@91 | 45 |
wget --progress=dot:mega ${URL} -O "${TARGET_FOLDER}"/OsecVM.ova |
oliver@91 | 46 |
|
oliver@91 | 47 |