From 5f4ee26f99ee62939634bb52dff773e774ad75cb Mon Sep 17 00:00:00 2001
From: Simone Margaritelli <evilsocket@gmail.com>
Date: Fri, 25 Oct 2019 15:29:10 +0200
Subject: [PATCH] new: pwnagotchi folder can now be in /boot/ in which case
 will be moved to /etc/pwnagotchi

---
 pwnagotchi/utils.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/pwnagotchi/utils.py b/pwnagotchi/utils.py
index 74ad7ed..cb9d2ae 100644
--- a/pwnagotchi/utils.py
+++ b/pwnagotchi/utils.py
@@ -36,9 +36,13 @@ def load_config(args):
         # logging not configured here yet
         print("installing /boot/config.yml to %s ...", args.user_config)
         # https://stackoverflow.com/questions/42392600/oserror-errno-18-invalid-cross-device-link
-        shutil.move("/boot/config.yml", args.user_config)
+        shutil.rmtree('/etc/pwnagotchi', ignore_errors=True)
+        shutil.move('/boot/pwnagotchi', '/etc/', args.user_config)
 
-    # if not config is found, copy the defaults
+    if os.path.isdir('/boot/pwnagotchi'):
+        print("installing /boot/pwnagotchi to /etc/pwnagotchi ...")
+
+    # if no config is found, copy the defaults
     if not os.path.exists(args.config):
         print("copying %s to %s ..." % (ref_defaults_file, args.config))
         shutil.copy(ref_defaults_file, args.config)