OpenSecurity/install/initial_vm
author dyle@opensecurity.d03.arc.local
Thu, 23 Jan 2014 16:31:33 +0000
changeset 50 1f4ba6a6ecf5
parent 49 OpenSecurity/install/initial_vm.txt@45903be121b4
permissions -rw-r--r--
initial installment of vm bin working
     1 #!/bin/sh
     2 
     3 # ensure environment is ready
     4 echo 'checking environment'
     5 cd '/cygdrive/c/Documents and Settings/'
     6 cd "${USER}"
     7 mkdir 'VirtualBox VMs' &> /dev/null
     8 cd 'VirtualBox VMs'
     9 if [ "$?" != "0" ]; then
    10     echo "failed to setup user's \"VirtualBox VMs\" folder"
    11     echo "sorry."
    12     exit 1
    13 fi
    14 
    15 # get recent initial VM and create disk image
    16 echo 'download initial OpenSecurity VM'
    17 cd "/cygdrive/c/Documents\ and\ Settings/${USER}/VirtualBox\ VMs/"
    18 #wget http://service.x-net.at/opensecurity/OsecVM_initialized.ova
    19 VBoxManage.exe import OsecVM_initialized.ova --vsys 0 --vmname SecurityDVM --unit 12 --disk SecurityDVM.vmdk
    20 
    21 # launch the SecurityVM the first time to let the user do initial updates
    22 VBoxManage.exe startvm SecurityDVM
    23 
    24 cat << EOF
    25 # Start VirtualBox and update the machine
    26 #
    27 # login with
    28 #   user: root
    29 #   pass: osecvm
    30 #
    31 # issue these commands as root
    32 #
    33 #       # apt-get update
    34 #       # apt-get upgrade
    35 #       # apt-get dist-upgrade
    36 #
    37 # then shutdown the machine with
    38 #
    39 #       # shutdown -h now
    40 #
    41 # press a key when done to proceed
    42 EOF
    43 read -n 1 -s
    44 
    45 # Turn the VM disk image immutable and attach it
    46 VBoxManage.exe storageattach SecurityDVM --storagectl SATA --port 0 --medium none
    47 VBoxManage.exe modifyhd SecurityDVM.vmdk settype immutable
    48 VBoxManage.exe storageattach SecurityDVM --storagectl SATA --port 0 --device 0 --type hdd --mtype normal --medium SecurityDVM.vmdk
    49