3 # ------------------------------------------------------------
4 # download_initial_image.sh
6 # download initial VM for
8 # Copyright 2013-2014 X-Net and AIT Austrian Institute of Technology
15 # https://www.x-net.at
17 # AIT Austrian Institute of Technology
18 # Donau City Strasse 1
21 # http://www.ait.ac.at
24 # Licensed under the Apache License, Version 2.0 (the "License");
25 # you may not use this file except in compliance with the License.
26 # You may obtain a copy of the License at
28 # http://www.apache.org/licenses/LICENSE-2.0
30 # Unless required by applicable law or agreed to in writing, software
31 # distributed under the License is distributed on an "AS IS" BASIS,
32 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33 # See the License for the specific language governing permissions and
34 # limitations under the License.
35 # ------------------------------------------------------------
38 # ------------------------------------------------------------
42 # download the ionitial OsecVM.ova from the X-Net servers
43 # and place the file in the folder specified by ${1}
46 # ------------------------------
50 # check if we do have elevated rights
51 # that is "Run as Administrator" invocation
52 id -G | grep 544 &> /dev/null
53 if [ "${?}" != 0 ]; then
54 echo "Insufficient privileges. Is this script executed with 'Run As Administrator'?"
55 echo "I'll try anyway..."
59 echo "fetching OpenSecurity initial VM at " $(date)
60 echo "target folder: ${TARGET_FOLDER}"
63 mkdir -p "${TARGET_FOLDER}"
64 if [ ! -d "${TARGET_FOLDER}" ]; then
65 echo "failed to access target folder."
70 URL=$(cat /proc/registry64/HKEY_LOCAL_MACHINE/SOFTWARE/OpenSecurity/ImageUrl)
71 if [ $? != "0" ]; then
72 echo "no URL given at HKEY_LOCAL_MACHINE/SOFTWARE/OpenSecurity/ImageUrl"
73 echo "don't know where to look"
76 wget --progress=dot:mega ${URL} -O "${TARGET_FOLDER}"/OsecVM.ova