Skip to content

Commit 6e1f584

Browse files
authored andcommitted
Implimented a much more efficient way to determine the RaspiWiFi installation directory.
1 parent 3a314b1 commit 6e1f584

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

GSbSFZwWV1mig4vFSmbLW9iP8TfGfMYCPfHTqGcD

Whitespace-only changes.

initial_setup.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77

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

1311
os.system('sudo cp -a Reset\ Device/static_files/rc.local.aphost.template Reset\ Device/static_files/rc.local.aphost')
1412
os.system('sudo cp -a Reset\ Device/static_files/rc.local.apclient.template Reset\ Device/static_files/rc.local.apclient')
@@ -18,12 +16,12 @@ def update_config_paths():
1816
for line in file:
1917
print(line.replace("[[project_dir]]", project_path), end='')
2018
file.close
21-
19+
2220
with fileinput.FileInput("Reset Device/static_files/rc.local.apclient", inplace=True) as file:
2321
for line in file:
2422
print(line.replace("[[project_dir]]", project_path), end='')
2523
file.close
26-
24+
2725
with fileinput.FileInput("Reset Device/reset.py", inplace=True) as file:
2826
for line in file:
2927
print(line.replace("[[project_dir]]", project_path), end='')
@@ -44,10 +42,10 @@ def update_config_paths():
4442

4543
if(run_setup_ans == 'y'):
4644
print()
47-
print("Detecting RaspiWiFi location...")
48-
45+
print("Running initial configuration...")
46+
4947
update_config_paths()
50-
48+
5149
os.system('sudo rm -f /etc/wpa_supplicant/wpa_supplicant.conf')
5250
os.system('rm -f ./tmp/*')
5351
os.system('sudo cp -r ./Reset\ Device/static_files/dhcpd.conf /etc/dhcp/')

0 commit comments

Comments
 (0)