From 846974a84302e57dfc7d326b04529eb7f9dd9bdd Mon Sep 17 00:00:00 2001 From: Don Penney Date: Fri, 20 Jul 2018 09:36:29 -0500 Subject: [PATCH] Update handling of mvn.repo.tgz The special case handling of mvn.repo.tgz accesses loop variables before they are set, resulting in the code using a value set during the previous iteration. As a result, the script overwrites the previously downloaded tarball with mvn.repo.tgz in the output directory, and mvn.repo.tgz is missing. This update moves the setting of the output path variables ahead of the special case handlers. Story: 2003058 Task: 23095 Change-Id: I3fbca2e056a584984d173942b0cbd46ec88579cc Signed-off-by: Don Penney --- centos-mirror-tools/tarball-dl.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/centos-mirror-tools/tarball-dl.sh b/centos-mirror-tools/tarball-dl.sh index ef0faa39..fe090ad9 100755 --- a/centos-mirror-tools/tarball-dl.sh +++ b/centos-mirror-tools/tarball-dl.sh @@ -75,6 +75,18 @@ for line in $(cat $tarball_file); do directory_name=$(echo $line | cut -d"#" -f2-2) tarball_url=$(echo $line | cut -d"#" -f3-3) + # - For the General category and the Puppet category: + # - Packages have a common process: download, decompressed, + # change the directory path and compressed. + + if [[ "$line" =~ ^pupp* ]]; then + download_path=$output_puppet/$tarball_name + download_directory=$output_puppet + else + download_path=$output_tarball/$tarball_name + download_directory=$output_tarball + fi + # We have 6 packages from the text file starting with the character "!": # they require special handling besides the common process: remove directory, # remove text from some files, clone a git repository, etc. @@ -119,7 +131,7 @@ for line in $(cat $tarball_file); do # Create tarball tar -zcvf "$tarball_name" -C "$directory_name"/ . rm -rf "$directory_name" - mv "$tarball_name" "$download_path" + mv "$tarball_name" "$download_directory" elif [[ "$tarball_name" =~ ^'MLNX_OFED_LINUX' ]]; then pkg_version=$(echo "$tarball_name" | cut -d "-" -f2-3) srpm_path="MLNX_OFED_SRC-${pkg_version}/SRPMS/" @@ -166,18 +178,6 @@ for line in $(cat $tarball_file); do continue fi - # - For the General category and the Puppet category: - # - Packages have a common process: download, decompressed, - # change the directory path and compressed. - - if [[ "$line" =~ ^pupp* ]]; then - download_path=$output_puppet/$tarball_name - download_directory=$output_puppet - else - download_path=$output_tarball/$tarball_name - download_directory=$output_tarball - fi - download_cmd="wget -t 5 --wait=15 $tarball_url -O $download_path" if [ ! -e $download_path ]; then