OpenSecurity/install/initial_vm
changeset 50 1f4ba6a6ecf5
parent 49 45903be121b4
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/OpenSecurity/install/initial_vm	Thu Jan 23 16:31:33 2014 +0000
     1.3 @@ -0,0 +1,49 @@
     1.4 +#!/bin/sh
     1.5 +
     1.6 +# ensure environment is ready
     1.7 +echo 'checking environment'
     1.8 +cd '/cygdrive/c/Documents and Settings/'
     1.9 +cd "${USER}"
    1.10 +mkdir 'VirtualBox VMs' &> /dev/null
    1.11 +cd 'VirtualBox VMs'
    1.12 +if [ "$?" != "0" ]; then
    1.13 +    echo "failed to setup user's \"VirtualBox VMs\" folder"
    1.14 +    echo "sorry."
    1.15 +    exit 1
    1.16 +fi
    1.17 +
    1.18 +# get recent initial VM and create disk image
    1.19 +echo 'download initial OpenSecurity VM'
    1.20 +cd "/cygdrive/c/Documents\ and\ Settings/${USER}/VirtualBox\ VMs/"
    1.21 +#wget http://service.x-net.at/opensecurity/OsecVM_initialized.ova
    1.22 +VBoxManage.exe import OsecVM_initialized.ova --vsys 0 --vmname SecurityDVM --unit 12 --disk SecurityDVM.vmdk
    1.23 +
    1.24 +# launch the SecurityVM the first time to let the user do initial updates
    1.25 +VBoxManage.exe startvm SecurityDVM
    1.26 +
    1.27 +cat << EOF
    1.28 +# Start VirtualBox and update the machine
    1.29 +#
    1.30 +# login with
    1.31 +#   user: root
    1.32 +#   pass: osecvm
    1.33 +#
    1.34 +# issue these commands as root
    1.35 +#
    1.36 +#       # apt-get update
    1.37 +#       # apt-get upgrade
    1.38 +#       # apt-get dist-upgrade
    1.39 +#
    1.40 +# then shutdown the machine with
    1.41 +#
    1.42 +#       # shutdown -h now
    1.43 +#
    1.44 +# press a key when done to proceed
    1.45 +EOF
    1.46 +read -n 1 -s
    1.47 +
    1.48 +# Turn the VM disk image immutable and attach it
    1.49 +VBoxManage.exe storageattach SecurityDVM --storagectl SATA --port 0 --medium none
    1.50 +VBoxManage.exe modifyhd SecurityDVM.vmdk settype immutable
    1.51 +VBoxManage.exe storageattach SecurityDVM --storagectl SATA --port 0 --device 0 --type hdd --mtype normal --medium SecurityDVM.vmdk
    1.52 +