mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 23:42:37 +03:00
reorg fdroid server
to allow for multiple server types
Right now, ssh+rsync is the only supported server upload type. Things like cloud storage services are useful storage bins for fdroid repos since they are often not blocked while specific websites like Google Play are.
This commit is contained in:
parent
6b65257516
commit
5ce3b61a2a
1 changed files with 36 additions and 29 deletions
|
@ -28,8 +28,23 @@ config = None
|
||||||
options = None
|
options = None
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def update_serverwebroot(repo_section):
|
||||||
|
index = os.path.join(repo_section, 'index.xml')
|
||||||
|
indexjar = os.path.join(repo_section, 'index.jar')
|
||||||
|
if subprocess.call(['rsync', '-u', '-v', '-r', '--delete',
|
||||||
|
'--exclude', index, '--exclude', indexjar,
|
||||||
|
repo_section, config['serverwebroot']]) != 0:
|
||||||
|
sys.exit(1)
|
||||||
|
if subprocess.call(['rsync', '-u', '-v', '-r', '--delete',
|
||||||
|
index,
|
||||||
|
config['serverwebroot'] + '/' + repo_section]) != 0:
|
||||||
|
sys.exit(1)
|
||||||
|
if subprocess.call(['rsync', '-u', '-v', '-r', '--delete',
|
||||||
|
indexjar,
|
||||||
|
config['serverwebroot'] + '/' + repo_section]) != 0:
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
def main():
|
||||||
global config, options
|
global config, options
|
||||||
|
|
||||||
# Parse command line...
|
# Parse command line...
|
||||||
|
@ -50,6 +65,11 @@ def main():
|
||||||
logging.critical("The only commands currently supported are 'init' and 'update'")
|
logging.critical("The only commands currently supported are 'init' and 'update'")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
if 'nonstandardwebroot' in config and config['nonstandardwebroot'] == True:
|
||||||
|
standardwebroot = False
|
||||||
|
else:
|
||||||
|
standardwebroot = True
|
||||||
|
|
||||||
if 'serverwebroot' in config:
|
if 'serverwebroot' in config:
|
||||||
serverwebroot = config['serverwebroot'].rstrip('/').replace('//', '/')
|
serverwebroot = config['serverwebroot'].rstrip('/').replace('//', '/')
|
||||||
host, fdroiddir = serverwebroot.split(':')
|
host, fdroiddir = serverwebroot.split(':')
|
||||||
|
@ -62,38 +82,25 @@ def main():
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
serverwebroot = None
|
serverwebroot = None
|
||||||
if 'nonstandardwebroot' in config and config['nonstandardwebroot'] == True:
|
|
||||||
standardwebroot = False
|
|
||||||
else:
|
|
||||||
standardwebroot = True
|
|
||||||
|
|
||||||
repodirs = ['repo']
|
|
||||||
if config['archive_older'] != 0:
|
|
||||||
repodirs.append('archive')
|
|
||||||
|
|
||||||
for repodir in repodirs:
|
|
||||||
if args[0] == 'init':
|
|
||||||
if serverwebroot == None:
|
if serverwebroot == None:
|
||||||
logging.warn('No serverwebroot set! Edit your config.py to set it.')
|
logging.warn('No serverwebroot set! Edit your config.py to set one.')
|
||||||
elif subprocess.call(['ssh', '-v', host,
|
sys.exit(1)
|
||||||
'mkdir -p', fdroiddir + '/' + repodir]) != 0:
|
|
||||||
|
repo_sections = ['repo']
|
||||||
|
if config['archive_older'] != 0:
|
||||||
|
repo_sections.append('archive')
|
||||||
|
|
||||||
|
if args[0] == 'init':
|
||||||
|
if serverwebroot != None:
|
||||||
|
for repo_section in repo_sections:
|
||||||
|
if subprocess.call(['ssh', '-v', host,
|
||||||
|
'mkdir -p', fdroiddir + '/' + repo_section]) != 0:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
elif args[0] == 'update':
|
elif args[0] == 'update':
|
||||||
|
for repo_section in repo_sections:
|
||||||
if serverwebroot != None:
|
if serverwebroot != None:
|
||||||
index = os.path.join(repodir, 'index.xml')
|
update_serverwebroot(repo_section)
|
||||||
indexjar = os.path.join(repodir, 'index.jar')
|
|
||||||
if subprocess.call(['rsync', '-u', '-v', '-r', '--delete',
|
|
||||||
'--exclude', index, '--exclude', indexjar,
|
|
||||||
repodir, config['serverwebroot']]) != 0:
|
|
||||||
sys.exit(1)
|
|
||||||
if subprocess.call(['rsync', '-u', '-v', '-r', '--delete',
|
|
||||||
index,
|
|
||||||
config['serverwebroot'] + '/' + repodir]) != 0:
|
|
||||||
sys.exit(1)
|
|
||||||
if subprocess.call(['rsync', '-u', '-v', '-r', '--delete',
|
|
||||||
indexjar,
|
|
||||||
config['serverwebroot'] + '/' + repodir]) != 0:
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue