mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 07:22:29 +03:00
Extract repository certificate automatically
This commit is contained in:
parent
6284480788
commit
d4e9cee168
2 changed files with 15 additions and 8 deletions
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("url", repo_url)
|
||||
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)
|
||||
root.appendChild(repoel)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue