-
Notifications
You must be signed in to change notification settings - Fork 0
/
freeutm.py
71 lines (62 loc) · 2.2 KB
/
freeutm.py
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
import curses
import os
import create_machine
#stdscr = curses.initscr()
def capture():
#stdscr = curses.initscr()
curses.noecho()
curses.cbreak()
#stdscr.keypad(True)
def release():
curses.nocbreak()
#stdscr.keypad(False)
curses.echo()
curses.endwin()
def appliance_list():
print ("Appliances:")
for file in os.listdir(os.getcwd()):
if (os.path.isdir(os.getcwd() + "/" + file) == True):
if (os.path.exists(os.getcwd() + "/" + file + "/start.sh") == True):
print (file)
print()
appliance_list()
gotMachine = False
machine = ""
while (machine != ":q"):
print("Select Appliance or Command (:h for help): ")
machine = input()
if (os.path.isdir(os.getcwd() + "/" + machine) == True):
if (os.path.exists(os.getcwd() + "/" + machine + "/start.sh") == True):
print()
print("Machine: " + machine)
choice = ""
while (choice != "C"):
choice = input("(R)un, (E)dit, or (C)ancel: ")
if (choice.upper() == "R"):
create_machine.runMachine(machine)
elif (choice.upper() == "E" or choice.upper() == "EE" or choice.upper() == "EN"):
choice2 = ""
if (choice == "E"):
choice2 = input("(E)dit Config, Create (N)ew Hard Drive, or (C)ancel: ")
if (choice == "EE" or choice2 == "E"):
create_machine.editConfig(machine)
elif (choice == "EN" or choice2 == "N"):
hdname = create_machine.create_hdd(machine)
print("New Hard Drive FileName is: " + hdname)
else:
print("Not a Virtual Machine Directory")
elif (machine == ":q"):
print ("Quitting")
elif (machine == ":h"):
print (":q - Quit")
print (":l - List")
print (":n - New")
print (":h - Help (this)")
elif (machine == ":l"):
appliance_list()
elif (machine == ":n"):
create_machine.create_vm("")
elif (machine == ":q"):
break
else:
print("Appliance Doesn't Exist or Invalid Command")