summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Vacek <patrickvacek@gmail.com>2019-09-09 14:31:40 +0200
committerPatrick Vacek <patrickvacek@gmail.com>2019-09-11 15:48:06 +0200
commitcfa1b1cd6e00bdac6bc15718e7e9f285c731834a (patch)
treebda228805f660c6d5124005daa6b3808a8e40832
parent81c124178e950cd756d8effb72c19505b7651727 (diff)
downloadmeta-updater-cfa1b1cd6e00bdac6bc15718e7e9f285c731834a.tar.gz
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 <patrickvacek@gmail.com>
-rwxr-xr-xscripts/run-qemu-ota12
1 files changed, 11 insertions, 1 deletions
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 @@
2 2
3from argparse import ArgumentParser 3from argparse import ArgumentParser
4from subprocess import Popen 4from subprocess import Popen
5from os.path import exists 5from os.path import exists, dirname
6import sys 6import sys
7from qemucommand import QemuCommand 7from qemucommand import QemuCommand
8 8
@@ -39,6 +39,16 @@ def main():
39 'This can be used to test Uptane Primary/Secondary communication.') 39 'This can be used to test Uptane Primary/Secondary communication.')
40 parser.add_argument('-n', '--dry-run', help='Print qemu command line rather then run it', action='store_true') 40 parser.add_argument('-n', '--dry-run', help='Print qemu command line rather then run it', action='store_true')
41 args = parser.parse_args() 41 args = parser.parse_args()
42
43 if args.overlay and not exists(args.overlay) and dirname(args.overlay) and not dirname(args.overlay) == '.':
44 print('Error: please provide a file name in the current working directory. ' +
45 'Overlays do not work properly with other directories.')
46 sys.exit(1)
47 if args.overlay and exists(args.overlay) and args.imagename != parser.get_default('imagename'):
48 # qemu-img amend -o <filename> might work, but it has not yet been done
49 # successfully.
50 print('Warning: cannot change backing image of overlay after it has been created.')
51
42 try: 52 try:
43 qemu_command = QemuCommand(args) 53 qemu_command = QemuCommand(args)
44 except ValueError as e: 54 except ValueError as e: