Merge pull request #134 from ThomasWaldmann/remotepath

implement --remote-path to allow non-default-path borg locations
This commit is contained in:
TW 2015-08-04 12:12:28 +02:00
commit 741715cd0e
2 changed files with 5 additions and 2 deletions

View File

@ -512,6 +512,8 @@ Type "Yes I am sure" if you understand this and want to continue.\n""")
common_parser.add_argument('--no-files-cache', dest='cache_files', action='store_false')
common_parser.add_argument('--umask', dest='umask', type=lambda s: int(s, 8), default=0o077, metavar='M',
help='set umask to M (local and remote, default: 0o077)')
common_parser.add_argument('--remote-path', dest='remote_path', default='borg', metavar='PATH',
help='set remote path to executable (default: "borg")')
# We can't use argparse for "serve" since we don't want it to show up in "Available commands"
if args:
@ -823,6 +825,7 @@ Type "Yes I am sure" if you understand this and want to continue.\n""")
args = parser.parse_args(args or ['-h'])
self.verbose = args.verbose
set_umask(args.umask)
RemoteRepository.remote_path = args.remote_path
update_excludes(args)
return args.func(args)

View File

@ -108,9 +108,9 @@ class RepositoryServer:
class RemoteRepository:
extra_test_args = []
remote_path = None
class RPCError(Exception):
def __init__(self, name):
self.name = name
@ -136,7 +136,7 @@ class RemoteRepository:
args.append('%s@%s' % (location.user, location.host))
else:
args.append('%s' % location.host)
args += ['borg', 'serve'] + umask
args += [self.remote_path, 'serve'] + umask
self.p = Popen(args, bufsize=0, stdin=PIPE, stdout=PIPE)
self.stdin_fd = self.p.stdin.fileno()
self.stdout_fd = self.p.stdout.fileno()