mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 15:00:30 +03:00
if keystore is given as arg to init, create keystore if it does not exist
Previously, `fdroid init --keystore /tmp/foo` expected the keystore to exist, or it quit with an error. But I've changed my mind, I think it is useful to have it generate a new keystore at that location if it does not exist. For example, in tests/run-tests.sh. It still will not clobber an existing file at that location.
This commit is contained in:
parent
2bd62239f7
commit
b41f9e67a9
1 changed files with 10 additions and 6 deletions
|
|
@ -175,15 +175,20 @@ def main():
|
||||||
# find or generate the keystore for the repo signing key. First try the
|
# find or generate the keystore for the repo signing key. First try the
|
||||||
# path written in the default config.py. Then check if the user has
|
# path written in the default config.py. Then check if the user has
|
||||||
# specified a path from the command line, which will trump all others.
|
# specified a path from the command line, which will trump all others.
|
||||||
# Otherwise, create ~/.local/share/fdroidserver and stick it in there.
|
# Otherwise, create ~/.local/share/fdroidserver and stick it in there. If
|
||||||
|
# keystore is set to NONE, that means that Java will look for keys in a
|
||||||
|
# Hardware Security Module aka Smartcard.
|
||||||
keystore = config['keystore']
|
keystore = config['keystore']
|
||||||
if options.keystore:
|
if options.keystore:
|
||||||
if os.path.isfile(options.keystore):
|
keystore = os.path.abspath(options.keystore)
|
||||||
|
if options.keystore == 'NONE':
|
||||||
keystore = options.keystore
|
keystore = options.keystore
|
||||||
write_to_config('keystore', keystore)
|
|
||||||
else:
|
else:
|
||||||
logging.info('"' + options.keystore + '" does not exist or is not a file!')
|
keystore = os.path.abspath(options.keystore)
|
||||||
sys.exit(1)
|
if not os.path.exists(keystore):
|
||||||
|
logging.info('"' + keystore
|
||||||
|
+ '" does not exist, creating a new keystore there.')
|
||||||
|
write_to_config('keystore', keystore)
|
||||||
if options.repo_keyalias:
|
if options.repo_keyalias:
|
||||||
repo_keyalias = options.repo_keyalias
|
repo_keyalias = options.repo_keyalias
|
||||||
write_to_config('repo_keyalias', repo_keyalias)
|
write_to_config('repo_keyalias', repo_keyalias)
|
||||||
|
|
@ -195,7 +200,6 @@ def main():
|
||||||
keystoredir = os.path.dirname(keystore)
|
keystoredir = os.path.dirname(keystore)
|
||||||
if not os.path.exists(keystoredir):
|
if not os.path.exists(keystoredir):
|
||||||
os.makedirs(keystoredir, mode=0o700)
|
os.makedirs(keystoredir, mode=0o700)
|
||||||
write_to_config('keystore', keystore)
|
|
||||||
password = genpassword()
|
password = genpassword()
|
||||||
write_to_config('keystorepass', password)
|
write_to_config('keystorepass', password)
|
||||||
write_to_config('keypass', password)
|
write_to_config('keypass', password)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue