diff --git a/general/backup/borg_interface/.gitignore b/general/backup/borg_interface/.gitignore deleted file mode 100644 index bfc75e5..0000000 --- a/general/backup/borg_interface/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -.idea -__pycache__ -# swap -[._]*.s[a-w][a-z] -[._]s[a-w][a-z] -# session -Session.vim -# temporary -.netrwhist -*~ -# auto-generated tag files -tags diff --git a/general/backup/borg_interface/borg_interface.cfg b/general/backup/borg_interface/borg_interface.cfg deleted file mode 100644 index 36c365c..0000000 --- a/general/backup/borg_interface/borg_interface.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[DEFAULT] -server: fileserver.2li.local -user: borg -repository_path: /home/borg/backup/gwyn -password: iEw74xjem7gvsJrShCVCbYrAwX7yUo diff --git a/general/backup/borg_interface/borg_interface.py b/general/backup/borg_interface/borg_interface.py deleted file mode 100755 index b775cd7..0000000 --- a/general/backup/borg_interface/borg_interface.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env python3 -import os -import sys -import configparser -import subprocess - -chosen_activity = None -mount_point = None - -# setup the config parser -config = configparser.ConfigParser() - -# read config file -config.read('borg_interface.cfg') - -# assign the repository variable -if 'server' in config: - repository = (config['DEFAULT']['user'] - + "@" - + config['DEFAULT']['server'] - + ":" - + config['DEFAULT']['repository_path']) -else: - repository = config['DEFAULT']['repository_path'] - -# assign the password variable -password = config['DEFAULT']['password'] - -# set the environment variables -os.environ['BORG_REPO'] = repository -os.environ['BORG_PASSPHRASE'] = password - -# The main menu starts there -while chosen_activity != 0: - print("What would you like to do?") - # Start the chosen activity and go back to the activity selector. - print("1: List Backups, 2: Show archive details, 3: Mount Archive, " - "4: Restore Backup, 0: Exit") - try: - chosen_activity = int(input("Choose the desired activity: ")) - if chosen_activity == 1: - # prints all the archives in the repository and lists them with - # less - os.system('borg list | less') - if chosen_activity == 2: - # Displays all the information related to the archive name the user - # enters - archive_name = input("Please enter the archive name: ") - os.system('borg info ::' + archive_name) - if chosen_activity == 3: - # mounts a chosen archive to /tmp/archive name - archive_name = input("Please enter the archive name: ") - mount_point = "/tmp/" + archive_name - if not os.path.exists(mount_point): - os.makedirs(mount_point) - os.system('borg mount ::' + archive_name + " " + mount_point) - print() - print("Archive mounted at " + mount_point + "/") - print() - if chosen_activity == 4: - archive_name = input("Please enter the archive name: ") - restore_path = input("Please enter the path where you want to " - "restore to: ") - working_directory = os.system('pwd') - if not os.path.exists(restore_path): - os.makedirs(restore_path) - p = subprocess.Popen(['borg', 'extract', ':: + archive_name], - cwd=restore_path) - p.wait() - print() - print("Archive extracted to " + restore_path) - print() - elif chosen_activity == 0: - if (not mount_point): - print() - else: - print() - print("Unmount Archive and remove folder.") - print() - os.system('fusermount -u' + " " + mount_point) - os.rmdir(mount_point) - except ValueError: - print("Please enter a full number.")