Support daemonization of GPG agent
This commit is contained in:
@@ -226,6 +226,8 @@ def run_agent(device_type):
|
|||||||
p.add_argument('-v', '--verbose', default=0, action='count')
|
p.add_argument('-v', '--verbose', default=0, action='count')
|
||||||
p.add_argument('--server', default=False, action='store_true',
|
p.add_argument('--server', default=False, action='store_true',
|
||||||
help='Use stdin/stdout for communication with GPG.')
|
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',
|
p.add_argument('--pin-entry-binary', type=str, default='pinentry',
|
||||||
help='Path to PIN entry UI helper.')
|
help='Path to PIN entry UI helper.')
|
||||||
@@ -236,6 +238,15 @@ def run_agent(device_type):
|
|||||||
|
|
||||||
args, _ = p.parse_known_args()
|
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
|
assert args.homedir
|
||||||
|
|
||||||
log_file = os.path.join(args.homedir, 'gpg-agent.log')
|
log_file = os.path.join(args.homedir, 'gpg-agent.log')
|
||||||
|
|||||||
1
setup.py
1
setup.py
@@ -17,6 +17,7 @@ setup(
|
|||||||
],
|
],
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'docutils>=0.14',
|
'docutils>=0.14',
|
||||||
|
'python-daemon>=2.3.0',
|
||||||
'wheel>=0.32.3',
|
'wheel>=0.32.3',
|
||||||
'backports.shutil_which>=3.5.1',
|
'backports.shutil_which>=3.5.1',
|
||||||
'ConfigArgParse>=0.12.1',
|
'ConfigArgParse>=0.12.1',
|
||||||
|
|||||||
Reference in New Issue
Block a user