Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eepm
Commits
3f8bd5d9
Commit
3f8bd5d9
authored
Apr 10, 2023
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eget: refactoring wget/curl detection
parent
b502033c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
8 deletions
+33
-8
tools_eget
bin/tools_eget
+33
-8
No files found.
bin/tools_eget
View file @
3f8bd5d9
...
...
@@ -685,7 +685,36 @@ fi
WGET
=
"
$(
print_command_path wget
)
"
CURL
=
"
$(
print_command_path curl
)
"
if
is_fileurl
"
$1
"
;
then
EGET_BACKEND
=
"file"
elif
is_ipfsurl
"
$1
"
;
then
EGET_BACKEND
=
"ipfs"
fi
case
"
$EGET_BACKEND
"
in
file|ipfs
)
;;
wget
)
[
-n
"
$WGET
"
]
||
fatal
"There are no wget in the system but you forced using it via EGET_BACKEND. Install it with
$
epm install wget"
;;
curl
)
[
-n
"
$CURL
"
]
||
fatal
"There are no curl in the system but you forced using it via EGET_BACKEND. Install it with
$
epm install curl"
;;
''
)
[
-n
"
$WGET
"
]
&&
EGET_BACKEND
=
"wget"
[
-z
"
$EGET_BACKEND
"
]
&&
[
-n
"
$CURL
"
]
&&
EGET_BACKEND
=
"curl"
[
-n
"
$EGET_BACKEND
"
]
||
fatal
"There are no wget nor curl in the system. Install something with
$
epm install wget"
;;
*
)
fatal
"Uknown EGET_BACKEND
$EGET_BACKEND
"
;;
esac
if
[
"
$EGET_BACKEND
"
=
"file"
]
;
then
# put remote content to stdout
url_scat
()
...
...
@@ -723,7 +752,7 @@ url_get_real_url()
echo
"
$1
"
}
elif
is_ipfsurl
"
$1
"
;
then
elif
[
"
$EGET_BACKEND
"
=
"ipfs"
]
;
then
# put remote content to stdout
url_scat
()
...
...
@@ -767,8 +796,7 @@ url_get_real_url()
}
elif
[
-n
"
$WGET
"
]
&&
[
"
$EGET_BACKEND
"
!=
"curl"
]
||
[
"
$EGET_BACKEND
"
=
"wget"
]
;
then
[
-n
"
$WGET
"
]
||
fatal
"There are no wget in the system but you forced using it via EGET_BACKEND. Install it with
$
epm install wget"
elif
[
"
$EGET_BACKEND
"
=
"wget"
]
;
then
__wget
()
{
if
[
-n
"
$WGETUSERAGENT
"
]
;
then
...
...
@@ -818,7 +846,7 @@ url_get_header()
{
local
URL
=
"
$1
"
local
HEADER
=
"
$2
"
url_get_headers
"
$URL
"
|
grep
"^
$HEADER
: "
|
sed
-e
"s|^
$HEADER
: ||
"
url_get_headers
"
$URL
"
|
grep
-i
"^
$HEADER
: "
|
sed
-e
"s|^
$HEADER
: ||i
"
}
url_get_real_url
()
...
...
@@ -858,9 +886,8 @@ url_get_filename()
basename
"
$(
url_get_real_url
"
$URL
"
)
"
}
elif
[
"
$EGET_BACKEND
"
=
"curl"
]
;
then
elif
[
-n
"
$CURL
"
]
&&
[
"
$EGET_BACKEND
"
!=
"wget"
]
||
[
"
$EGET_BACKEND
"
=
"curl"
]
;
then
[
-n
"
$CURL
"
]
||
fatal
"There are no curl in the system but you forced using it via EGET_BACKEND. Install it with
$
epm install curl"
__curl
()
{
if
[
-n
"
$CURLUSERAGENT
"
]
;
then
...
...
@@ -948,8 +975,6 @@ url_get_filename()
basename
"
$(
url_get_real_url
"
$URL
"
)
"
}
else
fatal
"There are no wget nor curl in the system. Install something with
$
epm install wget"
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment