aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-07-17 18:44:48 -0700
committerMartin Braun <martin.braun@ettus.com>2017-07-17 18:44:48 -0700
commit3d5176874f90f9155c1591656df8a7d663b3c712 (patch)
tree3693c123057a9420b273f595e6609fb32343130c /host/utils
parent47c853f9dd518ef25d23b94bc0e77dbda3c2ddab (diff)
parent684fd3a3ffaf31b9fa726ccf2fdea2627f6ea10d (diff)
downloaduhd-3d5176874f90f9155c1591656df8a7d663b3c712.tar.gz
uhd-3d5176874f90f9155c1591656df8a7d663b3c712.tar.bz2
uhd-3d5176874f90f9155c1591656df8a7d663b3c712.zip
Merge branch 'maint'
Diffstat (limited to 'host/utils')
-rw-r--r--host/utils/uhd_images_downloader.py.in14
1 files changed, 14 insertions, 0 deletions
diff --git a/host/utils/uhd_images_downloader.py.in b/host/utils/uhd_images_downloader.py.in
index 593f7759f..84be10902 100644
--- a/host/utils/uhd_images_downloader.py.in
+++ b/host/utils/uhd_images_downloader.py.in
@@ -252,6 +252,8 @@ def main():
help="Do not clear images directory before extracting new files [default=%default]")
parser.add_option("-v", "--verbose", action="store_true", default=False,
help="Enable verbose output [default=%default]")
+ parser.add_option("--force-delete", action="store_true", default=False,
+ help="Delete all files in the target images directory without prompting [default=%default]")
(options, args) = parser.parse_args()
if options.buffer_size <= 0:
print("Invalid buffer size: %s" % (options.buffer_size))
@@ -287,6 +289,18 @@ def main():
else:
print("Images destination: %s" % (images_dir))
+ ### Check contradictory arguments
+ if options.force_delete and options.keep:
+ print("Error: Keep and force delete options contradict.\n")
+ parser.print_help()
+ return 1
+
+ ### Prevent accidental file deletion
+ if options.install_location != default_images_dir and options.force_delete == False and options.keep != True:
+ print("Custom install location specified, defaulting to overwriting only image files.\n"
+ "Use \'--force-delete\' to clean the target directory first.")
+ options.keep = True
+
### Download or copy
downloader = uhd_images_downloader()
try: