mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 23:42:37 +03:00
Extract repository certificate automatically
This commit is contained in:
parent
6284480788
commit
d4e9cee168
2 changed files with 15 additions and 8 deletions
|
@ -18,14 +18,9 @@ binaries built by the original application developers.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
#The key (from the keystore defined below) to be used for signing the
|
#The key (from the keystore defined below) to be used for signing the
|
||||||
#repository itself. Can be none for an unsigned repository.
|
#repository itself. Can be None for an unsigned repository.
|
||||||
repo_keyalias = None
|
repo_keyalias = None
|
||||||
|
|
||||||
#If you're building a signed repository, you need the public key here. You
|
|
||||||
#can get the public key in the correct format by using 'getsig -f x.jar" where
|
|
||||||
#x.jar is any jar you have signed with it.
|
|
||||||
repo_pubkey = 'not set'
|
|
||||||
|
|
||||||
#The keystore to use for release keys when building. This needs to be
|
#The keystore to use for release keys when building. This needs to be
|
||||||
#somewhere safe and secure, and backed up!
|
#somewhere safe and secure, and backed up!
|
||||||
keystore = "/home/me/somewhere/my.keystore"
|
keystore = "/home/me/somewhere/my.keystore"
|
||||||
|
@ -33,7 +28,8 @@ keystore = "/home/me/somewhere/my.keystore"
|
||||||
#The password for the keystore.
|
#The password for the keystore.
|
||||||
keystorepass = "foo"
|
keystorepass = "foo"
|
||||||
|
|
||||||
#The password for keys - the same is used for each auto-generated key.
|
#The password for keys - the same is used for each auto-generated key
|
||||||
|
#as well as for the repository key.
|
||||||
keypass = "foo2"
|
keypass = "foo2"
|
||||||
|
|
||||||
#The distinguished name used for all keys.
|
#The distinguished name used for all keys.
|
||||||
|
|
13
update.py
13
update.py
|
@ -247,7 +247,18 @@ repoel.setAttribute("name", repo_name)
|
||||||
repoel.setAttribute("icon", os.path.basename(repo_icon))
|
repoel.setAttribute("icon", os.path.basename(repo_icon))
|
||||||
repoel.setAttribute("url", repo_url)
|
repoel.setAttribute("url", repo_url)
|
||||||
if repo_keyalias != None:
|
if repo_keyalias != None:
|
||||||
repoel.setAttribute("pubkey", repo_pubkey)
|
def extract_pubkey():
|
||||||
|
p = subprocess.Popen(['keytool', '-exportcert',
|
||||||
|
'-alias', repo_keyalias,
|
||||||
|
'-keystore', keystore,
|
||||||
|
'-storepass', keystorepass],
|
||||||
|
stdout=subprocess.PIPE)
|
||||||
|
cert = p.communicate()[0]
|
||||||
|
if p.returncode != 0:
|
||||||
|
print "ERROR: Failed to get repo pubkey"
|
||||||
|
sys.exit(1)
|
||||||
|
return "".join("%02x" % ord(b) for b in cert)
|
||||||
|
repoel.setAttribute("pubkey", extract_pubkey())
|
||||||
addElement('description', repo_description, doc, repoel)
|
addElement('description', repo_description, doc, repoel)
|
||||||
root.appendChild(repoel)
|
root.appendChild(repoel)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue