Skip to content

Commit

Permalink
Implimented a much more efficient way to determine the RaspiWiFi inst…
Browse files Browse the repository at this point in the history
…allation directory.
  • Loading branch information
Unknown authored and Unknown committed Oct 2, 2017
1 parent 3a314b1 commit 6e1f584
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Empty file.
14 changes: 6 additions & 8 deletions initial_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@


def update_config_paths():
find_output = subprocess.Popen(['find', '/', '-name', 'GSbSFZwWV1mig4vFSmbLW9iP8TfGfMYCPfHTqGcD'], stdout=subprocess.PIPE)
project_path_raw, err = find_output.communicate()
project_path = str(project_path_raw.decode('utf-8'))[:-42]
project_path = os.path.dirname(os.path.abspath(__file__))

os.system('sudo cp -a Reset\ Device/static_files/rc.local.aphost.template Reset\ Device/static_files/rc.local.aphost')
os.system('sudo cp -a Reset\ Device/static_files/rc.local.apclient.template Reset\ Device/static_files/rc.local.apclient')
Expand All @@ -18,12 +16,12 @@ def update_config_paths():
for line in file:
print(line.replace("[[project_dir]]", project_path), end='')
file.close

with fileinput.FileInput("Reset Device/static_files/rc.local.apclient", inplace=True) as file:
for line in file:
print(line.replace("[[project_dir]]", project_path), end='')
file.close

with fileinput.FileInput("Reset Device/reset.py", inplace=True) as file:
for line in file:
print(line.replace("[[project_dir]]", project_path), end='')
Expand All @@ -44,10 +42,10 @@ def update_config_paths():

if(run_setup_ans == 'y'):
print()
print("Detecting RaspiWiFi location...")
print("Running initial configuration...")

update_config_paths()

os.system('sudo rm -f /etc/wpa_supplicant/wpa_supplicant.conf')
os.system('rm -f ./tmp/*')
os.system('sudo cp -r ./Reset\ Device/static_files/dhcpd.conf /etc/dhcp/')
Expand Down

0 comments on commit 6e1f584

Please sign in to comment.