Support daemonization of GPG agent

This commit is contained in:
Roman Zeyde
2021-10-16 20:58:30 +03:00
parent 37510a2d75
commit 6c2b880b7d
2 changed files with 12 additions and 0 deletions

View File

@@ -226,6 +226,8 @@ def run_agent(device_type):
p.add_argument('-v', '--verbose', default=0, action='count')
p.add_argument('--server', default=False, action='store_true',
help='Use stdin/stdout for communication with GPG.')
p.add_argument('--daemon', default=False, action='store_true',
help='Daemonize the agent.')
p.add_argument('--pin-entry-binary', type=str, default='pinentry',
help='Path to PIN entry UI helper.')
@@ -236,6 +238,15 @@ def run_agent(device_type):
args, _ = p.parse_known_args()
if args.daemon:
with daemon.DaemonContext():
run_agent_internal(args, device_type)
else:
run_agent_internal(args, device_type)
def run_agent_internal(args, device_type):
"""Actually run the server."""
assert args.homedir
log_file = os.path.join(args.homedir, 'gpg-agent.log')