From 6e1f5844e1def68f0a5b915705ad9a3064709efd Mon Sep 17 00:00:00 2001 From: Date: Mon, 2 Oct 2017 16:27:26 -0500 Subject: [PATCH] Implimented a much more efficient way to determine the RaspiWiFi installation directory. --- GSbSFZwWV1mig4vFSmbLW9iP8TfGfMYCPfHTqGcD | 0 initial_setup.py | 14 ++++++-------- 2 files changed, 6 insertions(+), 8 deletions(-) delete mode 100644 GSbSFZwWV1mig4vFSmbLW9iP8TfGfMYCPfHTqGcD diff --git a/GSbSFZwWV1mig4vFSmbLW9iP8TfGfMYCPfHTqGcD b/GSbSFZwWV1mig4vFSmbLW9iP8TfGfMYCPfHTqGcD deleted file mode 100644 index e69de29b..00000000 diff --git a/initial_setup.py b/initial_setup.py index 5b2d83cc..355805ee 100644 --- a/initial_setup.py +++ b/initial_setup.py @@ -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') @@ -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='') @@ -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/')