server: purge fdroid server init command, it is totally unneeded

The existing rsync command used to deploy via SSH will create all the dirs
that `fdroid server init` does.
This commit is contained in:
Hans-Christoph Steiner 2020-10-21 10:16:17 +02:00
parent b00fd56cdf
commit 8daf273843

View file

@ -21,8 +21,6 @@ import glob
import hashlib import hashlib
import json import json
import os import os
import paramiko
import pwd
import re import re
import subprocess import subprocess
import time import time
@ -715,8 +713,8 @@ def main():
config = common.read_config(options) config = common.read_config(options)
if options.command != 'init' and options.command != 'update': if options.command != 'update':
logging.critical(_("The only commands currently supported are 'init' and 'update'")) logging.critical(_("The only command currently supported is 'update'"))
sys.exit(1) sys.exit(1)
if config.get('nonstandardwebroot') is True: if config.get('nonstandardwebroot') is True:
@ -792,52 +790,29 @@ def main():
if config['per_app_repos']: if config['per_app_repos']:
repo_sections += common.get_per_app_repos() repo_sections += common.get_per_app_repos()
if options.command == 'init': for repo_section in repo_sections:
ssh = paramiko.SSHClient() if local_copy_dir is not None:
ssh.load_system_host_keys() if config['sync_from_local_copy_dir']:
for serverwebroot in config.get('serverwebroot', []): sync_from_localcopy(repo_section, local_copy_dir)
sshstr, remotepath = serverwebroot.rstrip('/').split(':')
if sshstr.find('@') >= 0:
username, hostname = sshstr.split('@')
else: else:
username = pwd.getpwuid(os.getuid())[0] # get effective uid update_localcopy(repo_section, local_copy_dir)
hostname = sshstr for serverwebroot in config.get('serverwebroot', []):
ssh.connect(hostname, username=username) update_serverwebroot(serverwebroot, repo_section)
sftp = ssh.open_sftp() if config.get('servergitmirrors', []):
if os.path.basename(remotepath) \ # update_servergitmirrors will take care of multiple mirrors so don't need a foreach
not in sftp.listdir(os.path.dirname(remotepath)): servergitmirrors = config.get('servergitmirrors', [])
sftp.mkdir(remotepath, mode=0o755) update_servergitmirrors(servergitmirrors, repo_section)
for repo_section in repo_sections: if config.get('awsbucket'):
repo_path = os.path.join(remotepath, repo_section) update_awsbucket(repo_section)
if os.path.basename(repo_path) \ if config.get('androidobservatory'):
not in sftp.listdir(remotepath): upload_to_android_observatory(repo_section)
sftp.mkdir(repo_path, mode=0o755) if config.get('virustotal_apikey'):
sftp.close() upload_to_virustotal(repo_section, config.get('virustotal_apikey'))
ssh.close()
elif options.command == 'update':
for repo_section in repo_sections:
if local_copy_dir is not None:
if config['sync_from_local_copy_dir']:
sync_from_localcopy(repo_section, local_copy_dir)
else:
update_localcopy(repo_section, local_copy_dir)
for serverwebroot in config.get('serverwebroot', []):
update_serverwebroot(serverwebroot, repo_section)
if config.get('servergitmirrors', []):
# update_servergitmirrors will take care of multiple mirrors so don't need a foreach
servergitmirrors = config.get('servergitmirrors', [])
update_servergitmirrors(servergitmirrors, repo_section)
if config.get('awsbucket'):
update_awsbucket(repo_section)
if config.get('androidobservatory'):
upload_to_android_observatory(repo_section)
if config.get('virustotal_apikey'):
upload_to_virustotal(repo_section, config.get('virustotal_apikey'))
binary_transparency_remote = config.get('binary_transparency_remote') binary_transparency_remote = config.get('binary_transparency_remote')
if binary_transparency_remote: if binary_transparency_remote:
push_binary_transparency(BINARY_TRANSPARENCY_DIR, push_binary_transparency(BINARY_TRANSPARENCY_DIR,
binary_transparency_remote) binary_transparency_remote)
if config.get('wiki_server') and config.get('wiki_path'): if config.get('wiki_server') and config.get('wiki_path'):
update_wiki() update_wiki()