-
Notifications
You must be signed in to change notification settings - Fork 5
/
conf_wizard_net.py
executable file
·81 lines (60 loc) · 3.02 KB
/
conf_wizard_net.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
import os
from modules import load_config, clear_the_screen, logo_top, Bcolors
from net_and_ap_man_conf import net_and_ap_conf
def confirm_auto_hotspot(config):
while True:
clear_the_screen()
features_menu_content = """
{bold} Automatic Hotspot / Wifi setup{endc}
Automatic hotspot will configure your timer to connect to any previously
known wifi network if detected on startup.
If no known network is found, the timer will create a self-hosting hotspot
that can be connected to on address: 10.0.0.5
The command 'autohotspot' will be available after install to re-detect wifi.
{green} y - Start auto hotspot config {endc}
{yellow} e - Exit to main menu {endc}
""".format(bold=Bcolors.BOLD_S, underline=Bcolors.UNDERLINE, endc=Bcolors.ENDC,
blue=Bcolors.BLUE, yellow=Bcolors.YELLOW_S, red=Bcolors.RED_S, green=Bcolors.GREEN_S)
print(features_menu_content)
selection = input()
if selection == 'y':
clear_the_screen()
os.system(f"sudo /home/{config.user}/RH_Install-Manager/resources/autohotspot/setup_autohotspot.sh")
print("""
#######################################################################
# #
# {bg} Configuring automatic hotspot is complete {endc} #
# #
# {bold} Thank you! {endc} #
# #
#######################################################################\n\n
""".format(nodes_number=config.nodes_number, bold=Bcolors.BOLD_S,
bg=Bcolors.BOLD + Bcolors.GREEN + (' ' * 4), endc=Bcolors.ENDC_S))
input("Press enter to continue:")
elif selection == 'e':
break
pass
def conf_wizard_net(config):
while True:
clear_the_screen()
logo_top(config.debug_mode)
features_menu_content = """
{rmh}NETWORKING MENU{endc}{bold}
1 - Setup hotspot - always on
2 - Setup automatic hotspot/wifi
{yellow}e - Exit to main menu {endc}
""".format(rmh=Bcolors.RED_MENU_HEADER, yellow=Bcolors.YELLOW_S, bold=Bcolors.BOLD, endc=Bcolors.ENDC)
print(features_menu_content)
selection = input()
if selection == '1':
net_and_ap_conf(config)
elif selection == '2':
confirm_auto_hotspot(config)
elif selection == 'e':
break
pass
def main():
config = load_config()
conf_wizard_net(config)
if __name__ == "__main__":
main()