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
0043e226
Commit
0043e226
authored
Aug 16, 2021
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools_eget: update from eget 4.1
parent
80e106e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
32 deletions
+19
-32
tools_eget
bin/tools_eget
+19
-32
No files found.
bin/tools_eget
View file @
0043e226
...
...
@@ -69,7 +69,6 @@ scat()
{
$CURL
-L
$CURLQ
"
$1
"
}
# download to default name of to $2
sget
()
{
...
...
@@ -94,6 +93,12 @@ if [ "$1" = "--latest" ] ; then
shift
fi
fatal
()
{
echo
"
$*
"
>
&2
exit
1
}
# check man glob
filter_glob
()
{
...
...
@@ -146,39 +151,23 @@ get_github_urls()
local
project
=
"
$(
echo
"
$1
"
|
sed
-e
"s|^https://github.com/
$owner
/||"
-e
"s|/.*||"
)
"
#"
[
-n
"
$owner
"
]
||
fatal
"Can't get owner from
$1
"
[
-n
"
$project
"
]
||
fatal
"Can't get project from
$1
"
local
URL
=
"https://api.github.com/repos/
$owner
/
$project
/releases
/latest
"
local
URL
=
"https://api.github.com/repos/
$owner
/
$project
/releases"
scat
$URL
|
\
grep
-i
-o
-E
'"browser_download_url": "https://.*"'
|
cut
-d
'"'
-f4
}
# mask allowed only in the last part of path
MASK
=
$(
basename
"
$1
"
)
NOMASK
=
''
# If have no wildcard symbol like asterisk, just download
if
echo
"
$MASK
"
|
grep
-qv
"[*?]"
||
echo
"
$MASK
"
|
grep
-q
"[?].*="
;
then
NOMASK
=
'1'
fi
if
echo
"
$1
"
|
grep
-q
"^https://github.com/"
&&
!
echo
"
$1
"
|
grep
-q
"/releases/download/"
;
then
if
echo
"
$1
"
|
grep
-q
"^https://github.com/"
;
then
MASK
=
"
$2
"
if
[
-n
"
$LISTONLY
"
]
;
then
fn
=
''
for
fn
in
$(
get_github_urls
"
$1
"
| filter_glob
"
$MASK
"
| filter_order
)
;
do
echo
"
$fn
"
done
test
-n
"
$fn
"
get_github_urls
"
$1
"
| filter_glob
"
$MASK
"
| filter_order
exit
fi
ERROR
=
0
fn
=
''
for
fn
in
$(
get_github_urls
"
$1
"
| filter_glob
"
$MASK
"
| filter_order
)
;
do
sget
"
$fn
"
||
ERROR
=
1
done
test
-n
"
$fn
"
||
ERROR
=
1
exit
$ERROR
exit
fi
...
...
@@ -195,40 +184,38 @@ if echo "$1" | grep -q "^ftp://" ; then
fi
# drop mask part
URL
=
"
$(
dirname
"
$1
"
)
"
URL
=
"
$(
dirname
"
$1
"
)
/
"
if
echo
"
$URL
"
|
grep
-q
"[*?]"
;
then
fatal
"Error: there are globbing symbols (*?) in
$URL
"
fi
# mask allowed only in the last part of path
MASK
=
$(
basename
"
$1
"
)
# If have no wildcard symbol like asterisk, just download
if
[
-n
"
$NOMASK
"
]
;
then
if
echo
"
$MASK
"
|
grep
-qv
"[*?]"
||
echo
"
$MASK
"
|
grep
-q
"[?].*="
;
then
sget
"
$1
"
"
$TARGETFILE
"
exit
fi
get_urls
()
{
scat
$URL
/
|
\
grep
-i
-o
-
P
'href="(.*?)"'
|
cut
-d
'"'
-f2
|
sed
-e
"s|^./||"
scat
$URL
|
\
grep
-i
-o
-
E
'href="([^\*/"#]+)"'
|
cut
-d
'"'
-f2
}
if
[
-n
"
$LISTONLY
"
]
;
then
fn
=
''
for
fn
in
$(
get_urls | filter_glob
"
$MASK
"
| filter_order
)
;
do
# TODO: return full url? someone use old behaviour?
echo
"
$
fn
"
|
sed
-e
"s|
$URL
/||
"
echo
"
$
(
basename
"
$fn
"
)
"
done
test
-n
"
$fn
"
exit
fi
ERROR
=
0
fn
=
''
for
fn
in
$(
get_urls | filter_glob
"
$MASK
"
| filter_order
)
;
do
echo
"
$fn
"
|
grep
-q
"://"
&&
furl
=
$fn
||
furl
=
"
$URL
/
$fn
"
sget
"
$furl
"
||
ERROR
=
1
sget
"
$URL
/
$(
basename
"
$fn
"
)
"
||
ERROR
=
1
done
test
-n
"
$fn
"
||
ERROR
=
1
exit
$ERROR
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