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