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
Vladislav
eepm
Commits
b9d61607
Commit
b9d61607
authored
1 year ago
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eget: add --get-filename, get_filename
parent
37292f11
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
tools_eget
bin/tools_eget
+38
-0
No files found.
bin/tools_eget
View file @
b9d61607
...
...
@@ -259,6 +259,7 @@ CURLNAMEOPTIONS='--remote-name --remote-header-name'
LISTONLY
=
''
CHECKURL
=
''
GETFILENAME
=
''
LATEST
=
''
SECONDLATEST
=
''
CHECKMIRRORS
=
''
...
...
@@ -293,6 +294,7 @@ Options:
--list|--list-only - print only URLs
--check URL - check if the URL is accessible (returns HTTP 200 OK)
--get-filename URL - print filename for the URL (via Content-Disposition if applicable)
Examples:
$
eget http://ftp.somesite.ru/package-*.x64.tar
...
...
@@ -347,6 +349,9 @@ while [ -n "$1" ] ; do
CHECKURL
=
"
$1
"
#set_quiet
;;
--get-filename
)
GETFILENAME
=
"
$1
"
;;
--latest
)
LATEST
=
"
$1
"
;;
...
...
@@ -574,6 +579,12 @@ url_check()
test
-f
"
$(
path_from_url
"
$URL
"
)
"
}
url_get_filename
()
{
# FIXME
basename
"
$1
"
}
elif
is_ipfsurl
"
$1
"
;
then
# put remote content to stdout
...
...
@@ -643,6 +654,12 @@ url_check()
__wget
--spider
-S
"
$URL
"
2>&1 |
grep
"HTTP/"
|
tail
-n1
|
grep
-q
"200"
}
url_get_filename
()
{
# FIXME
basename
"
$1
"
}
else
CURL
=
"
$(
print_command_path curl
)
"
[
-n
"
$CURL
"
]
||
fatal
"There are no wget nor curl in the system. Install it with
$
epm install curl"
...
...
@@ -682,6 +699,13 @@ url_check()
__curl
-LI
"
$URL
"
2>&1 |
grep
"HTTP/"
|
tail
-n1
|
grep
-q
-w
"200
\|
404"
}
url_get_filename
()
{
# FIXME
basename
"
$1
"
}
fi
...
...
@@ -700,6 +724,15 @@ check_url_is_accessible()
{
url_check
"
$@
"
}
get_filename
()
{
url_get_filename
"
$1
"
}
fi
get_github_urls
()
{
# https://github.com/OWNER/PROJECT
...
...
@@ -768,6 +801,11 @@ if [ -n "$CHECKURL" ] ; then
exit
fi
if
[
-n
"
$GETFILENAME
"
]
;
then
get_filename
"
$1
"
exit
fi
# separate part for github downloads
if
echo
"
$1
"
|
grep
-q
"^https://github.com/"
&&
\
...
...
This diff is collapsed.
Click to expand it.
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