remote sync command only if no user is given.

This commit is contained in:
Dirk Alders 2021-01-14 04:58:45 +01:00
parent 81f7cf4b2e
commit 478de022cf
3 changed files with 12 additions and 7 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
config.py
*~
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/

View File

@ -4,11 +4,9 @@ import sys
backup = False
hosts = ['ahorn', 'erle', 'linde']
__basepath__ = '/user_data'
__basepath__ = '/usr/data'
entries = (
('dirk@%s:/user_data/bin', os.path.join(__basepath__, 'bin'), None),
('dirk@%s:/user_data/data', os.path.join(__basepath__, 'data'), None),
('dirk@%s:/user_data/static_data', os.path.join(__basepath__, 'static_data'), ['Audio', 'timeshift', 'lost+found']),
('dirk@%s:/usr/data', __basepath__, None),
('dirk@%s:/home', '/home', None),
)
@ -21,5 +19,6 @@ for host in hosts:
setattr(sys.modules[__name__], host + '_' + os.path.basename(local) + '_skip', skip)
mount_mockery_audio_remotepath = 'root@mount-mockery.de:/data/audio/items'
mount_mockery_audio_localpath = os.path.join(__basepath__, 'static_data', 'dirk', 'Audio')
mount_mockery_audio_remotepath = 'root@mount-mockery.de:/data/audio'
mount_mockery_audio_localpath = os.path.join(__basepath__, 'dirk', 'Audio')

3
mysync
View File

@ -68,6 +68,9 @@ def rsync_command(**kwargs):
if localpath is not None:
remotepath = path_filter(kwargs.get(PROP_REMOTE))
skip = kwargs.get(PROP_SKIP)
if remotepath.find('@') != -1:
cmd_l = ['rsync', '-avn' if DEBUG else '-av', '--delete', remotepath, localpath]
else:
cmd_l = ['rsync', '-avn' if DEBUG else '-av', '--delete', '--rsync-path="%s"' % RSYNC_REMOTE_COMMAND, remotepath, localpath]
if skip is not None:
cmd_l.append('--exclude=%s' % ','.join(skip))