qvm-start-daemon: allow starting only if service enabled
This commit is contained in:
parent
f7fa577c47
commit
05e479cf92
@ -5,4 +5,3 @@ Icon=qubes
|
||||
Exec=qvm-start-daemon --all --watch
|
||||
Terminal=false
|
||||
Type=Application
|
||||
NotShowIn=X-QUBES
|
||||
|
@ -26,6 +26,7 @@ import subprocess
|
||||
import asyncio
|
||||
import re
|
||||
import functools
|
||||
import sys
|
||||
import xcffib
|
||||
import xcffib.xproto # pylint: disable=unused-import
|
||||
|
||||
@ -460,10 +461,20 @@ parser.add_argument('--pidfile', action='store', default=pidfile_path,
|
||||
parser.add_argument('--notify-monitor-layout', action='store_true',
|
||||
help='Notify running instance in --watch mode'
|
||||
' about changed monitor layout')
|
||||
# Add it for the help only
|
||||
parser.add_argument('--force', action='store_true', default=False,
|
||||
help='Force running daemon without enabled services'
|
||||
' \'guivm-gui-agent\' or \'audiovm-audio-agent\'')
|
||||
|
||||
|
||||
def main(args=None):
|
||||
""" Main function of qvm-start-daemon tool"""
|
||||
only_if_service_enabled = ['guivm-gui-agent', 'audiovm-audio-agent']
|
||||
enabled_services = [service for service in only_if_service_enabled if
|
||||
os.path.exists('/var/run/qubes-service/%s' % service)]
|
||||
if not enabled_services and '--force' not in sys.argv:
|
||||
print(parser.format_help())
|
||||
return
|
||||
args = parser.parse_args(args)
|
||||
if args.watch and not args.all_domains:
|
||||
parser.error('--watch option must be used with --all')
|
||||
|
Loading…
Reference in New Issue
Block a user