contrib: add check for wget command in install_db4.sh #23658

pull Baumgartl wants to merge 1 commits into bitcoin:master from Baumgartl:contrib-patches changing 1 files +5 −2
  1. Baumgartl commented at 9:32 PM on December 2, 2021: contributor

    This PR is motivated by https://github.com/bitcoin/bitcoin/commit/7bb8eb0bc352b47ee962283898f9becbb4f36c62 commit (see also #23579) and ensures that install_db4.sh will check for curl and wget utilities. Currently, the conditional statement in the http_get() function assumes that wget is always available but we actually do not know it since there is no check or validation for the wget command. So let's make sure that we check for both commands and print an error message if they are missing.

  2. contrib: add check for wget command in install_db4.sh b062da0090
  3. DrahtBot added the label Scripts and tools on Dec 2, 2021
  4. shaavan approved
  5. shaavan commented at 1:03 PM on December 3, 2021: contributor

    ACK b062da009001c1beb362169d700663d7220eef5e

    It makes sense not to assume by default that wget is preinstalled on an OS. I found that curl and wget are not installed by default on Windows OS.

    In that case, running this file would cause a ‘wget not found’ error. Though a person might understand the error and solve it accordingly, it doesn’t hurt to make it more verbose and adequately explain that ‘both curl and wget are not available. Please install one.’

    Tested that the change works correctly by using the following patch:

    --- a/contrib/install_db4.sh
    +++ b/contrib/install_db4.sh
    @@ -53,9 +53,9 @@ http_get() {
       #
       if [ -f "${2}" ]; then
         echo "File ${2} already exists; not downloading again"
    -  elif check_exists curl; then
    +  elif ! check_exists curl; then
         curl --insecure --retry 5 "${1}" -o "${2}"
    -  elif check_exists wget; then
    +  elif ! check_exists wget; then
         wget --no-check-certificate "${1}" -O "${2}"
       else
         echo "Simple transfer utilities 'curl' and 'wget' not found. Please install one of them and try again."
    

    I got the following output with this patch:

    Screenshot:

    Screenshot from 2021-12-03 18-29-46

  6. laanwj commented at 1:50 PM on December 9, 2021: member

    Thanks for your contribution! Tested ACK b062da009001c1beb362169d700663d7220eef5e

    $ mkdir /tmp/bin
    $ ln -s $(which patch mkdir) /tmp/bin
    $ bash
    $ export PATH="/tmp/bin"
    $ contrib/install_db4.sh "$PWD"
    Simple transfer utilities 'curl' and 'wget' not found. Please install one of them and try again.
    $ exit
    
  7. laanwj merged this on Dec 9, 2021
  8. laanwj closed this on Dec 9, 2021

  9. sidhujag referenced this in commit e7ec69d106 on Dec 10, 2021
  10. RandyMcMillan referenced this in commit cd43b23135 on Dec 23, 2021
  11. DrahtBot locked this on Dec 9, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-02 12:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me