diff --git a/do_backup_knucles.sh b/do_backup_knucles.sh index 0eea3ed..d53fd51 100755 --- a/do_backup_knucles.sh +++ b/do_backup_knucles.sh @@ -1,4 +1,4 @@ #!/usr/bin/bash source ~/.restic-env -~/restic_many.py backup \ No newline at end of file +~/restic_many.py backup --resticbin /home/restic/bin/restic \ No newline at end of file diff --git a/restic_many.py b/restic_many.py index 8d03d21..b7ea87e 100755 --- a/restic_many.py +++ b/restic_many.py @@ -11,7 +11,7 @@ import socket import traceback import time -restic_bin = '/home/restic/bin/restic' +restic_bin = 'restic' init_command = "restic -r %s init" command = "restic -r %s backup --verbose %s" @@ -110,8 +110,9 @@ def cmd_list(): parser = argparse.ArgumentParser(description = "backup or mount many paths using restic") parser.add_argument('command', help='command to run (backup, mount, umount)') +parser.add_argument('--resticbin', help='restic binary location, if not on PATH') -args = parser.parse_args(sys.argv[1:2]) # this kinda sucks. there has to be a betterw ay +args = parser.parse_args() # call function with the name. fn_name = "cmd_" + args.command @@ -119,4 +120,8 @@ if not fn_name in globals(): print("Command doesn't exist") parser.print_help() exit(1) + +if args.resticbin: + restic_bin = args.resticbin + globals()[fn_name]()