-
Notifications
You must be signed in to change notification settings - Fork 1
/
burton.py
executable file
·110 lines (81 loc) · 2.62 KB
/
burton.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
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
#!/usr/bin/python3 -B
"""
Burton: CLI-based web server control panel
Copyright (C) 2013 Dotan Cohen http://dotancohen.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
http://www.gnu.org/licenses/
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
"""
import os
import platform
import sys
import time
import system_statistics
import configure_system
import configure_websites
import configure_email
import configure_databases
import install_applications
import auxiliary_pages
from burton_class import Burton
burton_version = '0.1.2'
b = Burton()
env = '' # Move to burton object
class Environment:
def __init__(self):
self.start = int(time.time())
self.prompt = ">> "
def changePrompt(self, prompt):
self.prompt = prompt
def main(argv):
global burton_version, env, b
print("\nWelcome to Burton " + burton_version + "!")
while True:
print("\nPlease select an operation:")
print(" 0. Load server configuration profile")
print(" 1. Operating system statistics")
print(" 2. Configure and maintain operating system")
print(" 3. Configure websites")
print(" 4. Configure email")
print(" 5. Configure databases")
print(" 6. Install applications")
print(" 9. View Help, About, License, and Copyright pages")
print(" -. Exit")
operation = input(env.prompt)
operation = operation.lower().strip()
if operation == '-':
sys.exit()
elif operation == '0':
b.load_server_configuration(env)
elif operation == '1':
system_statistics.main(env)
elif operation == '2':
configure_system.main(env)
elif operation == '3':
configure_websites.main(env)
elif operation == '4':
configure_email.main(env)
elif operation == '5':
configure_databases.main(env)
elif operation == '6':
install_applications.main(env)
elif operation == '9':
auxiliary_pages.main(env)
else:
print("Invalid input!")
if __name__ == '__main__':
env = Environment()
if not os.getuid()==0:
pass
# TODO: Detect root and automatically remove 'sudo' from commands as needed.
#print("\nBurton may not run properly when not run as root.")
#print("Please exit and restart as root user or with sudo.")
#print("Using !! prompt to indicate non-root status.")
#env.changePrompt("!! ")
main(sys.argv)