mirror of
https://github.com/endeavouros-team/eos-pkgbuild-setup.git
synced 2026-06-13 01:54:36 +00:00
[eos-pkgbuild-setup] removed experimental wgetc
This commit is contained in:
@@ -284,7 +284,7 @@ _fetch_that_file() {
|
||||
[ "$file" != "-" ] && out="--output '$file'"
|
||||
curl --silent --location --max-time 10 $out "$url"
|
||||
else
|
||||
wgetc -q --timeout=10 -O"$file" "$url"
|
||||
wget -q --timeout=10 -O"$file" "$url"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -39,13 +39,13 @@ Main() {
|
||||
|
||||
Pushd "$builddir"
|
||||
|
||||
wgetc -q --timeout=10 "$conf" || {
|
||||
wget -q --timeout=10 "$conf" || {
|
||||
Popd
|
||||
WARN "file '$conf' not found."
|
||||
rmdir "$builddir"
|
||||
continue
|
||||
}
|
||||
wgetc -q --timeout=10 "$conf".$sigend || {
|
||||
wget -q --timeout=10 "$conf".$sigend || {
|
||||
Popd
|
||||
WARN "file '$conf.$sigend' not found."
|
||||
rmdir "$builddir"
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ ContentsCheck() {
|
||||
|
||||
pushd $tmpdir >/dev/null
|
||||
if false ; then
|
||||
wgetc -q --timeout=20 --show-progress $remfiles || failcode=$?
|
||||
wget -q --timeout=20 --show-progress $remfiles || failcode=$?
|
||||
else
|
||||
curl --location --remote-time --max-time 20 --remote-name-all --progress-bar --fail $remfiles || failcode=$?
|
||||
fi
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Implement (a limited subset of) wget with curl.
|
||||
# Note: this is still in experimental state, since no thorough testing has been done.
|
||||
|
||||
echo2() { echo "$@" >&2 ; }
|
||||
ERROR() { echo2 "$progname: error: $1" ; }
|
||||
DIE() { ERROR "$1" ; exit 1 ; }
|
||||
CurlExit() {
|
||||
local ecode="$1"
|
||||
echo2 "==> '${cmd[*]}' failed:"
|
||||
curl-exit-code-to-string "$ecode"
|
||||
exit $ecode
|
||||
}
|
||||
|
||||
SupportedOptions() {
|
||||
local lo=${LOPTS//:/}
|
||||
lo="--${lo//,/ --}"
|
||||
local so=${SOPTS//:/}
|
||||
so=$(echo "$so" | sed -E 's|([a-zA-Z])| -\1|g')
|
||||
echo "$lo$so"
|
||||
}
|
||||
|
||||
Usage() {
|
||||
local opts=$(printf "%s\n" $(SupportedOptions) | sed 's|^| |')
|
||||
cat <<EOF
|
||||
$progname is a limited 'wget' by supporting a subset of 'wget' options using 'curl'.
|
||||
See also: man wget
|
||||
|
||||
$progname supports the following options of 'wget':
|
||||
$opts
|
||||
EOF
|
||||
}
|
||||
|
||||
Options() {
|
||||
# The only options supported here:
|
||||
local LOPTS="continue,directory-prefix:,help,output-document:,passive-ftp,quiet,show-command"
|
||||
LOPTS+=",show-progress,supported-options,timeout:,timestamping,user-agent:"
|
||||
local SOPTS="cP:O:qT:NU:h"
|
||||
local opts
|
||||
local has_output=no
|
||||
|
||||
# local args="[no-wget]"
|
||||
# [ -x $wget ] && args=("$@") # save args for the real wget
|
||||
|
||||
opts="$(LANG=C /usr/bin/getopt -o="$SOPTS" --longoptions "$LOPTS" --name "$progname" -- "$@")" || {
|
||||
Usage
|
||||
exit 1
|
||||
}
|
||||
|
||||
eval set -- "$opts"
|
||||
|
||||
while true ; do
|
||||
case "$1" in
|
||||
# wget # curl
|
||||
--continue | -c) cmd+=(--continue-at -) ;;
|
||||
--directory-prefix | -P) cmd+=(--output-dir "$2"); shift; has_output=yes ;; # ??
|
||||
--output-document | -O) cmd+=(--output "$2"); shift; has_output=yes ;;
|
||||
--passive-ftp) cmd+=(--disable-epsv) ;; # ??
|
||||
--quiet | -q) cmd+=(--silent); ;;
|
||||
--show-progress) cmd+=(--progress-bar) ;;
|
||||
--timeout | -T) cmd+=(--max-time "$2"); shift ;;
|
||||
--timestamping | -N) cmd+=(--remote-time) ;;
|
||||
--user-agent | -U) cmd+=(--user-agent "$2"); shift ;;
|
||||
--help | -h) Usage; exit 0 ;;
|
||||
|
||||
# extra options (not in wget)
|
||||
--show-command) hide_command=no ;;
|
||||
--supported-options) SupportedOptions; exit 0 ;;
|
||||
|
||||
# exit condition
|
||||
--) shift; break ;;
|
||||
|
||||
# -*) DIE "internal error: unsupported option '$1'" ;; # this line is not really needed
|
||||
esac
|
||||
shift
|
||||
done
|
||||
if [ -n "$1" ] ; then
|
||||
[ "$has_output" = "no" ] && cmd+=(--remote-name-all)
|
||||
cmd+=("$@")
|
||||
fi
|
||||
}
|
||||
|
||||
Main() {
|
||||
local progname="${0##*/}"
|
||||
local wget=/bin/wget
|
||||
local cmd=(/usr/bin/curl --fail --location --progress-bar)
|
||||
local hide_command=yes
|
||||
|
||||
Options "$@"
|
||||
|
||||
[ $hide_command = yes ] || echo2 "==> ${cmd[*]}"
|
||||
"${cmd[@]}" || CurlExit $?
|
||||
}
|
||||
|
||||
Main "$@"
|
||||
Reference in New Issue
Block a user