-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.sh
executable file
·124 lines (124 loc) · 3.38 KB
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash
clear
while true
do
echo " "
echo " *************************************"
echo " * *"
echo " * Admin Console for VirtualBox *"
echo " * Version 1.0 *"
echo " * *"
echo " *************************************"
echo ""
echo "1) List of VM's"
echo "2) Show Run VM's"
echo "3) Open UI Administration"
echo "4) Host Information"
echo "5) VM Information"
echo "6) Up VM"
echo "7) Shutdown VM"
echo "8) Resume VM"
echo "9) Create VM"
echo "10) Delete VM"
echo "11) Exit"
echo ""
read -p "Select Option: " opcion
case $opcion in
1) clear
echo "List of VM's:"
echo ""
VBoxManage list vms ;;
2) clear
echo "Run VM's:"
echo ""
VBoxManage list runningvms
echo ""
echo "Used Memory:"
echo ""
SO=`uname`
if [ "Darwin" = "$SO" ]; then
open /Applications/Utilities/Activity\ Monitor.app
else
free -m
fi;;
3) clear
virtualbox &;;
4) clear
VBoxManage list hostinfo ;;
5)clear
echo "List of VM"
echo ""
VBoxManage list vms
echo ""
read -p "Enter VM to show: " vminforst
VBoxManage showvminfo $vminforst | grep VRDE
echo ""
VBoxManage showvminfo $vminforst;;
6) clear
echo "Available VM's"
echo ""
VBoxManage list vms
echo ""
read -p "Enter Name of VM:" namevm
SO=`uname`
if [ "Darwin" = "$SO" ]; then
VBoxManage startvm $namevm -type headless
else
read -p "Enter Port (3389-xxxx):" puerto
VBoxHeadless -startvm $namevm -p $puerto &
fi;;
7) clear
echo "Runing VM's"
echo ""
VBoxManage list runningvms
echo ""
read -p "Enter Name of VM:" closevm
VBoxManage controlvm $closevm poweroff;;
8) clear
echo "Resume VM"
echo ""
VBoxManage list runningvms
echo ""
read -p "Enter Name of VM:" resumevm
VBoxManage controlvm $resumevm savestate;;
9)clear
echo ""
read -p "Name of new VM: " vmnew
read -p "Size Hard Drive (MB): " hdnew
read -p "Path of Hard Drive: " pathhd
echo "S.O. Availables : "
echo ""
vboxmanage list ostypes | more
read -p "Operation System: " typeos
read -p "Memory RAM (MB): " ram
read -p "Path location of image (ex: /home/user/so.iso) : " path
read -p "Port VM (3389-xxxx): " puerto2
VBoxManage createvm -name $vmnew -ostype $typeos -register
VBoxManage createhd -filename $vmnew.vdi -size $hdnew -format VDI
VBoxManage storagectl $vmnew --name "SATA Controller" --add sata --controller IntelAhci
VBoxManage storageattach "$vmnew" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium $vmnew.vdi
VBoxManage modifyvm $vmnew --memory $ram
VBoxManage storagectl $vmnew --name "IDE Controller" --add ide --controller PIIX4
VBoxManage storageattach $vmnew --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium $path
VBoxManage modifyvm $vmnew --vrde on
VBoxManage modifyvm $vmnew --vrdemulticon on --vrdeport $puerto2
VBoxManage modifyvm $vmnew --boot1 dvd
VBoxManage showvminfo $vmnew | grep VRDE;;
10)clear
echo "Delete Process"
echo ""
VBoxManage list vms
echo ""
read -p "VM to Delete :" deletevm
VBoxManage storagectl $deletevm --name "SATA Controller" --remove
VBoxManage unregistervm $deletevm --delete
VBoxManage closemedium disk $deletevm.vdi --delete
echo ""
VBoxManage list vms;;
11) clear
echo "Bye!"
break;;
*) echo "Only Options 1 to 7";;
esac
done
exit 0