qubes/tools: allow calling qvm-device as qvm-devclass (like qvm-pci)

Tool can be symlinked to `qvm-class` for particular device class (for
example `qvm-pci`) - then device class can be omitted.

QubesOS/qubes-issues#2257
This commit is contained in:
Marek Marczykowski-Górecki 2016-09-03 03:25:52 +02:00
parent 5c7f589330
commit 4d327fbc95
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 7 additions and 1 deletions

View File

@ -57,6 +57,8 @@ ifeq ($(OS),Linux)
$(MAKE) install -C linux/system-config $(MAKE) install -C linux/system-config
endif endif
python setup.py install -O1 --skip-build --root $(DESTDIR) python setup.py install -O1 --skip-build --root $(DESTDIR)
ln -s qvm-device $(DESTDIR)/usr/bin/qvm-pci
ln -s qvm-device $(DESTDIR)/usr/bin/qvm-usb
# $(MAKE) install -C tests # $(MAKE) install -C tests
$(MAKE) install -C relaxng $(MAKE) install -C relaxng
mkdir -p $(DESTDIR)/etc/qubes mkdir -p $(DESTDIR)/etc/qubes

View File

@ -186,7 +186,11 @@ def get_parser(device_class=None):
def main(args=None): def main(args=None):
'''Main routine of :program:`qvm-block`.''' '''Main routine of :program:`qvm-block`.'''
args = get_parser().parse_args(args) basename = os.path.basename(sys.argv[0])
devclass = None
if basename.startswith('qvm-') and basename != 'qvm-device':
devclass = basename[4:]
args = get_parser(devclass).parse_args(args)
try: try:
args.func(args) args.func(args)
except qubes.exc.QubesException as e: except qubes.exc.QubesException as e: