Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent script from exiting when file already exist #298

Merged
merged 2 commits into from
Nov 17, 2023
Merged

Conversation

PaulFarault
Copy link
Contributor

@PaulFarault PaulFarault commented Nov 10, 2023

Which issue(s) this PR fixes

Fixes None

Additional comments

wget used with both --no-clober and --output-document options exit with a non-zero status when the file already exist.
This cause the script to stop because of set -e. Hence, the script won't download the remaining files.

Agreements

@PaulFarault PaulFarault self-assigned this Nov 10, 2023
Copy link
Contributor

@kpgtek kpgtek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the alternative solution that you mentionned in the description is more suitable (than the use of || true).

@PaulFarault
Copy link
Contributor Author

@kpgtek I agree with you, I switch the PR to this version.

@kpgtek
Copy link
Contributor

kpgtek commented Nov 15, 2023

I think we need to keep and use file_name variable, in order to rename and to put the version in the file name, so the modification could be:

download_tdp_binaries() {
  while IFS=";" read -r uri_file_name file_name
  do
    if [[ -n "$file_name" ]]
    then
      local target_file=${file_name}
    else
      local target_file=${file_name:-$(basename ${uri_file_name})}
    fi
    wget --continue --output-document="files/${target_file}" ${uri_file_name}
  done < scripts/tdp-release-uris.txt
}

@PaulFarault
Copy link
Contributor Author

Thanks for your feedback @kpgtek!

@rpignolet rpignolet merged commit 06344fe into dev Nov 17, 2023
1 check passed
@rpignolet rpignolet deleted the fix-script branch November 17, 2023 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants