1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-27 18:28:42 +00:00

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 @@ def run(self, args=None):
common_parser.add_argument('--no-files-cache', dest='cache_files', action='store_false') 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', 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)') 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" # We can't use argparse for "serve" since we don't want it to show up in "Available commands"
if args: if args:
@ -823,6 +825,7 @@ def run(self, args=None):
args = parser.parse_args(args or ['-h']) args = parser.parse_args(args or ['-h'])
self.verbose = args.verbose self.verbose = args.verbose
set_umask(args.umask) set_umask(args.umask)
RemoteRepository.remote_path = args.remote_path
update_excludes(args) update_excludes(args)
return args.func(args) return args.func(args)

View file

@ -108,9 +108,9 @@ def open(self, path, create=False):
class RemoteRepository: class RemoteRepository:
extra_test_args = [] extra_test_args = []
remote_path = None
class RPCError(Exception): class RPCError(Exception):
def __init__(self, name): def __init__(self, name):
self.name = name self.name = name
@ -136,7 +136,7 @@ def __init__(self, location, create=False):
args.append('%s@%s' % (location.user, location.host)) args.append('%s@%s' % (location.user, location.host))
else: else:
args.append('%s' % location.host) 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.p = Popen(args, bufsize=0, stdin=PIPE, stdout=PIPE)
self.stdin_fd = self.p.stdin.fileno() self.stdin_fd = self.p.stdin.fileno()
self.stdout_fd = self.p.stdout.fileno() self.stdout_fd = self.p.stdout.fileno()