Repository navigation
contrib: add check for wget command in install_db4.sh - #23658
Merged
Merged
Conversation
shaavan
approved these changes
Dec 3, 2021
shaavan
left a comment
Contributor
There was a problem hiding this comment.
ACK b062da0
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:
Contributor
|
ACK b062da0 |
Member
|
Thanks for your contribution! $ 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 |
RandyMcMillan
pushed a commit
to RandyMcMillan/mempool-tab
that referenced
this pull request
Dec 23, 2021
…nstall_db4.sh 332d756 contrib: add check for wget command in install_db4.sh (Florian Baumgartl) Pull request description: This PR is motivated by bitcoin/bitcoin@917d12d commit (see also bitcoin/bitcoin#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. ACKs for top commit: jamesob: ACK bitcoin/bitcoin@332d756 laanwj: Tested ACK 332d756 shaavan: ACK 332d756 Tree-SHA512: bfc1ccad9a5b99764b759e02dde1976616c2af4747b7d5af8e71d33624c2cb21d93a09a60d244756e86bbd5fd7541331c62d7eb84d3458b6a059f1d9cb2a5f42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR is motivated by 7bb8eb0 commit (see also #23579) and ensures that
install_db4.shwill check forcurlandwgetutilities. Currently, the conditional statement in thehttp_get()function assumes thatwgetis always available but we actually do not know it since there is no check or validation for thewgetcommand. So let's make sure that we check for both commands and print an error message if they are missing.