mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-12-22 13:34:55 +01:00
Restore config fix for windows
This commit is contained in:
parent
8320853399
commit
50677a2a3e
2 changed files with 11 additions and 5 deletions
|
@ -1 +1 @@
|
|||
__version__ = "4.0.1.4"
|
||||
__version__ = "4.0.1.5"
|
||||
|
|
14
cbpi/cli.py
14
cbpi/cli.py
|
@ -10,6 +10,7 @@ from cbpi.utils.utils import load_config
|
|||
from zipfile import ZipFile
|
||||
from cbpi.craftbeerpi import CraftBeerPi
|
||||
import os
|
||||
import platform
|
||||
import pathlib
|
||||
import shutil
|
||||
import yaml
|
||||
|
@ -152,14 +153,19 @@ 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()
|
||||
system = platform.system()
|
||||
print(system)
|
||||
if system != "Windows":
|
||||
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 {}:{}".format(owner,group))
|
||||
recursive_chown(output_path, owner, group)
|
||||
zip.close()
|
||||
if system != "Windows":
|
||||
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:
|
||||
|
|
Loading…
Reference in a new issue