don't overwrite homedir

This commit is contained in:
Serge Pokhodyaev
2018-02-18 20:24:22 +03:00
parent 75d117ad0d
commit a32bfc749b

View File

@@ -126,7 +126,10 @@ def run_init(device_type, args):
homedir = os.path.expanduser('~/.gnupg/{}'.format(device_name))
log.info('GPG home directory: %s', homedir)
check_call(['rm', '-rf', homedir])
if os.path.exists(homedir):
log.error('GPG home directory exists, remove it manually if required')
exit(1)
check_call(['mkdir', '-p', homedir])
check_call(['chmod', '700', homedir])