File: key-tricks.py

package info (click to toggle)
fdroidserver 2.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,948 kB
  • sloc: python: 34,139; xml: 2,186; sh: 1,362; java: 293; makefile: 54; javascript: 23
file content (25 lines) | stat: -rwxr-xr-x 788 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python3

import os
import fdroidserver
import shutil
import sys
from fdroidserver import common, nightly

if os.getenv('CI') is None:
    print('ERROR: This can overwrite SSH keys, so it should only be run in CI')
    sys.exit(1)

os.chdir(os.path.dirname(__file__))
config = fdroidserver.common.read_config()
nightly.PASSWORD = config['keystorepass']
nightly.KEY_ALIAS = config['repo_keyalias']

privkey = nightly._ssh_key_from_debug_keystore('keystore.jks')
print('privkey', privkey)
ssh_private_key_file = os.path.join(os.getenv('HOME'), '.ssh', 'id_rsa')
if os.path.exists(ssh_private_key_file):
    print('ERROR:', ssh_private_key_file, 'exists!')
    sys.exit(1)
shutil.move(privkey, ssh_private_key_file)
shutil.move(privkey + '.pub', ssh_private_key_file + '.pub')