Fix for restore config

- removed hardcoding of user/group from pi:pi
- retrieve owner / group of oroginal folder and use them
This commit is contained in:
avollkopf 2022-01-14 12:16:42 +01:00
parent 6f60b7ae7c
commit 20e6aa7e59
2 changed files with 5 additions and 3 deletions

View file

@ -1,2 +1,2 @@
__version__ = "4.0.1.a11"
__version__ = "4.0.1.1"

View file

@ -152,12 +152,14 @@ def check_for_setup():
if zip_content == True:
print("Found correct content. Starting Restore process")
output_path = pathlib.Path(os.path.join(".", 'config'))
owner = output_path.owner()
group = output_path.group()
print("Removing old config folder")
shutil.rmtree(output_path, ignore_errors=True)
print("Extracting zip file to config folder")
zip.extractall(output_path)
print("Changing owner and group of config folder recursively to pi:pi")
recursive_chown(output_path, "pi", "pi")
print("Changing owner and group of config folder recursively to {}:{}".format(owner,group))
recursive_chown(output_path, owner, group)
print("Removing backup file")
os.remove(backupfile)
else: