From 492d8f60ed825634f65bd37cd961a6550a414d2b Mon Sep 17 00:00:00 2001 From: Quentin Kaiser Date: Tue, 19 Apr 2022 22:58:22 +0200 Subject: [PATCH] Add no_basename_subdir CLI option to ubireader_extract_images. ubireader_extract_images creates an output directory named after the input file basename _within_ the output path. We introduce the --no-basename-subdir option for users who don't want this extra directory to be created. --- scripts/ubireader_extract_images | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/ubireader_extract_images b/scripts/ubireader_extract_images index 9e7400f..e8ff9e9 100755 --- a/scripts/ubireader_extract_images +++ b/scripts/ubireader_extract_images @@ -75,6 +75,9 @@ if __name__=='__main__': parser.add_argument('-f', '--u-boot-fix', action='store_true', dest='uboot_fix', help='Assume blocks with image_seq 0 are because of older U-boot implementations and include them. (default: False)') + parser.add_argument('--no-basename-subdir', action='store_true', dest='no_basename_subdir', + help='Extract image within output-dir rather than in output-dir/basename(filepath). (default: False)') + parser.add_argument('-o', '--output-dir', dest='outpath', help='Specify output directory path.') @@ -117,7 +120,8 @@ if __name__=='__main__': if filetype != UBI_EC_HDR_MAGIC: parser.error('File does not look like UBI data.') - img_name = os.path.basename(path) + img_name = "" if args.no_basename_subdir else os.path.basename(path) + if args.outpath: outpath = os.path.abspath(os.path.join(args.outpath, img_name)) else: