Commit 34908761 authored by Roman Alifanov's avatar Roman Alifanov

hotfix: create_config: if system config exists, copy it to home

parent 64736aa5
import sys, os, re
import sys, os, shutil, re
import subprocess
import functools
......@@ -22,9 +22,14 @@ def create_config():
try:
if os.geteuid() == 0:
os.makedirs(SYSTEM_CONFIG_DIR, exist_ok=True)
open(SYSTEM_CONFIG_FILE, 'a').close()
with open(SYSTEM_CONFIG_FILE, 'a'):
pass
return SYSTEM_CONFIG_FILE
else:
if os.path.exists(SYSTEM_CONFIG_FILE):
os.makedirs(HOME_CONFIG_DIR, exist_ok=True)
shutil.copyfile(SYSTEM_CONFIG_FILE, HOME_CONFIG_FILE)
else:
os.makedirs(HOME_CONFIG_DIR, exist_ok=True)
open(HOME_CONFIG_FILE, 'a').close()
return HOME_CONFIG_FILE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment