-
Notifications
You must be signed in to change notification settings - Fork 277
/
initial_setup.py
66 lines (59 loc) · 2.42 KB
/
initial_setup.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
import os
import sys
import setup_lib
if os.getuid():
sys.exit('You need root access to install!')
os.system('clear')
print()
print()
print("###################################")
print("##### RaspiWiFi Intial Setup #####")
print("###################################")
print()
print()
entered_ssid = input("Would you like to specify an SSID you'd like to use \nfor Host/Configuration mode? [default: RaspiWiFi Setup]: ")
print()
wpa_enabled_choice = input("Would you like WPA encryption enabled on the hotspot \nwhile in Configuration Mode? [y/N]:")
print()
wpa_entered_key = input("What password would you like to for WPA hotspot \naccess (if enabled above, \nMust be at least 8 characters) [default: NO PASSWORD]:")
print()
auto_config_choice = input("Would you like to enable \nauto-reconfiguration mode [y/N]?: ")
print()
auto_config_delay = input("How long of a delay would you like without an active connection \nbefore auto-reconfiguration triggers (seconds)? [default: 300]: ")
print()
server_port_choice = input("Which port would you like to use for the Configuration Page? [default: 80]: ")
print()
ssl_enabled_choice = input("Would you like to enable SSL during configuration mode \n(NOTICE: you will get a certificate ID error \nwhen connecting, but traffic will be encrypted) [y/N]?: ")
os.system('clear')
print()
print()
install_ans = input("Are you ready to commit changes to the system? [y/N]: ")
if(install_ans.lower() == 'y'):
setup_lib.install_prereqs()
setup_lib.copy_configs(wpa_enabled_choice)
setup_lib.update_main_config_file(entered_ssid, auto_config_choice, auto_config_delay, ssl_enabled_choice, server_port_choice, wpa_enabled_choice, wpa_entered_key)
else:
print()
print()
print("===================================================")
print("---------------------------------------------------")
print()
print("RaspiWiFi installation cancelled. Nothing changed...")
print()
print("---------------------------------------------------")
print("===================================================")
print()
print()
sys.exit()
os.system('clear')
print()
print()
print("#####################################")
print("##### RaspiWiFi Setup Complete #####")
print("#####################################")
print()
print()
print("Initial setup is complete. A reboot is required to start in WiFi configuration mode...")
reboot_ans = input("Would you like to do that now? [y/N]: ")
if reboot_ans.lower() == 'y':
os.system('reboot')