From 90b3f43885c7a1b68766cbea6b19e4ce40e3f79d Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Mon, 9 Sep 2019 14:31:40 +0200 Subject: Prevent creating an overlay with any path but the current directory. Anything else will cause problems because of the hackery with keeping backup copies of the image and the u-boot rom. Also warn about supplying a different image name after the overlay has been created. That doesn't work and it will be ignored. Signed-off-by: Patrick Vacek --- scripts/run-qemu-ota | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/run-qemu-ota b/scripts/run-qemu-ota index e9f44d6..3312fd3 100755 --- a/scripts/run-qemu-ota +++ b/scripts/run-qemu-ota @@ -2,7 +2,7 @@ from argparse import ArgumentParser from subprocess import Popen -from os.path import exists +from os.path import exists, dirname import sys from qemucommand import QemuCommand @@ -39,6 +39,16 @@ def main(): 'This can be used to test Uptane Primary/Secondary communication.') parser.add_argument('-n', '--dry-run', help='Print qemu command line rather then run it', action='store_true') args = parser.parse_args() + + if args.overlay and not exists(args.overlay) and dirname(args.overlay) and not dirname(args.overlay) == '.': + print('Error: please provide a file name in the current working directory. ' + + 'Overlays do not work properly with other directories.') + sys.exit(1) + if args.overlay and exists(args.overlay) and args.imagename != parser.get_default('imagename'): + # qemu-img amend -o might work, but it has not yet been done + # successfully. + print('Warning: cannot change backing image of overlay after it has been created.') + try: qemu_command = QemuCommand(args) except ValueError as e: -- cgit v1.2.3-54-g00ecf