fix various small things
This commit is contained in:
parent
366dff3ee7
commit
bbd9d9bb32
|
@ -8,24 +8,25 @@ import curses
|
||||||
int_vars = interface_variables
|
int_vars = interface_variables
|
||||||
|
|
||||||
def get_param(prompt_string):
|
def get_param(prompt_string):
|
||||||
screen.clear()
|
screen = curses.initscr()
|
||||||
screen.border(0)
|
screen.clear()
|
||||||
screen.addstr(2, 2, prompt_string)
|
screen.border(0)
|
||||||
screen.refresh()
|
screen.addstr(2, 2, prompt_string)
|
||||||
input = screen.getstr(10, 10, 60)
|
screen.refresh()
|
||||||
return input
|
input = screen.getstr(10, 10, 60)
|
||||||
|
return input
|
||||||
|
|
||||||
def draw_screen():
|
def draw_screen():
|
||||||
screen = curses.initscr()
|
screen = curses.initscr()
|
||||||
screen.clear()
|
screen.clear()
|
||||||
screen.border(0)
|
screen.border(0)
|
||||||
screen.addstr(2, 2, "Please enter a number...")
|
screen.addstr(2, 2, "Please enter a number...")
|
||||||
screen.addstr(4, 4, "1 - List archives in repository")
|
screen.addstr(4, 4, "1 - List archives in repository")
|
||||||
screen.addstr(5, 4, "2 - Show archive details")
|
screen.addstr(5, 4, "2 - Show archive details")
|
||||||
screen.addstr(6, 4, "3 - Mount archive")
|
screen.addstr(6, 4, "3 - Mount archive")
|
||||||
screen.addstr(7, 4, "4 - Restore an archive to specific location")
|
screen.addstr(7, 4, "4 - Restore an archive to specific location")
|
||||||
screen.addstr(8, 4, "0 - Exit")
|
screen.addstr(8, 4, "0 - Exit")
|
||||||
screen.refresh()
|
screen.refresh()
|
||||||
|
|
||||||
def list_archives():
|
def list_archives():
|
||||||
curses.endwin()
|
curses.endwin()
|
||||||
|
@ -35,21 +36,21 @@ def list_archives():
|
||||||
less_output.wait()
|
less_output.wait()
|
||||||
|
|
||||||
def show_info():
|
def show_info():
|
||||||
|
archive_name = get_param("Please enter the archive name: ")
|
||||||
curses.endwin()
|
curses.endwin()
|
||||||
prompt_archive_name()
|
|
||||||
os.system('clear')
|
os.system('clear')
|
||||||
p = subprocess.Popen(['borg', 'info', '::' + int_vars.archive_name])
|
p = subprocess.Popen(['borg', 'info', '::' + archive_name])
|
||||||
p.wait()
|
p.wait()
|
||||||
print()
|
print()
|
||||||
pause()
|
pause()
|
||||||
|
|
||||||
def mount_archive():
|
def mount_archive():
|
||||||
|
archive_name = get_param("Please enter the archive name: ")
|
||||||
curses.endwin()
|
curses.endwin()
|
||||||
prompt_archive_name()
|
int_vars.mount_point = os.path.join('/tmp', archive_name)
|
||||||
int_vars.mount_point = "/tmp/" + int_vars.archive_name
|
|
||||||
if not os.path.exists(int_vars.mount_point):
|
if not os.path.exists(int_vars.mount_point):
|
||||||
os.makedirs(int_vars.mount_point)
|
os.makedirs(int_vars.mount_point)
|
||||||
p = subprocess.Popen(['borg', 'mount', '::' + int_vars.archive_name,
|
p = subprocess.Popen(['borg', 'mount', '::' + archive_name,
|
||||||
int_vars.mount_point])
|
int_vars.mount_point])
|
||||||
p.wait()
|
p.wait()
|
||||||
print()
|
print()
|
||||||
|
@ -109,6 +110,7 @@ def exit():
|
||||||
curses.endwin()
|
curses.endwin()
|
||||||
if (not int_vars.mount_point):
|
if (not int_vars.mount_point):
|
||||||
print()
|
print()
|
||||||
|
os.system('clear')
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
print()
|
print()
|
||||||
|
@ -116,10 +118,8 @@ def exit():
|
||||||
print()
|
print()
|
||||||
os.system('fusermount -u' + " " + int_vars.mount_point)
|
os.system('fusermount -u' + " " + int_vars.mount_point)
|
||||||
os.rmdir(int_vars.mount_point)
|
os.rmdir(int_vars.mount_point)
|
||||||
|
os.system('clear')
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
def pause():
|
def pause():
|
||||||
input("Press Enter to continue.")
|
input("Press Enter to continue.")
|
||||||
|
|
||||||
def prompt_archive_name():
|
|
||||||
int_vars.archive_name = input("Please enter the archive name: ")
|
|
||||||
|
|
Reference in New Issue