fixed mail backup/restore
This commit is contained in:
@@ -31,7 +31,7 @@ class Backup():
|
|||||||
def __init__(self, config, bashArg, nomail):
|
def __init__(self, config, bashArg, nomail):
|
||||||
self.config = config
|
self.config = config
|
||||||
self.destinationPath = ""
|
self.destinationPath = ""
|
||||||
self.BACKUPDIRECTORY = ["mails/", "custom/", "databases/"]
|
self.BACKUPDIRECTORY = ["custom/", "databases/"]
|
||||||
self.nomail = nomail
|
self.nomail = nomail
|
||||||
self.isBash = False
|
self.isBash = False
|
||||||
self.bash = ""
|
self.bash = ""
|
||||||
@@ -126,7 +126,7 @@ class Backup():
|
|||||||
f" ({home_path}) seems not right...", utils.RED)
|
f" ({home_path}) seems not right...", utils.RED)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
dst = self.destinationPath + self.BACKUPDIRECTORY[0] + "vmail/"
|
dst = self.destinationPath + "mails/"
|
||||||
|
|
||||||
if os.path.exists(dst):
|
if os.path.exists(dst):
|
||||||
shutil.rmtree(dst)
|
shutil.rmtree(dst)
|
||||||
|
|||||||
@@ -90,7 +90,11 @@ class Dovecot(base.Installer):
|
|||||||
"""Additional tasks."""
|
"""Additional tasks."""
|
||||||
if self.restore and len(os.listdir(self.restore + "mails")) > 0:
|
if self.restore and len(os.listdir(self.restore + "mails")) > 0:
|
||||||
utils.printcolor("Copying mail backup over dovecot directory", utils.MAGENTA)
|
utils.printcolor("Copying mail backup over dovecot directory", utils.MAGENTA)
|
||||||
shutil.copytree(self.restore+"mails/vmails", self.home_dir, dirs_exist_ok=True)
|
|
||||||
|
if os.path.exists(self.home_dir):
|
||||||
|
shutil.rmtree(self.home_dir)
|
||||||
|
|
||||||
|
shutil.copytree(self.restore+"mails/", self.home_dir)
|
||||||
elif self.restore:
|
elif self.restore:
|
||||||
utils.printcolor("It seems that mails were not backed up, skipping mail restoration.", utils.MAGENTA)
|
utils.printcolor("It seems that mails were not backed up, skipping mail restoration.", utils.MAGENTA)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user