mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2025-01-08 22:01:48 +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 zipfile import ZipFile
|
||||||
from cbpi.craftbeerpi import CraftBeerPi
|
from cbpi.craftbeerpi import CraftBeerPi
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
import pathlib
|
import pathlib
|
||||||
import shutil
|
import shutil
|
||||||
import yaml
|
import yaml
|
||||||
|
@ -152,14 +153,19 @@ def check_for_setup():
|
||||||
if zip_content == True:
|
if zip_content == True:
|
||||||
print("Found correct content. Starting Restore process")
|
print("Found correct content. Starting Restore process")
|
||||||
output_path = pathlib.Path(os.path.join(".", 'config'))
|
output_path = pathlib.Path(os.path.join(".", 'config'))
|
||||||
owner = output_path.owner()
|
system = platform.system()
|
||||||
group = output_path.group()
|
print(system)
|
||||||
|
if system != "Windows":
|
||||||
|
owner = output_path.owner()
|
||||||
|
group = output_path.group()
|
||||||
print("Removing old config folder")
|
print("Removing old config folder")
|
||||||
shutil.rmtree(output_path, ignore_errors=True)
|
shutil.rmtree(output_path, ignore_errors=True)
|
||||||
print("Extracting zip file to config folder")
|
print("Extracting zip file to config folder")
|
||||||
zip.extractall(output_path)
|
zip.extractall(output_path)
|
||||||
print("Changing owner and group of config folder recursively to {}:{}".format(owner,group))
|
zip.close()
|
||||||
recursive_chown(output_path, owner, group)
|
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")
|
print("Removing backup file")
|
||||||
os.remove(backupfile)
|
os.remove(backupfile)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue