Skip to content

Commit 8e6a251

Browse files
committed
Simplified and updated some layout for the Initial Setup script.
1 parent 6f2805f commit 8e6a251

File tree

1 file changed

+17
-38
lines changed

1 file changed

+17
-38
lines changed

initial_setup.py

+17-38
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
def install_prereqs():
88
project_path = os.path.dirname(os.path.abspath(__file__))
99

10-
print("Updating Apt...")
1110
os.system('apt update')
12-
print("Installing prerequisites via Apt...")
11+
os.system('clear')
1312
os.system('apt install python3 bundler libsqlite3-dev isc-dhcp-server hostapd libxml2-dev libxslt-dev -y')
14-
print("Installing necessary Ruby Gems. This can take a few minutes...")
13+
os.system('clear')
1514
os.system('gem install nokogiri --no-document -v 1.6.6.2 -- --use-system-libraries')
15+
os.system('clear')
1616
os.system('bundle install --gemfile=' + project_path + '/Configuration\ App/Gemfile')
17+
os.system('clear')
1718

1819
def update_config_paths():
1920
project_path = os.path.dirname(os.path.abspath(__file__))
@@ -47,66 +48,44 @@ def update_config_paths():
4748
#################################################################
4849
#################################################################
4950

50-
51+
os.system('clear')
52+
print()
5153
print()
5254
print("###################################")
5355
print("##### RaspiWiFi Intial Setup #####")
5456
print("###################################")
5557
print()
5658
print()
57-
install_prereqs_ans = input("Would you like to install prerequisite files (This can take up to 5 minutes)? (y/n): ")
59+
install_ans = input("Would you like run the initial RaspiWiFi setup (This can take up to 5 minutes)? (y/n): ")
5860

59-
if(install_prereqs_ans == 'y'):
60-
print()
61-
print("Updating system...")
61+
if(install_ans == 'y'):
6262
install_prereqs()
63-
else:
64-
print()
65-
print()
66-
print("===================================================")
67-
print("---------------------------------------------------")
68-
print()
69-
print("No Prerequisites installed. Continuing to configuration file installation...")
70-
print()
71-
print("---------------------------------------------------")
72-
print("===================================================")
73-
print()
74-
print()
75-
76-
print()
77-
print()
78-
print()
79-
print()
80-
run_setup_ans = input("Would you like to run the initial setup for RaspiWiFi? (y/n): ")
81-
82-
if(run_setup_ans == 'y'):
83-
print("Updating config files and copying them...")
8463
update_config_paths()
8564

8665
os.system('sudo rm -f /etc/wpa_supplicant/wpa_supplicant.conf')
8766
os.system('rm -f ./tmp/*')
88-
os.system('sudo cp -r ./Reset\ Device/static_files/dhcpd.conf /etc/dhcp/')
89-
os.system('sudo cp -r ./Reset\ Device/static_files/hostapd.conf /etc/hostapd/')
90-
os.system('sudo cp -r ./Reset\ Device/static_files/interfaces.aphost /etc/network/interfaces')
91-
os.system('sudo cp -r ./Reset\ Device/static_files/isc-dhcp-server.aphost /etc/default/isc-dhcp-server')
92-
os.system('sudo cp -r ./Reset\ Device/static_files/rc.local.aphost /etc/rc.local')
67+
os.system('sudo cp -a ./Reset\ Device/static_files/dhcpd.conf /etc/dhcp/')
68+
os.system('sudo cp -a ./Reset\ Device/static_files/hostapd.conf /etc/hostapd/')
69+
os.system('sudo cp -a ./Reset\ Device/static_files/interfaces.aphost /etc/network/interfaces')
70+
os.system('sudo cp -a ./Reset\ Device/static_files/isc-dhcp-server.aphost /etc/default/isc-dhcp-server')
71+
os.system('sudo cp -a ./Reset\ Device/static_files/rc.local.aphost /etc/rc.local')
9372
else:
9473
print()
9574
print()
9675
print("===================================================")
9776
print("---------------------------------------------------")
9877
print()
99-
print("RaspiWiFi initial setup cancelled. No changes made.")
78+
print("RaspiWiFi installation cancelled. Nothing changed...")
10079
print()
10180
print("---------------------------------------------------")
10281
print("===================================================")
10382
print()
10483
print()
105-
sys.exit(0)
84+
sys.exit()
10685

10786
print()
10887
print()
109-
reboot_ans = input("Initial setup is complete. A reboot is required, would you like to do that now? (y/n): ")
88+
reboot_ans = input("Initial setup is complete. A reboot is required to start in WiFi configuration mode, would you like to do that now? (y/n): ")
11089

111-
if(run_setup_ans == 'y' and reboot_ans == 'y'):
90+
if reboot_ans == 'y':
11291
os.system('sudo reboot')

0 commit comments

Comments
 (0)