small initial-download script fixes
authorOliver Maurhart <oliver.maurhart@ait.ac.at>
Tue, 13 May 2014 10:28:56 +0200
changeset 146e444eb7ff9c0
parent 145 758031cf192a
child 147 3dbeda03d977
small initial-download script fixes
OpenSecurity/bin/initial_vm.sh
OpenSecurity/bin/log_file.sh
log_file.sh
     1.1 --- a/OpenSecurity/bin/initial_vm.sh	Tue May 13 10:24:57 2014 +0200
     1.2 +++ b/OpenSecurity/bin/initial_vm.sh	Tue May 13 10:28:56 2014 +0200
     1.3 @@ -86,14 +86,11 @@
     1.4  net stop "OpenSecurity Service"
     1.5  echo "OpenSecurity service stopped."
     1.6  
     1.7 -echo -n "After stopping we'll wait 5 secs to let VirtualBox calm itself"
     1.8 -for i in {1..5}; do
     1.9 -    echo -n .
    1.10 -    sleep 1
    1.11 -done
    1.12 -echo
    1.13 +echo "After stopping we'll wait some time to let VirtualBox calm itself"
    1.14 +sleep 1
    1.15  
    1.16  # do all stuff relativ to the given machinefolder
    1.17 +mkdir -p "${MACHINE_FOLDER}" &> /dev/null
    1.18  pushd "${MACHINE_FOLDER}" &> /dev/null
    1.19  if [ "$?" != "0" ]; then
    1.20      echo "Failed to switch into machine folder."
     2.1 --- a/OpenSecurity/bin/log_file.sh	Tue May 13 10:24:57 2014 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,21 +0,0 @@
     2.4 -#!/bin/bash
     2.5 -
     2.6 -# ------------------------------------------------------
     2.7 -# sample test file for checking the logiing
     2.8 -# ------------------------------------------------------
     2.9 -
    2.10 -FILE_TO_LOG=${1}
    2.11 -if [ -z "${FILE_TO_LOG}" ]; then
    2.12 -    echo "please specify file name to log"
    2.13 -    exit 1
    2.14 -fi
    2.15 -FILE_TO_LOG=$(readlink -f ${FILE_TO_LOG})
    2.16 -
    2.17 -FILE_TIMESTAMP=$(date +"%s")                                # unix epoch timestamp
    2.18 -FILE_CHECKSUM=$(md5sum < "${1}" | gawk '{ print $1; }')     # MD5-Checksum
    2.19 -
    2.20 -OPENSECURITY_URL="http://localhost:8090/log"
    2.21 -
    2.22 -# POST the log
    2.23 -curl --data-urlencode "file=${FILE_TO_LOG}" --data-urlencode "checksum=${FILE_CHECKSUM}" --data-urlencode "timestamp=${FILE_TIMESTAMP}" --data-urlencode 'action=copy' --data-urlencode 'memo=copied to unsafe USB Drive G:\\' ${OPENSECURITY_URL}
    2.24 -
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/log_file.sh	Tue May 13 10:28:56 2014 +0200
     3.3 @@ -0,0 +1,21 @@
     3.4 +#!/bin/bash
     3.5 +
     3.6 +# ------------------------------------------------------
     3.7 +# sample test file for checking the logiing
     3.8 +# ------------------------------------------------------
     3.9 +
    3.10 +FILE_TO_LOG=${1}
    3.11 +if [ -z "${FILE_TO_LOG}" ]; then
    3.12 +    echo "please specify file name to log"
    3.13 +    exit 1
    3.14 +fi
    3.15 +FILE_TO_LOG=$(readlink -f ${FILE_TO_LOG})
    3.16 +
    3.17 +FILE_TIMESTAMP=$(date +"%s")                                # unix epoch timestamp
    3.18 +FILE_CHECKSUM=$(md5sum < "${1}" | gawk '{ print $1; }')     # MD5-Checksum
    3.19 +
    3.20 +OPENSECURITY_URL="http://localhost:8090/log"
    3.21 +
    3.22 +# POST the log
    3.23 +curl --data-urlencode "file=${FILE_TO_LOG}" --data-urlencode "checksum=${FILE_CHECKSUM}" --data-urlencode "timestamp=${FILE_TIMESTAMP}" --data-urlencode 'action=copy' --data-urlencode 'memo=copied to unsafe USB Drive G:\\' ${OPENSECURITY_URL}
    3.24 +