From e48a6ecc1e68230bbfc1d8cf13d58d1cc5e03d0a Mon Sep 17 00:00:00 2001
From: David Huss <dh@atoav.com>
Date: Sun, 31 Oct 2021 15:22:12 +0100
Subject: [PATCH] Try priviledge escalation

---
 common_config/__init__.py | 2 +-
 common_config/common.py   | 5 +++--
 pyproject.toml            | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/common_config/__init__.py b/common_config/__init__.py
index 4e0b094..30f1bb5 100644
--- a/common_config/__init__.py
+++ b/common_config/__init__.py
@@ -1,2 +1,2 @@
-__version__ = '0.1.6'
+__version__ = '0.1.7'
 from common_config.common import *
\ No newline at end of file
diff --git a/common_config/common.py b/common_config/common.py
index dc1ae1f..bfd9237 100644
--- a/common_config/common.py
+++ b/common_config/common.py
@@ -425,14 +425,15 @@ def create_config():
         config_path.write_text(DEFAULT_CONFIG)
     except PermissionError as e:
         python_path = f"{sys.prefix}/bin/python3"
+        script_path = f"{__file__}"
         print()
         print(f"Error: Didn't have the permissions to write the file to {config_path}", file=sys.stderr)
         print(f"       Directory \"{selection['path']}\" belongs to user {selection['path'].owner()} (was running as user {getpass.getuser()})", file=sys.stderr)
         print()
         print(f"Hint:  Change the owner of the directory temporarily to {getpass.getuser()} or run {APPLICATION_NAME} config create with more permissions")
-        print(f"Hint:  The python executable used by this script is located at \"{python_path}\"", file=sys.stderr)
+        print(f"Hint:  To run the script with this python executable run \"sudo {python_path} {}\"", file=sys.stderr)
         # Run again with priviledges
-        subprocess.call(['sudo', python_path, *sys.argv])
+        # subprocess.call(['sudo', python_path, *sys.argv])
         sys.exit()
     print(f"Default Config has been written to {config_path}")
 
diff --git a/pyproject.toml b/pyproject.toml
index 626276e..6251586 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
 [tool.poetry]
 name = "common-config"
-version = "0.1.6"
+version = "0.1.7"
 description = "A config library for eigenservice"
 authors = ["David Huss <dh@atoav.com>"]
 
-- 
GitLab