diff options
author | Patrick Vacek <patrickvacek@gmail.com> | 2019-09-09 14:31:40 +0200 |
---|---|---|
committer | Patrick Vacek <patrickvacek@gmail.com> | 2019-09-09 15:33:26 +0200 |
commit | 90b3f43885c7a1b68766cbea6b19e4ce40e3f79d (patch) | |
tree | ef2bfa4debad7557063fcf9a5df8935e46bc05e9 /scripts/run-qemu-ota | |
parent | e06640f8f1170ad868db3ecb1af9ff1d2f60c1a2 (diff) | |
download | meta-updater-90b3f43885c7a1b68766cbea6b19e4ce40e3f79d.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>
Diffstat (limited to 'scripts/run-qemu-ota')
-rwxr-xr-x | scripts/run-qemu-ota | 12 |
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 | ||
3 | from argparse import ArgumentParser | 3 | from argparse import ArgumentParser |
4 | from subprocess import Popen | 4 | from subprocess import Popen |
5 | from os.path import exists | 5 | from os.path import exists, dirname |
6 | import sys | 6 | import sys |
7 | from qemucommand import QemuCommand | 7 | from 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: |