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
30682a2e
Commit
30682a2e
authored
Oct 23, 2020
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools_eget: add --latest support
parent
430a5ab6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
tools_eget
bin/tools_eget
+17
-4
No files found.
bin/tools_eget
View file @
30682a2e
...
...
@@ -3,9 +3,9 @@
# Example use:
# eget http://ftp.altlinux.ru/pub/security/ssl/*
#
# Copyright (C) 2014-2014, 2016 Etersoft
# Copyright (C) 2014-2014, 2016
, 2020
Etersoft
# Copyright (C) 2014 Daniil Mikhailov <danil@etersoft.ru>
# Copyright (C) 2016-2017 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2016-2017
, 2020
Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
...
...
@@ -29,11 +29,18 @@ if [ "$1" = "-q" ] ; then
shift
fi
LISTONLY
=
''
if
[
"
$1
"
=
"--list"
]
;
then
LISTONLY
=
"
$1
"
shift
fi
LATEST
=
''
if
[
"
$1
"
=
"--latest"
]
;
then
LATEST
=
"
$1
"
shift
fi
fatal
()
{
echo
"
$*
"
>
&2
...
...
@@ -47,6 +54,11 @@ filter_glob()
grep
"^
$(
echo
"
$1
"
|
sed
-e
"s|
\*
|.*|g"
-e
"s|?|.|g"
)
$"
}
filter_order
()
{
[
-z
"
$LATEST
"
]
&&
cat
&&
return
sort
|
tail
-n1
}
# download to this file
WGET_OPTION_TARGET
=
...
...
@@ -69,6 +81,7 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
echo
"Usage: eget [-O target file] [--list] http://somesite.ru/dir/na*.log"
echo
"Options:"
echo
" --list - print files frm url with mask"
echo
" --latest - print only latest version of file"
echo
wget
--help
exit
...
...
@@ -110,14 +123,14 @@ get_urls()
if
[
-n
"
$LISTONLY
"
]
;
then
WGET
=
"
$WGET
-q"
for
fn
in
$(
get_urls | filter_glob
"
$MASK
"
)
;
do
for
fn
in
$(
get_urls | filter_glob
"
$MASK
"
| filter_order
)
;
do
echo
"
$(
basename
"
$fn
"
)
"
done
exit
fi
ERROR
=
0
for
fn
in
$(
get_urls | filter_glob
"
$MASK
"
)
;
do
for
fn
in
$(
get_urls | filter_glob
"
$MASK
"
| filter_order
)
;
do
$WGET
"
$URL
/
$(
basename
"
$fn
"
)
"
||
ERROR
=
1
done
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