mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-10-08 10:21:05 +03:00
Add ability to not sign the indexes when doing fdroid update
This commit is contained in:
parent
4ae896511e
commit
cad82ad669
1 changed files with 29 additions and 18 deletions
|
@ -2,7 +2,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# update.py - part of the FDroid server tools
|
# update.py - part of the FDroid server tools
|
||||||
# Copyright (C) 2010-2013, Ciaran Gultnieks, ciaran@ciarang.com
|
# Copyright (C) 2010-2015, Ciaran Gultnieks, ciaran@ciarang.com
|
||||||
# Copyright (C) 2013-2014 Daniel Martí <mvdan@mvdan.cc>
|
# Copyright (C) 2013-2014 Daniel Martí <mvdan@mvdan.cc>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -899,29 +899,38 @@ def make_index(apps, sortedids, apks, repodir, archive, categories):
|
||||||
|
|
||||||
if 'repo_keyalias' in config:
|
if 'repo_keyalias' in config:
|
||||||
|
|
||||||
logging.info("Creating signed index with this key (SHA256):")
|
if options.nosign:
|
||||||
logging.info("%s" % repo_pubkey_fingerprint)
|
logging.info("Creating unsigned index in preparation for signing")
|
||||||
|
else:
|
||||||
|
logging.info("Creating signed index with this key (SHA256):")
|
||||||
|
logging.info("%s" % repo_pubkey_fingerprint)
|
||||||
|
|
||||||
# Create a jar of the index...
|
# Create a jar of the index...
|
||||||
p = FDroidPopen(['jar', 'cf', 'index.jar', 'index.xml'], cwd=repodir)
|
jar_output = 'index_unsigned.jar' if options.nosign else 'index.jar'
|
||||||
|
p = FDroidPopen(['jar', 'cf', jar_output, 'index.xml'], cwd=repodir)
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
logging.critical("Failed to create jar file")
|
logging.critical("Failed to create {0}".format(jar_output))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Sign the index...
|
# Sign the index...
|
||||||
args = ['jarsigner', '-keystore', config['keystore'],
|
signed = os.path.join(repodir, 'index.jar')
|
||||||
'-storepass:file', config['keystorepassfile'],
|
if options.nosign:
|
||||||
'-digestalg', 'SHA1', '-sigalg', 'MD5withRSA',
|
# Remove old signed index if not signing
|
||||||
os.path.join(repodir, 'index.jar'), config['repo_keyalias']]
|
if os.path.exists(signed):
|
||||||
if config['keystore'] == 'NONE':
|
os.remove(signed)
|
||||||
args += config['smartcardoptions']
|
else:
|
||||||
else: # smardcards never use -keypass
|
args = ['jarsigner', '-keystore', config['keystore'],
|
||||||
args += ['-keypass:file', config['keypassfile']]
|
'-storepass:file', config['keystorepassfile'],
|
||||||
p = FDroidPopen(args)
|
'-digestalg', 'SHA1', '-sigalg', 'MD5withRSA',
|
||||||
# TODO keypass should be sent via stdin
|
signed, config['repo_keyalias']]
|
||||||
if p.returncode != 0:
|
if config['keystore'] == 'NONE':
|
||||||
logging.critical("Failed to sign index")
|
args += config['smartcardoptions']
|
||||||
sys.exit(1)
|
else: # smardcards never use -keypass
|
||||||
|
args += ['-keypass:file', config['keypassfile']]
|
||||||
|
p = FDroidPopen(args)
|
||||||
|
if p.returncode != 0:
|
||||||
|
logging.critical("Failed to sign index")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
# Copy the repo icon into the repo directory...
|
# Copy the repo icon into the repo directory...
|
||||||
icon_dir = os.path.join(repodir, 'icons')
|
icon_dir = os.path.join(repodir, 'icons')
|
||||||
|
@ -1006,6 +1015,8 @@ def main():
|
||||||
help="Produce human-readable index.xml")
|
help="Produce human-readable index.xml")
|
||||||
parser.add_option("--clean", action="store_true", default=False,
|
parser.add_option("--clean", action="store_true", default=False,
|
||||||
help="Clean update - don't uses caches, reprocess all apks")
|
help="Clean update - don't uses caches, reprocess all apks")
|
||||||
|
parser.add_option("--nosign", action="store_true", default=False,
|
||||||
|
help="When configured for signed indexes, create only unsigned indexes at this stage")
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
config = common.read_config(options)
|
config = common.read_config(options)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue