mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-14 06:52:39 +03:00
Make git server mirror upload honor config['identity_file'] option
This commit is contained in:
parent
1c25c516aa
commit
c137231d8b
2 changed files with 13 additions and 5 deletions
|
@ -181,7 +181,7 @@ The repository of older versions of applications from the main demo repository.
|
||||||
# 'http://foobarfoobarfoobar.onion/fdroid',
|
# 'http://foobarfoobarfoobar.onion/fdroid',
|
||||||
# )
|
# )
|
||||||
|
|
||||||
# optionally specific which identity file to use when using rsync over SSH
|
# optionally specify which identity file to use when using rsync or git over SSH
|
||||||
#
|
#
|
||||||
# identity_file = '~/.ssh/fdroid_id_rsa'
|
# identity_file = '~/.ssh/fdroid_id_rsa'
|
||||||
|
|
||||||
|
|
|
@ -216,9 +216,9 @@ def update_serverwebroot(serverwebroot, repo_section):
|
||||||
if options.quiet:
|
if options.quiet:
|
||||||
rsyncargs += ['--quiet']
|
rsyncargs += ['--quiet']
|
||||||
if options.identity_file is not None:
|
if options.identity_file is not None:
|
||||||
rsyncargs += ['-e', 'ssh -i ' + options.identity_file]
|
rsyncargs += ['-e', 'ssh -oBatchMode=yes -oIdentitiesOnly=yes -i ' + options.identity_file]
|
||||||
if 'identity_file' in config:
|
elif 'identity_file' in config:
|
||||||
rsyncargs += ['-e', 'ssh -i ' + config['identity_file']]
|
rsyncargs += ['-e', 'ssh -oBatchMode=yes -oIdentitiesOnly=yes -i ' + config['identity_file']]
|
||||||
indexxml = os.path.join(repo_section, 'index.xml')
|
indexxml = os.path.join(repo_section, 'index.xml')
|
||||||
indexjar = os.path.join(repo_section, 'index.jar')
|
indexjar = os.path.join(repo_section, 'index.jar')
|
||||||
indexv1jar = os.path.join(repo_section, 'index-v1.jar')
|
indexv1jar = os.path.join(repo_section, 'index-v1.jar')
|
||||||
|
@ -334,6 +334,13 @@ def update_servergitmirrors(servergitmirrors, repo_section):
|
||||||
fdroid_repo_path = os.path.join(git_mirror_path, "fdroid")
|
fdroid_repo_path = os.path.join(git_mirror_path, "fdroid")
|
||||||
_local_sync(repo_section, fdroid_repo_path)
|
_local_sync(repo_section, fdroid_repo_path)
|
||||||
|
|
||||||
|
# use custom SSH command if identity_file specified
|
||||||
|
ssh_cmd = 'ssh -oBatchMode=yes'
|
||||||
|
if options.identity_file is not None:
|
||||||
|
ssh_cmd += ' -oIdentitiesOnly=yes -i "%s"' % options.identity_file
|
||||||
|
elif 'identity_file' in config:
|
||||||
|
ssh_cmd += ' -oIdentitiesOnly=yes -i "%s"' % config['identity_file']
|
||||||
|
|
||||||
repo = git.Repo.init(git_mirror_path)
|
repo = git.Repo.init(git_mirror_path)
|
||||||
|
|
||||||
for mirror in servergitmirrors:
|
for mirror in servergitmirrors:
|
||||||
|
@ -360,7 +367,8 @@ def update_servergitmirrors(servergitmirrors, repo_section):
|
||||||
# push for every remote. This will overwrite the git history
|
# push for every remote. This will overwrite the git history
|
||||||
for remote in repo.remotes:
|
for remote in repo.remotes:
|
||||||
logging.debug('Pushing to ' + remote.url)
|
logging.debug('Pushing to ' + remote.url)
|
||||||
remote.push('master', force=True, set_upstream=True, progress=progress)
|
with repo.git.custom_environment(GIT_SSH_COMMAND=ssh_cmd):
|
||||||
|
remote.push('master', force=True, set_upstream=True, progress=progress)
|
||||||
if progress:
|
if progress:
|
||||||
bar.done()
|
bar.done()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue