Skip to content

Commit

Permalink
Added a 'token' file to find int he root directory using a 40 charact…
Browse files Browse the repository at this point in the history
…ed random string as the name and the code in the Configuration Appto find it. This will allow the working direcotry of RaspiWiFi to be found no matter where it is on the system. The app seems to run in the root directory context no matter what, probably because it runs from rc.local
  • Loading branch information
jasbur committed Jan 30, 2017
1 parent 6c83b0c commit 7a6f8a4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions Configuration App/app/models/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,29 @@ def self.create_wpa_supplicant(user_ssid, encryption_type, user_wifi_key)
end

def self.set_ap_client_mode
system ('sudo cp -r /home/pi/Projects/RaspiWiFi/Reset\ Device/static_files/interfaces.apclient /etc/network/interfaces')
system ('sudo cp -r /home/pi/Projects/RaspiWiFi/Reset\ Device/static_files/rc.local.apclient /etc/rc.local')
system ('sudo cp -r /home/pi/Projects/RaspiWiFi/Reset\ Device/static_files/isc-dhcp-server.apclient /etc/default/isc-dhcp-server')
raspiwifi_path = find_raspiwifi_path()

system ('sudo cp -r ' + raspiwifi_path + '/Reset\ Device/static_files/interfaces.apclient /etc/network/interfaces')
system ('sudo cp -r ' + raspiwifi_path + '/Reset\ Device/static_files/rc.local.apclient /etc/rc.local')
system ('sudo cp -r ' + raspiwifi_path + '/Reset\ Device/static_files/isc-dhcp-server.apclient /etc/default/isc-dhcp-server')
system ('sudo reboot')
end

def self.reset_all
raspiwifi_path = find_raspiwifi_path()

system ('sudo rm -f /etc/wpa_supplicant/wpa_supplicant.conf')
system ('rm -f ../tmp/*')
system ('sudo cp -r /home/pi/Projects/RaspiWiFi/Reset\ Device/static_files/interfaces.aphost /etc/network/interfaces')
system ('sudo cp -r /home/pi/Projects/RaspiWiFi/Reset\ Device/static_files/rc.local.aphost /etc/rc.local')
system ('rm -f ' + raspiwifi_path + '/tmp/*')
system ('sudo cp -r ' + raspiwifi_path + '/Reset\ Device/static_files/interfaces.aphost /etc/network/interfaces')
system ('sudo cp -r ' + raspiwifi_path + '/Reset\ Device/static_files/rc.local.aphost /etc/rc.local')
system ('sudo reboot')
end

def self.find_raspiwifi_path
find_path = %x(sudo find / -name "GSbSFZwWV1mig4vFSmbLW9iP8TfGfMYCPfHTqGcD")
raspiwifi_path = find_path[0..-43]

raspiwifi_path
end

end
Empty file.

0 comments on commit 7a6f8a4

Please sign in to comment.