From 48b0ef0f495dca017be095b91646a7c4342483f3 Mon Sep 17 00:00:00 2001 From: Stefan Fiedler Date: Sat, 3 Feb 2007 02:02:02 +0000 Subject: [PATCH] Stefan Fiedler: scripts/Download: return unsuccessfully if the file type does not match the file name - the original download location will be used if the mirror returns a html page indicating an error [2006112820131425026] (https://www.rocklinux.net/submaster) git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@8202 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc --- scripts/Download | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/Download b/scripts/Download index e33b09d43..99fab6be9 100755 --- a/scripts/Download +++ b/scripts/Download @@ -769,6 +769,8 @@ download_file_now() { typeexpr="Zip archive data" ;; *.tar) typeexpr="tar archive" ;; + *.txt) + typeexpr="ASCII English text" ;; *) echo "WARNING: Unkown file extension: $gzfile" typeexpr="." ;; @@ -776,10 +778,12 @@ download_file_now() { if file "$gzfile.incomplete" | grep -v "$typeexpr" then echo "ERROR: File type does not match" \ - "filename ($typeexpr)!" + "file name ($typeexpr)!" mv "$gzfile.incomplete" "$gzfile.extck-err" + return 1 else mv "$gzfile.incomplete" "$gzfile" + rm -f "$gzfile".{extck,cksum}-err fi fi fi