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:
parent
5c7f589330
commit
4d327fbc95
2
Makefile
2
Makefile
@ -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
|
||||||
|
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user