Skip to content

Commit

Permalink
fallback to fetch on FreeBSD
Browse files Browse the repository at this point in the history
Allow fetch to work out of the box on FreeBSD by falling through
to the base system "fetch" utility.
  • Loading branch information
lifanov authored and austin987 committed Feb 21, 2017
1 parent 492fdb3 commit 5facff5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/winetricks
Expand Up @@ -942,6 +942,14 @@ w_download_to()
${_W_cookiejar:+--cookie "$_W_cookiejar"} \
${_W_agent:+--user-agent "$_W_agent"} \
"$_W_url"
elif [ "${WINETRICKS_DOWNLOADER}" = "fetch" ]
then
# shellcheck disable=SC2086
$torify fetch \
-T "${WINETRICKS_DOWNLOADER_TIMEOUT}" \
-o "$_W_file" \
${_W_agent:+--user-agent="$_W_agent"} \
"$_W_url"
else
w_die "Here be dragons"
fi
Expand Down Expand Up @@ -2618,18 +2626,20 @@ winetricks_download_setup()
{
# shellcheck disable=SC2104
case "${WINETRICKS_DOWNLOADER}" in
aria2c|curl|wget) : ;;
aria2c|curl|wget|fetch) : ;;
"") if [ -x "$(which aria2c 2>/dev/null)" ] ; then
WINETRICKS_DOWNLOADER="aria2c"
elif [ -x "$(which wget 2>/dev/null)" ] ; then
WINETRICKS_DOWNLOADER="wget"
elif [ -x "$(which curl 2>/dev/null)" ] ; then
WINETRICKS_DOWNLOADER="curl"
elif [ -x "$(which fetch 2>/dev/null)" ] ; then
WINETRICKS_DOWNLOADER="fetch"
else
w_die "Please install wget or aria2c (or, if those aren't available, curl)"
fi
;;
*) w_die "Invalid value ${WINETRICKS_DOWNLOADER} given for WINETRICKS_DOWNLOADER. Possible values: aria2c, curl, wget"
*) w_die "Invalid value ${WINETRICKS_DOWNLOADER} given for WINETRICKS_DOWNLOADER. Possible values: aria2c, curl, wget, fetch"
esac

# Common values for aria2c/curl/wget
Expand Down

0 comments on commit 5facff5

Please sign in to comment.