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
Nurlan
eepm
Commits
31994fe4
Commit
31994fe4
authored
Aug 01, 2022
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eget: add --check support for check url if accessible
parent
faa7beda
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
tools_eget
bin/tools_eget
+23
-0
No files found.
bin/tools_eget
View file @
31994fe4
...
...
@@ -174,6 +174,12 @@ sget()
fi
}
check_url_http
()
{
local
URL
=
"
$1
"
__wget
--spider
-S
"
$URL
"
2>&1 |
grep
"HTTP"
|
tail
-n1
|
grep
-q
-w
"200
\|
301"
}
else
CURL
=
"
$(
which curl 2>/dev/null
)
"
[
-n
"
$CURL
"
]
||
fatal
"There are no wget nor curl in the system. Install it with
$
epm install curl"
...
...
@@ -201,6 +207,13 @@ sget()
__curl
$CURLNAMEOPTIONS
"
$1
"
fi
}
check_url_http
()
{
local
URL
=
"
$1
"
__curl
-I
"
$URL
"
2>&1 |
grep
"HTTP"
|
tail
-n1
|
grep
-q
-w
"200
\|
301"
}
fi
LISTONLY
=
''
...
...
@@ -210,6 +223,14 @@ if [ "$1" = "--list" ] ; then
shift
fi
if
[
"
$1
"
=
"--check"
]
;
then
set_quiet
shift
check_url_http
"
$1
"
exit
fi
LATEST
=
''
if
[
"
$1
"
=
"--latest"
]
;
then
LATEST
=
"
$1
"
...
...
@@ -264,6 +285,7 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
echo
" -U|-A|--user-agent - send browser like UserAgent"
echo
" -O file - download to this file (use filename from server if missed)"
echo
" --list - print files from url with mask"
echo
" --check - check if URL is accessible (returns HTTP 200 OK)"
echo
" --latest - print only latest version of a file"
echo
echo
"eget supports --list and download for https://github.com/owner/project urls"
...
...
@@ -271,6 +293,7 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
echo
"Examples:"
echo
"
$
eget --list http://ftp.somesite.ru/package-*.tar"
echo
"
$
eget http://ftp.somesite.ru/package-*.x64.tar"
echo
"
$
eget --check http://ftp.somesite.ru/test"
echo
"
$
eget --list http://download.somesite.ru 'package-*.tar.xz'"
echo
"
$
eget --list --latest https://github.com/telegramdesktop/tdesktop/releases 'tsetup.*.tar.xz'"
# echo "See $ wget --help for wget options you can use here"
...
...
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