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 json
import os
import paramiko
import pwd
import re
import subprocess
import time
@ -715,8 +713,8 @@ def main():
config = common.read_config(options)
if options.command != 'init' and options.command != 'update':
logging.critical(_("The only commands currently supported are 'init' and 'update'"))
if options.command != 'update':
logging.critical(_("The only command currently supported is 'update'"))
sys.exit(1)
if config.get('nonstandardwebroot') is True:
@ -792,29 +790,6 @@ def main():
if config['per_app_repos']:
repo_sections += common.get_per_app_repos()
if options.command == 'init':
ssh = paramiko.SSHClient()
ssh.load_system_host_keys()
for serverwebroot in config.get('serverwebroot', []):
sshstr, remotepath = serverwebroot.rstrip('/').split(':')
if sshstr.find('@') >= 0:
username, hostname = sshstr.split('@')
else:
username = pwd.getpwuid(os.getuid())[0] # get effective uid
hostname = sshstr
ssh.connect(hostname, username=username)
sftp = ssh.open_sftp()
if os.path.basename(remotepath) \
not in sftp.listdir(os.path.dirname(remotepath)):
sftp.mkdir(remotepath, mode=0o755)
for repo_section in repo_sections:
repo_path = os.path.join(remotepath, repo_section)
if os.path.basename(repo_path) \
not in sftp.listdir(remotepath):
sftp.mkdir(repo_path, mode=0o755)
sftp.close()
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']: