Few fixes

This commit is contained in:
Antoine Nguyen
2022-11-03 12:27:04 +01:00
parent cb5fa75693
commit 754d652fc2
2 changed files with 11 additions and 9 deletions

View File

@@ -51,7 +51,7 @@ class Backup:
if not path_exists: if not path_exists:
if not self.silent_backup: if not self.silent_backup:
create_dir = input( create_dir = input(
f"\"{path}\" doesn't exists, would you like to create it? [Y/n]\n").lower() f"\"{path}\" doesn't exist, would you like to create it? [Y/n]\n").lower()
if self.silent_backup or (not self.silent_backup and create_dir.startswith("y")): if self.silent_backup or (not self.silent_backup and create_dir.startswith("y")):
pw = pwd.getpwnam("root") pw = pwd.getpwnam("root")
@@ -68,7 +68,7 @@ class Backup:
delete_dir = input( delete_dir = input(
"Warning: backup directory is not empty, it will be purged if you continue... [Y/n]\n").lower() "Warning: backup directory is not empty, it will be purged if you continue... [Y/n]\n").lower()
if self.silent_backup or (not self.silent_backup and (delete_dir == "y" or delete_dir == "yes")): if self.silent_backup or (not self.silent_backup and delete_dir.startswith("y")):
try: try:
os.remove(os.path.join(path, "installer.cfg")) os.remove(os.path.join(path, "installer.cfg"))
except FileNotFoundError: except FileNotFoundError:
@@ -81,7 +81,7 @@ class Backup:
ignore_errors=False) ignore_errors=False)
else: else:
utils.printcolor( utils.printcolor(
"Error, backup dir not clean.", utils.RED "Error: backup directory not clean.", utils.RED
) )
return False return False
@@ -144,12 +144,14 @@ class Backup:
utils.printcolor("Mail backup complete!", utils.GREEN) utils.printcolor("Mail backup complete!", utils.GREEN)
def custom_config_backup(self): def custom_config_backup(self):
"""Custom config : """
Custom config :
- DKIM keys: {{keys_storage_dir}} - DKIM keys: {{keys_storage_dir}}
- Radicale collection (calendat, contacts): {{home_dir}} - Radicale collection (calendat, contacts): {{home_dir}}
- Amavis : /etc/amavis/conf.d/99-custom - Amavis : /etc/amavis/conf.d/99-custom
- Postwhite : /etc/postwhite.conf - Postwhite : /etc/postwhite.conf
Feel free to suggest to add others!""" Feel free to suggest to add others!
"""
utils.printcolor( utils.printcolor(
"Backing up some custom configuration...", utils.MAGENTA) "Backing up some custom configuration...", utils.MAGENTA)
@@ -217,7 +219,7 @@ class Backup:
os.path.join(dump_path, f"{app_name}.sql")) os.path.join(dump_path, f"{app_name}.sql"))
def backup_completed(self): def backup_completed(self):
utils.printcolor("Backup process done, your backup is availible here:" utils.printcolor("Backup process done, your backup is available here:"
f"--> {self.backup_path}", utils.GREEN) f"--> {self.backup_path}", utils.GREEN)
def run(self): def run(self):

View File

@@ -23,4 +23,4 @@ class Restore:
modoba_sql_file + " not found, please check your backup", utils.RED) modoba_sql_file + " not found, please check your backup", utils.RED)
sys.exit(1) sys.exit(1)
# Everything seems allright here, proceding... # Everything seems alright here, proceeding...