From f2458d1dcf846f62a92820e35edca42ea9b2997b Mon Sep 17 00:00:00 2001 From: Bob Lantz Date: Thu, 4 Sep 2014 06:50:54 -0700 Subject: [PATCH] Accept 'ISO' or 'boot' in file *.iso command output Fixes #372 --- util/vm/build.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/util/vm/build.py b/util/vm/build.py index a921aaa..5063fb1 100755 --- a/util/vm/build.py +++ b/util/vm/build.py @@ -192,7 +192,10 @@ def findiso( flavor ): if not path.exists( iso ) or ( stat( iso )[ ST_MODE ] & 0777 != 0444 ): log( '* Retrieving', url ) run( 'curl -C - -o %s %s' % ( iso, url ) ) - if 'ISO' not in run( 'file ' + iso ): + # Make sure the file header/type is something reasonable like + # 'ISO' or 'x86 boot sector', and not random html or text + result = run( 'file ' + iso ) + if 'ISO' not in result and 'boot' not in result: os.remove( iso ) raise Exception( 'findiso: could not download iso from ' + url ) # Write-protect iso, signaling it is complete