Skip to content

Commit

Permalink
Added an initial_setup.rb Ruby script in the root directory to be run…
Browse files Browse the repository at this point in the history
… the first time after cloning. This will set the Raspberry Pi into its wifi configuration mode.
  • Loading branch information
jasbur committed Jan 29, 2017
1 parent e3d8d0c commit 6c83b0c
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions initial_setup.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
puts
puts "###################################"
puts "##### RaspiWiFi Initial Setup #####"
puts "###################################"
puts
puts
print "Would you like to run the initial setup for RaspiWiFi? (y/n): "
run_setup_ans = gets.chomp.downcase

if run_setup_ans == 'y'
system('sudo rm -f /etc/wpa_supplicant/wpa_supplicant.conf')
system('rm -f ./tmp/*')
system('sudo cp -r ./Reset\ Device/static_files/dhcpd.conf /etc/dhcp/')
system('sudo cp -r ./Reset\ Device/static_files/hostapd.conf /etc/hostapd/')
system('sudo cp -r ./Reset\ Device/static_files/interfaces.aphost /etc/network/interfaces')
system('sudo cp -r ./Reset\ Device/static_files/isc-dhcp-server.aphost /etc/default/isc-dhcp-server')
system('sudo cp -r ./Reset\ Device/static_files/rc.local.aphost /etc/rc.local')
else
puts
puts
puts "---------------------------------------------------"
puts "---------------------------------------------------"
abort("RaspiWiFi initial setup cancelled. No changes made.")
end

puts
puts
print "Initial setup is complete. A reboot is required, would you like to do that now? (y/n): "
reboot_ans = gets.chomp.downcase

if run_setup_ans == 'y' and reboot_ans == 'y'
system('sudo reboot')
end

0 comments on commit 6c83b0c

Please sign in to comment.