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
1410ac4b
Commit
1410ac4b
authored
Nov 10, 2017
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
download: add --check for print out three mirror url for a package
parent
51b141d5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
9 deletions
+53
-9
epm-download
bin/epm-download
+53
-9
No files found.
bin/epm-download
View file @
1410ac4b
#!/bin/sh
#
# Copyright (C) 2016 Etersoft
# Copyright (C) 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2016
-2017
Etersoft
# Copyright (C) 2016
-2017
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
...
...
@@ -17,6 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
alt_base_dist_url
=
"http://ftp.basealt.ru/pub/distributions"
__use_url_install
()
{
case
$DISTRNAME
in
...
...
@@ -128,7 +130,54 @@ __epm_get_altpkg_url()
# fixme: get from /branches
local
dv
=
$DISTRNAME
/
$DISTRVERSION
/branch
[
"
$DISTRVERSION
"
=
"Sisyphus"
]
&&
dv
=
$DISTRNAME
/
$DISTRVERSION
echo
"http://ftp.basealt.ru/pub/distributions/
$dv
/
$arch
/RPMS.classic/
$filename
"
echo
"
$alt_base_dist_url
/
$dv
/
$arch
/RPMS.classic/
$filename
"
}
__epm_print_url_alt
()
{
local
url
=
"
$1
"
echo
"
$url
"
echo
"
$url
"
|
sed
-e
"s|
$alt_base_dist_url
/
$DISTRNAME
|http://mirror.yandex.ru/altlinux|g"
echo
"
$url
"
|
sed
-e
"s|
$alt_base_dist_url
/
$DISTRNAME
|http://download.etersoft.ru/pub/ALTLinux|g"
}
__epm_print_url_alt_check
()
{
local
pkg
=
$1
shift
local
tm
=
$(
mktemp
)
epm assure curl
load_helper epm-site
quiet
=
1
local
buildtime
=
$(
paoapi packages/
$pkg
| get_pao_var buildtime
)
echo
echo
"Latest release:
$(
paoapi packages/
$pkg
| get_pao_var sourcepackage
)
$buildtime
"
__epm_print_url_alt
"
$1
"
|
while
read
url
;
do
curl
-s
--head
$url
>
$tm
||
{
echo
"
$url
: missed"
;
continue
;
}
local
http
=
$(
cat
$tm
|
grep
"^HTTP"
|
sed
-e
"s|
\r
||g"
)
local
lastdate
=
$(
cat
$tm
|
grep
"^Last-Modified:"
|
sed
-e
"s|
\r
||g"
)
local
size
=
$(
cat
$tm
|
grep
"^Content-Length:"
|
sed
-e
"s|^Content-Length: ||g"
|
sed
-e
"s|
\r
||g"
)
echo
"
$url
(
$http
$lastdate
) Size:
$size
"
done
rm
-f
$tm
}
__epm_download_alt
()
{
local
pkg
if
[
"
$1
"
=
"--check"
]
;
then
local
checkflag
=
"
$1
"
shift
fi
for
pkg
in
"
$@
"
;
do
local
url
=
$(
__epm_get_altpkg_url
$pkg
)
[
-n
"
$url
"
]
||
warning
"Can't get URL for
$pkg
"
if
[
-n
"
$checkflag
"
]
;
then
__epm_print_url_alt_check
"
$pkg
"
"
$url
"
else
docmd eget
$url
||
return
fi
done
}
epm_download
()
...
...
@@ -137,12 +186,7 @@ epm_download()
case
$DISTRNAME
in
ALTLinux
)
local
pkg
for
pkg
in
$pkg_filenames
;
do
local
url
=
$(
__epm_get_altpkg_url
$pkg
)
[
-n
"
$url
"
]
||
warning
"Can't get url for
$pkg
"
docmd eget
$url
done
__epm_download_alt
$pkg_filenames
return
;;
esac
...
...
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