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
7cc72170
Commit
7cc72170
authored
Nov 19, 2017
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Plain Diff
backported to p8 as 2.3.1-alt0.M80P.1 (with rpmbph script)
parents
f79977d3
c2b8ffc0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
560 additions
and
140 deletions
+560
-140
TODO
TODO
+5
-2
epm
bin/epm
+5
-4
epm-autoorphans
bin/epm-autoorphans
+3
-3
epm-autoremove
bin/epm-autoremove
+11
-4
epm-checkpkg
bin/epm-checkpkg
+2
-0
epm-clean
bin/epm-clean
+1
-1
epm-download
bin/epm-download
+67
-16
epm-epm_install
bin/epm-epm_install
+40
-5
epm-info
bin/epm-info
+1
-0
epm-install
bin/epm-install
+6
-1
epm-query_file
bin/epm-query_file
+2
-2
epm-release_upgrade
bin/epm-release_upgrade
+70
-21
epm-remove
bin/epm-remove
+12
-3
epm-repofix
bin/epm-repofix
+1
-1
epm-sh-altlinux
bin/epm-sh-altlinux
+2
-1
epm-sh-functions
bin/epm-sh-functions
+19
-3
epm-whatdepends
bin/epm-whatdepends
+3
-1
tools_eget
bin/tools_eget
+61
-37
check_code.sh
check_code.sh
+1
-0
eepm.spec
eepm.spec
+35
-4
pack_in_onefile.sh
pack_in_onefile.sh
+13
-8
epm.sh
packed/epm.sh
+0
-0
serv.sh
packed/serv.sh
+200
-23
No files found.
TODO
View file @
7cc72170
https://wiki.archlinux.org/index.php/Pacman/Tips_and_tricks_(Русский)
systemctl edit юнит
systemctl edit юнит
аналог epm purge: запоминаем список файлов, удаляем пакеты и по возможности всё, от чего зависит (рекурсивно).
аналог epm purge: запоминаем список файлов, удаляем пакеты и по возможности всё, от чего зависит (рекурсивно).
...
@@ -9,12 +11,13 @@ systemctl edit юнит
...
@@ -9,12 +11,13 @@ systemctl edit юнит
хочется видеть прямые зависимости, обратные, и рекурсивно.
хочется видеть прямые зависимости, обратные, и рекурсивно.
выводить в цивилизованном виде (в прямом только с --direct)
выводить в цивилизованном виде (в прямом только с --direct)
Синхронизация списков файлов по пакетам:
rsync -av --inplace --progress --compress
rsync -av --inplace --progress --compress
Но лучше получать с сервиса
epm sf - скачивание через rsync -z для компактности?
epmqp uuid на x86_64/Ubuntu не различает архитектуру
epmqp uuid на x86_64/Ubuntu не различает архитектуру
eon sf - скачивание через rsync -z для компактности?
get system checking
get system checking
https://github.com/gwicke/mediawiki-containers
https://github.com/gwicke/mediawiki-containers
...
...
bin/epm
View file @
7cc72170
...
@@ -204,7 +204,7 @@ check_command()
...
@@ -204,7 +204,7 @@ check_command()
provides|prov
)
# HELPCMD: print package provides
provides|prov
)
# HELPCMD: print package provides
epm_cmd
=
provides
epm_cmd
=
provides
;;
;;
whatdepends
)
# HELPCMD: print packages dependences on that
whatdepends
|wd|rdepends
)
# HELPCMD: print packages dependences on that
epm_cmd
=
whatdepends
epm_cmd
=
whatdepends
;;
;;
whatprovides
)
# HELPCMD: print packages provides that target
whatprovides
)
# HELPCMD: print packages provides that target
...
@@ -274,6 +274,7 @@ check_command()
...
@@ -274,6 +274,7 @@ check_command()
download
)
# HELPCMD: download package(s) file to the current dir
download
)
# HELPCMD: download package(s) file to the current dir
epm_cmd
=
download
epm_cmd
=
download
;;
;;
# TODO: replace with install --simulate
simulate
)
# HELPCMD: simulate install with check requires
simulate
)
# HELPCMD: simulate install with check requires
epm_cmd
=
simulate
epm_cmd
=
simulate
;;
;;
...
@@ -286,7 +287,7 @@ check_command()
...
@@ -286,7 +287,7 @@ check_command()
site|url
)
# HELPCMD: open package's site in a browser (use -p for open packages.altlinux.org site)
site|url
)
# HELPCMD: open package's site in a browser (use -p for open packages.altlinux.org site)
epm_cmd
=
site
epm_cmd
=
site
;;
;;
ei|
epminstall|epm-install|selfinstall
)
# HELPCMD: install or update eepm package from all in one script
ei|
ik|epminstall|epm-install|selfinstall
)
# HELPCMD: install package(s) from Korinf (eepm by default)
epm_cmd
=
epm_install
epm_cmd
=
epm_install
;;
;;
print
)
# HELPCMD: print various info, run epm print help for details
print
)
# HELPCMD: print various info, run epm print help for details
...
@@ -323,7 +324,7 @@ check_option()
...
@@ -323,7 +324,7 @@ check_option()
--show-command-only
)
# HELPOPT: show command only, do not any action (supports install and remove ONLY)
--show-command-only
)
# HELPOPT: show command only, do not any action (supports install and remove ONLY)
show_command_only
=
1
show_command_only
=
1
;;
;;
--quiet
)
# HELPOPT: quiet mode (do not print commands before exec)
--quiet
|
--silent
)
# HELPOPT: quiet mode (do not print commands before exec)
quiet
=
1
quiet
=
1
;;
;;
--nodeps
)
# HELPOPT: skip dependency check (during install/simulate and so on)
--nodeps
)
# HELPOPT: skip dependency check (during install/simulate and so on)
...
@@ -335,7 +336,7 @@ check_option()
...
@@ -335,7 +336,7 @@ check_option()
--noremove
|
--no-remove
)
# HELPOPT: exit if any packages are to be removed during upgrade
--noremove
|
--no-remove
)
# HELPOPT: exit if any packages are to be removed during upgrade
noremove
=
"--no-remove"
noremove
=
"--no-remove"
;;
;;
--dry-run
|
--simulate
|
--just-print
|
-recon--no-act
)
# HELPOPT: print only (autoremove/autoorphans only)
--dry-run
|
--simulate
|
--just-print
|
-recon--no-act
)
# HELPOPT: print only (autoremove/autoorphans
/remove
only)
dryrun
=
"--dry-run"
dryrun
=
"--dry-run"
;;
;;
--short
)
# HELPOPT: short output (just 'package' instead 'package-version-release')
--short
)
# HELPOPT: short output (just 'package' instead 'package-version-release')
...
...
bin/epm-autoorphans
View file @
7cc72170
...
@@ -88,10 +88,10 @@ case $PMTYPE in
...
@@ -88,10 +88,10 @@ case $PMTYPE in
sudocmd pacman
-Qdtq
| sudocmd pacman
-Rs
-
sudocmd pacman
-Qdtq
| sudocmd pacman
-Rs
-
fi
fi
;;
;;
#
slackpkg)
slackpkg
)
# clean-system removes non official packages
# clean-system removes non official packages
#
sudocmd slackpkg clean-system
sudocmd slackpkg clean-system
#
;;
;;
#guix)
#guix)
# sudocmd guix gc
# sudocmd guix gc
# ;;
# ;;
...
...
bin/epm-autoremove
View file @
7cc72170
...
@@ -69,12 +69,12 @@ __epm_autoremove_altrpm_lib()
...
@@ -69,12 +69,12 @@ __epm_autoremove_altrpm_lib()
local
force
=
force
local
force
=
force
local
flag
=
local
flag
=
local
lib
exclude
=
'^(lib|i586-
lib)'
local
lib
grep
=
'^(lib|i586-lib|bzlib|z
lib)'
[
-n
"
$force
"
]
||
libexclude
=
$lib
exclude
'[^-]*$'
[
-n
"
$force
"
]
||
libexclude
=
$lib
grep
'[^-]*$'
# https://www.altlinux.org/APT_в_ALT_Linux/Советы_по_использованию#apt-cache_list-nodeps
# https://www.altlinux.org/APT_в_ALT_Linux/Советы_по_использованию#apt-cache_list-nodeps
showcmd
"apt-cache list-nodeps | grep -
-
\"
$libexclude
\"
"
showcmd
"apt-cache list-nodeps | grep -
E --
\"
$libgrep
\"
"
pkgs
=
$(
apt-cache list-nodeps |
grep
-E
--
"
$lib
exclude
"
\
pkgs
=
$(
apt-cache list-nodeps |
grep
-E
--
"
$lib
grep
"
\
|
sed
-e
"s/[-
\.
]32bit
$/
/g"
\
|
sed
-e
"s/[-
\.
]32bit
$/
/g"
\
|
grep
-E
-v
--
"
$develrule
"
\
|
grep
-E
-v
--
"
$develrule
"
\
|
grep
-E
-v
--
"-(debuginfo)$"
\
|
grep
-E
-v
--
"-(debuginfo)$"
\
...
@@ -87,6 +87,13 @@ __epm_autoremove_altrpm_lib()
...
@@ -87,6 +87,13 @@ __epm_autoremove_altrpm_lib()
return
0
return
0
fi
fi
# commented, with hi probability user install i586- manually
# workaround against missed i586- handling in apt-cache list-nodeps
if
epmqp i586-lib
>
/dev/null
;
then
info
"You can try removing i586- with follow command"
showcmd rpm
-v
-e
$(
epmqp i586-lib
)
fi
[
-n
"
$pkgs
"
]
&&
sudocmd rpm
-v
-e
$pkgs
&&
flag
=
1
[
-n
"
$pkgs
"
]
&&
sudocmd rpm
-v
-e
$pkgs
&&
flag
=
1
if
[
-n
"
$flag
"
]
;
then
if
[
-n
"
$flag
"
]
;
then
...
...
bin/epm-checkpkg
View file @
7cc72170
...
@@ -58,6 +58,7 @@ case $PMTYPE in
...
@@ -58,6 +58,7 @@ case $PMTYPE in
docmd rpm
-V
$@
docmd rpm
-V
$@
;;
;;
*
-dpkg
)
*
-dpkg
)
assure_exists debsums
docmd debsums
$@
docmd debsums
$@
;;
;;
emerge
)
emerge
)
...
@@ -98,6 +99,7 @@ epm_checkpkg()
...
@@ -98,6 +99,7 @@ epm_checkpkg()
# TODO: reinvent
# TODO: reinvent
[
-n
"
$to_remove_pkg_files
"
]
&&
rm
-fv
$to_remove_pkg_files
[
-n
"
$to_remove_pkg_files
"
]
&&
rm
-fv
$to_remove_pkg_files
[
-n
"
$to_remove_pkg_files
"
]
&&
rmdir
-v
$(
dirname
$to_remove_pkg_files
|
head
-n1
)
2>/dev/null
#fatal "Broken package $pkg"
#fatal "Broken package $pkg"
return
$RETVAL
return
$RETVAL
...
...
bin/epm-clean
View file @
7cc72170
...
@@ -64,7 +64,7 @@ case $PMTYPE in
...
@@ -64,7 +64,7 @@ case $PMTYPE in
sudocmd urpmi
--clean
sudocmd urpmi
--clean
;;
;;
pacman
)
pacman
)
sudocmd pacman
-Sc
sudocmd pacman
-Sc
--noconfirm
;;
;;
zypper-rpm
)
zypper-rpm
)
sudocmd zypper clean
sudocmd zypper clean
...
...
bin/epm-download
View file @
7cc72170
#!/bin/sh
#!/bin/sh
#
#
# Copyright (C) 2016 Etersoft
# Copyright (C) 2016
-2017
Etersoft
# Copyright (C) 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2016
-2017
Vitaly Lipatov <lav@etersoft.ru>
#
#
# This program is free software: you can redistribute it and/or modify
# 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
# it under the terms of the GNU Affero General Public License as published by
...
@@ -17,12 +17,16 @@
...
@@ -17,12 +17,16 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# 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
()
__use_url_install
()
{
{
case
$DISTRNAME
in
case
$DISTRNAME
in
"ALTLinux"
)
"ALTLinux"
)
#
not for https
#
do not support https yet
echo
"
$pkg_urls
"
|
grep
-q
"https://"
&&
return
1
echo
"
$pkg_urls
"
|
grep
-q
"https://"
&&
return
1
# force download if wildcard is used
echo
"
$pkg_urls
"
|
grep
-q
"[?*]"
&&
return
1
pkg_names
=
"
$pkg_names
$pkg_urls
"
pkg_names
=
"
$pkg_names
$pkg_urls
"
return
0
return
0
;;
;;
...
@@ -60,16 +64,21 @@ __download_pkg_urls()
...
@@ -60,16 +64,21 @@ __download_pkg_urls()
local
url
local
url
[
-z
"
$pkg_urls
"
]
&&
return
[
-z
"
$pkg_urls
"
]
&&
return
for
url
in
$pkg_urls
;
do
for
url
in
$pkg_urls
;
do
# TODO: use some individual tmp dir
local
tmppkg
=
$(
mktemp
-d
)
||
fatal
"failed mktemp -d"
local
new_file
=
/tmp/
$(
basename
"
$url
"
)
cd
$tmppkg
||
fatal
if
docmd eget
-O
$new_file
$url
&&
[
-s
"
$new_file
"
]
;
then
if
docmd eget
"
$url
"
;
then
pkg_files
=
"
$pkg_files
$new_file
"
local
i
to_remove_pkg_files
=
"
$to_remove_pkg_files
$new_file
"
for
i
in
$(
basename
$url
)
;
do
[
-s
"
$tmppkg
/
$i
"
]
||
continue
pkg_files
=
"
$pkg_files
$tmppkg
/
$i
"
to_remove_pkg_files
=
"
$to_remove_pkg_files
$tmppkg
/
$i
"
done
else
else
warning
"Failed to download
$url
, ignoring"
warning
"Failed to download
$url
, ignoring"
fi
fi
cd
-
>
/dev/null
done
done
# re
store
# re
construct
pkg_filenames
=
$(
strip_spaces
"
$pkg_files
$pkg_names
"
)
pkg_filenames
=
$(
strip_spaces
"
$pkg_files
$pkg_names
"
)
}
}
...
@@ -121,7 +130,54 @@ __epm_get_altpkg_url()
...
@@ -121,7 +130,54 @@ __epm_get_altpkg_url()
# fixme: get from /branches
# fixme: get from /branches
local
dv
=
$DISTRNAME
/
$DISTRVERSION
/branch
local
dv
=
$DISTRNAME
/
$DISTRVERSION
/branch
[
"
$DISTRVERSION
"
=
"Sisyphus"
]
&&
dv
=
$DISTRNAME
/
$DISTRVERSION
[
"
$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
()
epm_download
()
...
@@ -130,12 +186,7 @@ epm_download()
...
@@ -130,12 +186,7 @@ epm_download()
case
$DISTRNAME
in
case
$DISTRNAME
in
ALTLinux
)
ALTLinux
)
local
pkg
__epm_download_alt
$pkg_filenames
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
return
return
;;
;;
esac
esac
...
...
bin/epm-epm_install
View file @
7cc72170
...
@@ -20,11 +20,46 @@
...
@@ -20,11 +20,46 @@
load_helper epm-install
load_helper epm-install
epm_epm_install
(){
__epm_korinf_site
()
{
assure_exists wget
local
archprefix
=
""
local
etersoft_updates_site
=
"http://updates.etersoft.ru/pub/Korinf/
$(
$DISTRVENDOR
-e
)
"
[
"
$(
$DISTRVENDOR
-b
)
"
=
"64"
]
&&
archprefix
=
"x86_64/"
# FIXME: some way to get latest package
local
aftername
=
"-"
local
download_link
=
$etersoft_updates_site
/
$(
wget
-qO-
$etersoft_updates_site
/ |
grep
-m1
-Eo
"eepm[^
\"
]+
\.
$(
$DISTRVENDOR
-p
)
"
|
tail
-n1
)
#"
[
"
$(
$DISTRVENDOR
-p
)
"
=
"deb"
]
&&
aftername
=
"_"
echo
"http://updates.etersoft.ru/pub/Korinf/
$archprefix
$(
$DISTRVENDOR
-e
)
"
}
__epm_korinf_list
()
{
[
"
$1
"
=
"--list"
]
&&
shift
local
MASK
=
"
$1
"
showcmd eget
--list
"
$(
__epm_korinf_site
)
/
$MASK
*.
$(
$DISTRVENDOR
-p
)
"
eget
--list
"
$(
__epm_korinf_site
)
/
$MASK
*.
$(
$DISTRVENDOR
-p
)
"
|
sort
}
__epm_korinf_install
(){
local
PACKAGE
=
"
$1
"
# FIXME: some way to get latest package
local
fn
=
"
$(
__epm_korinf_list
$PACKAGE$aftername
|
tail
-n1
)
"
[
-n
"
$fn
"
]
||
fatal
"Can't find package file for
$PACKAGE
"
local
download_link
=
$(
__epm_korinf_site
)
/
$fn
#info "Install $download_link ..."
pkg_names
=
''
pkg_files
=
''
pkg_urls
=
"
$download_link
"
epm_install
pkg_names
=
''
pkg_files
=
''
pkg_urls
=
"
$download_link
"
epm_install
}
}
epm_epm_install
(){
local
i
local
pkglist
=
"
$pkg_filenames
"
# install epm by default
[
-n
"
$pkglist
"
]
||
pkglist
=
"eepm"
case
"
$pkglist
"
in
--list
*
)
__epm_korinf_list
$pkglist
return
;;
esac
for
i
in
$pkglist
;
do
__epm_korinf_install
$i
done
}
bin/epm-info
View file @
7cc72170
...
@@ -150,6 +150,7 @@ local RETVAL=$?
...
@@ -150,6 +150,7 @@ local RETVAL=$?
# TODO: reinvent
# TODO: reinvent
[
-n
"
$to_remove_pkg_files
"
]
&&
rm
-fv
$to_remove_pkg_files
[
-n
"
$to_remove_pkg_files
"
]
&&
rm
-fv
$to_remove_pkg_files
[
-n
"
$to_remove_pkg_files
"
]
&&
rmdir
-v
$(
dirname
$to_remove_pkg_files
|
head
-n1
)
2>/dev/null
return
$RETVAL
return
$RETVAL
}
}
bin/epm-install
View file @
7cc72170
...
@@ -478,7 +478,9 @@ epm_install_files()
...
@@ -478,7 +478,9 @@ epm_install_files()
epm_print_install_command
()
epm_print_install_command
()
{
{
[
-z
"
$1
"
]
&&
return
# print out low level command by default (wait --low-level for control it)
#[ -z "$1" ] && return
[
-z
"
$1
"
]
&&
[
-n
"
$pkg_names
"
]
&&
return
case
$PMTYPE
in
case
$PMTYPE
in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm
)
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm
)
echo
"rpm -Uvh --force
$nodeps
$*
"
echo
"rpm -Uvh --force
$nodeps
$*
"
...
@@ -533,6 +535,8 @@ epm_print_install_command()
...
@@ -533,6 +535,8 @@ epm_print_install_command()
epm_print_install_names_command
()
epm_print_install_names_command
()
{
{
# check for pkg_files to support print out command without pkg names in args
#[ -z "$1" ] && [ -n "$pkg_files" ] && return
[
-z
"
$1
"
]
&&
return
[
-z
"
$1
"
]
&&
return
case
$PMTYPE
in
case
$PMTYPE
in
apt-rpm|apt-dpkg
)
apt-rpm|apt-dpkg
)
...
@@ -619,6 +623,7 @@ epm_install()
...
@@ -619,6 +623,7 @@ epm_install()
# TODO: reinvent
# TODO: reinvent
[
-n
"
$to_remove_pkg_files
"
]
&&
rm
-fv
$to_remove_pkg_files
[
-n
"
$to_remove_pkg_files
"
]
&&
rm
-fv
$to_remove_pkg_files
[
-n
"
$to_remove_pkg_files
"
]
&&
rmdir
-v
$(
dirname
$to_remove_pkg_files
|
head
-n1
)
2>/dev/null
return
$RETVAL
return
$RETVAL
}
}
bin/epm-query_file
View file @
7cc72170
...
@@ -178,11 +178,11 @@ epm_query_file()
...
@@ -178,11 +178,11 @@ epm_query_file()
[
-n
"
$pkg_filenames
"
]
||
fatal
"Run query without file names"
[
-n
"
$pkg_filenames
"
]
||
fatal
"Run query without file names"
load_helper epm-search_file
#
load_helper epm-search_file
for
pkg
in
$pkg_filenames
;
do
for
pkg
in
$pkg_filenames
;
do
__do_query_real_file
"
$pkg
"
__do_query_real_file
"
$pkg
"
__do_query
"
$FULLFILEPATH
"
||
pkg_filenames
=
"
$FULLFILEPATH
"
epm_search_file
__do_query
"
$FULLFILEPATH
"
||
info
"Try epm sf for search file in all packages in repository"
#||
pkg_filenames="$FULLFILEPATH" epm_search_file
done
done
}
}
bin/epm-release_upgrade
View file @
7cc72170
...
@@ -77,14 +77,57 @@ __alt_repofix()
...
@@ -77,14 +77,57 @@ __alt_repofix()
load_helper epm-repofix
load_helper epm-repofix
showcmd epm repofix
showcmd epm repofix
quiet
=
1
pkg_filenames
=
''
epm_repofix
>
/dev/null
quiet
=
1
pkg_filenames
=
''
epm_repofix
>
/dev/null
__replace_text_in_alt_repo
"/^ *#/! s!
\[
[tp][6-9]
\]
![updates]!g"
__replace_text_in_alt_repo
"/^ *#/! s!
\[
[tpc][6-9]
\]
![updates]!g"
}
__get_conflict_release_pkg
()
{
epmqf
--quiet
--short
/etc/fedora-release |
head
-n1
}
}
get_fix_release_pkg
()
get_fix_release_pkg
()
{
{
# TODO: check for version incompatibilities
local
TOINSTALL
=
''
if
epmqf /etc/altlinux-release |
grep
-q
sisyphus
;
then
echo
altlinux-release-
$1
local
FORCE
=
''
if
[
"
$1
"
==
"--force"
]
;
then
FORCE
=
"
$1
"
shift
fi
local
TO
=
"
$1
"
echo
"rpm apt"
if
[
"
$TO
"
=
"Sisyphus"
]
;
then
TO
=
"sisyphus"
echo
"apt-conf-
$TO
"
else
echo
"apt-conf-branch"
fi
if
[
"
$FORCE
"
==
"--force"
]
;
then
# assure we have set needed release
TOINSTALL
=
"altlinux-release-
$TO
"
else
# just assure we have /etc/altlinux-release and switched from sisyphus
if
[
!
-s
/etc/altlinux-release
]
||
epmqf /etc/altlinux-release |
grep
-q
sisyphus
;
then
TOINSTALL
=
"altlinux-release-
$TO
"
fi
fi
# workaround against obsoleted altlinux-release-sisyphus package from 2008 year
[
"
$TOINSTALL
"
=
"altlinux-release-sisyphus"
]
&&
TOINSTALL
=
"branding-alt-sisyphus-release"
if
[
-n
"
$TOINSTALL
"
]
;
then
echo
"
$TOINSTALL
"
# workaround against
# file /etc/fedora-release from install of altlinux-release-p8-20160414-alt1 conflicts with file from package branding-simply-linux-release-8.2.0-alt1
# problem
if
__get_conflict_release_pkg |
grep
-q
-v
"^altlinux-release"
&&
[
"
$TOINSTALL
"
!=
"
$(
__get_conflict_release_pkg
)
"
]
;
then
echo
$(
__get_conflict_release_pkg
)
-
fi
fi
fi
}
}
...
@@ -95,7 +138,7 @@ __update_to_the_distro()
...
@@ -95,7 +138,7 @@ __update_to_the_distro()
case
"
$TO
"
in
case
"
$TO
"
in
p7
)
p7
)
docmd epm update
||
fatal
docmd epm update
||
fatal
docmd epm
install
apt rpm apt-conf-branch
"
$(
get_fix_release_pkg
"
$TO
"
)
"
||
fatal
"Check an error and run epm release-upgrade again"
docmd epm
install
"
$(
get_fix_release_pkg
--force
"
$TO
"
)
"
||
fatal
"Check an error and run epm release-upgrade again"
__alt_repofix
__alt_repofix
__replace_text_in_alt_repo
"/^ *#/! s!
\[
updates
\]
![
$TO
]!g"
__replace_text_in_alt_repo
"/^ *#/! s!
\[
updates
\]
![
$TO
]!g"
docmd epm update
||
fatal
docmd epm update
||
fatal
...
@@ -103,14 +146,11 @@ __update_to_the_distro()
...
@@ -103,14 +146,11 @@ __update_to_the_distro()
;;
;;
p8
)
p8
)
docmd epm update
||
fatal
docmd epm update
||
fatal
if
!
docmd epm
install
apt rpm apt-conf-branch
"
$(
get_fix_release_pkg
"
$TO
"
)
"
;
then
docmd epm
install
"
$(
get_fix_release_pkg
--force
"
$TO
"
)
"
||
fatal
"Check an error and run epm release-upgrade again"
# Hack for error: execution of %post scriptlet from glibc-core-2.23-alt1.eter1
docmd rpm
-ev
glibc-core-2.17
||
fatal
"Check an error and run epm release-upgrade again"
docmd epm
install
apt rpm apt-conf-branch
"
$(
get_fix_release_pkg
"
$TO
"
)
"
||
fatal
"Check an error and run epm release-upgrade again"
fi
__alt_repofix
__alt_repofix
__replace_text_in_alt_repo
"/^ *#/! s!
\[
updates
\]
![
$TO
]!g"
__replace_text_in_alt_repo
"/^ *#/! s!
\[
updates
\]
![
$TO
]!g"
docmd epm update
||
fatal
docmd epm update
||
fatal
# sure we have systemd if systemd is running
if
is_installed systemd
&&
is_active_systemd systemd
;
then
if
is_installed systemd
&&
is_active_systemd systemd
;
then
docmd epm
install
systemd
||
fatal
docmd epm
install
systemd
||
fatal
fi
fi
...
@@ -118,33 +158,35 @@ __update_to_the_distro()
...
@@ -118,33 +158,35 @@ __update_to_the_distro()
;;
;;
Sisyphus
)
Sisyphus
)
docmd epm update
||
fatal
docmd epm update
||
fatal
docmd epm
install
apt rpm librpm7 librpm apt-conf-sisyphus altlinux-release-sisyphus
||
fatal
"Check an error and run again"
docmd epm
install
librpm7 librpm
"
$(
get_fix_release_pkg
--force
"
$TO
"
)
"
||
fatal
"Check an error and run again"
docmd epm upgrade
||
fatal
"Check an error and run epm release-upgrade again"
docmd epm upgrade
||
fatal
"Check an error and run epm release-upgrade again"
;;
;;
*
)
*
)
esac
esac
}
}
__update_alt_to_next_distro
()
__update_alt_to_next_distro
()
{
{
local
TO
=
""
local
TO
=
"
$2
"
local
FROM
=
"
$1
"
local
FROM
=
"
$1
"
[
-n
"
$TO
"
]
||
TO
=
"
$FROM
"
info
info
case
"
$*
"
in
case
"
$*
"
in
"p6"
|
"p6 p7"
|
"t6 p7"
)
"p6"
|
"p6 p7"
|
"t6 p7"
|
"c6 c7"
)
TO
=
"p7"
TO
=
"p7"
info
"Upgrade
$DISTRNAME
from
$FROM
to
$TO
..."
info
"Upgrade
$DISTRNAME
from
$FROM
to
$TO
..."
docmd epm
install
apt-conf-branch
||
fatal
docmd epm
install
"
$(
get_fix_release_pkg
"
$FROM
"
)
"
||
fatal
__replace_alt_version_in_repo
"
$FROM
/branch/"
"
$TO
/branch/"
__replace_alt_version_in_repo
"
$FROM
/branch/"
"
$TO
/branch/"
__update_to_the_distro
"
$TO
"
__update_to_the_distro
"
$TO
"
docmd epm update-kernel
docmd epm update-kernel
info
"Done."
info
"Done."
info
"Run epm release-upgrade again for update to p8"
info
"Run epm release-upgrade again for update to p8"
;;
;;
"p7"
|
"p7 p8"
|
"t7 p8"
)
"p7"
|
"p7 p8"
|
"t7 p8"
|
"c7 c8"
|
"p8 p8"
)
TO
=
"p8"
TO
=
"p8"
info
"Upgrade
$DISTRNAME
from
$FROM
to
$TO
..."
info
"Upgrade
$DISTRNAME
from
$FROM
to
$TO
..."
docmd epm
install
apt-conf-branch
"
$(
get_fix_release_pkg
"
$FROM
"
)
"
||
fatal
docmd epm
install
"
$(
get_fix_release_pkg
"
$FROM
"
)
"
||
fatal
__replace_alt_version_in_repo
$FROM
/branch/
$TO
/branch/
__replace_alt_version_in_repo
$FROM
/branch/
$TO
/branch/
__update_to_the_distro
$TO
__update_to_the_distro
$TO
docmd epm update-kernel
||
fatal
docmd epm update-kernel
||
fatal
...
@@ -153,17 +195,17 @@ __update_alt_to_next_distro()
...
@@ -153,17 +195,17 @@ __update_alt_to_next_distro()
"Sisyphus p8"
)
"Sisyphus p8"
)
TO
=
"p8"
TO
=
"p8"
info
"Downgrade
$DISTRNAME
from
$FROM
to
$TO
..."
info
"Downgrade
$DISTRNAME
from
$FROM
to
$TO
..."
docmd epm
install
apt-conf-branch
||
fatal
docmd epm
install
"
$(
get_fix_release_pkg
"
$FROM
"
)
"
||
fatal
__replace_alt_version_in_repo
"
$FROM
/"
"
$FROM
/branch/"
__replace_alt_version_in_repo
"
$FROM
/"
"
$FROM
/branch/"
__replace_text_in_alt_repo
"/^ *#/! s!
\[
alt
\]
![
$TO
]!g"
__replace_text_in_alt_repo
"/^ *#/! s!
\[
alt
\]
![
$TO
]!g"
__update_to_the_distro
$TO
__update_to_the_distro
$TO
docmd epm downgrade
||
fatal
docmd epm downgrade
||
fatal
info
"Done."
info
"Done."
;;
;;
"p8 Sisyphus"
)
"p8 Sisyphus"
|
"Sisyphus Sisyphus"
)
TO
=
"Sisyphus"
TO
=
"Sisyphus"
info
"Upgrade
$DISTRNAME
from
$FROM
to
$TO
..."
info
"Upgrade
$DISTRNAME
from
$FROM
to
$TO
..."
docmd epm
install
apt-conf-branch
||
fatal
docmd epm
install
"
$(
get_fix_release_pkg
"
$FROM
"
)
"
||
fatal
docmd epm upgrade
||
fatal
docmd epm upgrade
||
fatal
__replace_alt_version_in_repo
"
$FROM
/branch/"
"
$TO
/"
__replace_alt_version_in_repo
"
$FROM
/branch/"
"
$TO
/"
__alt_repofix
__alt_repofix
...
@@ -173,7 +215,11 @@ __update_alt_to_next_distro()
...
@@ -173,7 +215,11 @@ __update_alt_to_next_distro()
info
"Done."
info
"Done."
;;
;;
*
)
*
)
warning
"Have no idea how to update from
$DISTRNAME
$FROM
to
$DISTRNAME
$TO
."
if
[
"
$FROM
"
=
"
$TO
"
]
;
then
info
"It seems your system is already updated to newest
$DISTRNAME
$TO
"
else
warning
"Have no idea how to update from
$DISTRNAME
$FROM
to
$DISTRNAME
$TO
."
fi
info
"Try run f.i. # epm release-upgrade p8 or # epm release-upgrade Sisyphus"
info
"Try run f.i. # epm release-upgrade p8 or # epm release-upgrade Sisyphus"
info
"Also possible you need install altlinux-release-p? package for correct distro version detecting"
info
"Also possible you need install altlinux-release-p? package for correct distro version detecting"
return
1
return
1
...
@@ -186,10 +232,12 @@ epm_release_upgrade()
...
@@ -186,10 +232,12 @@ epm_release_upgrade()
info
"Starting upgrade whole system to the next release"
info
"Starting upgrade whole system to the next release"
info
"Check also http://wiki.etersoft.ru/Admin/UpdateLinux"
info
"Check also http://wiki.etersoft.ru/Admin/UpdateLinux"
# TODO: it is possible eatmydata does not do his work
export
EPMNOEATMYDATA
=
1
case
$DISTRNAME
in
case
$DISTRNAME
in
ALTLinux
)
ALTLinux
)
docmd epm update
docmd epm update
docmd epm
install
apt rpm
# try to detect current release by repo
# try to detect current release by repo
if
[
"
$DISTRVERSION
"
=
"Sisyphus"
]
||
[
-z
"
$DISTRVERSION
"
]
;
then
if
[
"
$DISTRVERSION
"
=
"Sisyphus"
]
||
[
-z
"
$DISTRVERSION
"
]
;
then
...
@@ -208,6 +256,7 @@ epm_release_upgrade()
...
@@ -208,6 +256,7 @@ epm_release_upgrade()
[
"
$(
__wcount
$pkg_filenames
)
"
=
"1"
]
||
fatal
"Too many args:
$pkg_filenames
"
[
"
$(
__wcount
$pkg_filenames
)
"
=
"1"
]
||
fatal
"Too many args:
$pkg_filenames
"
fi
fi
# TODO: ask before upgrade
__update_alt_to_next_distro
$DISTRVERSION
$pkg_filenames
__update_alt_to_next_distro
$DISTRVERSION
$pkg_filenames
return
return
;;
;;
...
...
bin/epm-remove
View file @
7cc72170
...
@@ -64,13 +64,13 @@ epm_remove_names()
...
@@ -64,13 +64,13 @@ epm_remove_names()
case
$PMTYPE
in
case
$PMTYPE
in
apt-dpkg
)
apt-dpkg
)
sudocmd apt-get remove
--purge
$@
sudocmd apt-get remove
--purge
$
APTOPTIONS
$
@
return
;;
return
;;
aptitude-dpkg
)
aptitude-dpkg
)
sudocmd aptitude purge
$@
sudocmd aptitude purge
$@
return
;;
return
;;
apt-rpm
)
apt-rpm
)
sudocmd apt-get remove
$@
sudocmd apt-get remove
$
APTOPTIONS
$
@
return
;;
return
;;
deepsolver-rpm
)
deepsolver-rpm
)
sudocmd ds-remove
$@
sudocmd ds-remove
$@
...
@@ -255,11 +255,20 @@ epm_remove()
...
@@ -255,11 +255,20 @@ epm_remove()
if
[
-n
"
$dryrun
"
]
;
then
if
[
-n
"
$dryrun
"
]
;
then
info
"Packages for removing:"
info
"Packages for removing:"
echo
"
$pkg_names
"
echo
"
$pkg_names
"
return
case
$PMTYPE
in
apt-rpm
)
nodeps
=
"--test"
APTOPTIONS
=
"--simulate"
;;
*
)
return
;;
esac
fi
fi
epm_remove_low
$pkg_names
&&
return
epm_remove_low
$pkg_names
&&
return
local
STATUS
=
$?
local
STATUS
=
$?
# TODO: check if we need continue with hi level
if
[
-n
"
$direct
"
]
;
then
if
[
-n
"
$direct
"
]
;
then
return
$STATUS
return
$STATUS
...
...
bin/epm-repofix
View file @
7cc72170
...
@@ -49,7 +49,7 @@ __try_fix_apt_source_list()
...
@@ -49,7 +49,7 @@ __try_fix_apt_source_list()
__fix_apt_sources_list
()
__fix_apt_sources_list
()
{
{
# for beauty spaces
# for beauty spaces
local
SUBST_ALT_RULE
=
's!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ](Sisyphus|p8[/ ]branch|p7[/ ]branch|t7[/ ]branch|c7[/ ]branch|p6[/ ]branch|t6[/ ]branch)[/ ](x86_64|i586|x86_64-i586|noarch) !\1 \2/\3/\4 !gi'
local
SUBST_ALT_RULE
=
's!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ]
*
(Sisyphus|p8[/ ]branch|p7[/ ]branch|t7[/ ]branch|c7[/ ]branch|p6[/ ]branch|t6[/ ]branch)[/ ](x86_64|i586|x86_64-i586|noarch) !\1 \2/\3/\4 !gi'
local
i
local
i
assure_root
assure_root
for
i
in
"
$@
"
;
do
for
i
in
"
$@
"
;
do
...
...
bin/epm-sh-altlinux
View file @
7cc72170
...
@@ -118,6 +118,7 @@ get_local_alt_contents_index()
...
@@ -118,6 +118,7 @@ get_local_alt_contents_index()
tasknumber
()
tasknumber
()
{
{
local
num
=
"
$
{
*/\#/
}
"
local
num
=
"
$
(
echo
"
$*
"
|
sed
-e
"s| *#*||g"
)
"
isnumber
"
$num
"
&&
echo
"
$num
"
isnumber
"
$num
"
&&
echo
"
$num
"
}
}
bin/epm-sh-functions
View file @
7cc72170
...
@@ -137,7 +137,7 @@ docmd_foreach()
...
@@ -137,7 +137,7 @@ docmd_foreach()
# Print command line and run command line with SUDO
# Print command line and run command line with SUDO
sudocmd
()
sudocmd
()
{
{
showcmd
"
$SUDO
$*
"
[
-n
"
$SUDO
"
]
&&
showcmd
"
$SUDO
$*
"
||
showcmd
"
$*
"
$SUDO
$@
$SUDO
$@
}
}
...
@@ -311,7 +311,7 @@ set_eatmydata()
...
@@ -311,7 +311,7 @@ set_eatmydata()
[
-n
"
$EPMNOEATMYDATA
"
]
&&
return
[
-n
"
$EPMNOEATMYDATA
"
]
&&
return
# use if possible
# use if possible
which eatmydata
>
/dev/null 2>/dev/null
||
return
which eatmydata
>
/dev/null 2>/dev/null
||
return
SUDO
=
"
$SUDO
eatmydata"
[
-n
"
$SUDO
"
]
&&
SUDO
=
"
$SUDO
eatmydata"
||
SUDO
=
"
eatmydata"
[
-n
"
$verbose
"
]
&&
info
"Uwaga! eatmydata is installed, we will use it for disable all sync operations."
[
-n
"
$verbose
"
]
&&
info
"Uwaga! eatmydata is installed, we will use it for disable all sync operations."
return
0
return
0
}
}
...
@@ -367,10 +367,26 @@ assure_exists()
...
@@ -367,10 +367,26 @@ assure_exists()
__epm_assure
"
$1
"
$package
$3
||
fatal
"Can't assure in '
$1
' command from
$package$textpackage
package"
__epm_assure
"
$1
"
$package
$3
||
fatal
"Can't assure in '
$1
' command from
$package$textpackage
package"
}
}
# will replaced within disabled_eget in packaged version
eget
()
eget
()
{
{
# use internal eget only if exists
if
[
-s
$SHAREDIR
/tools_eget
]
;
then
$SHAREDIR
/tools_eget
"
$@
"
return
fi
assure_exists eget
# run external command, not the function
EGET
=
$(
which eget
)
||
fatal
"Missed command eget from installed package eget"
$EGET
"
$@
"
}
# will replaced within eget() in packed version
onefile_eget
()
{
assure_exists wget
assure_exists wget
$SHAREDIR
/
tools_eget
"
$@
"
internal_
tools_eget
"
$@
"
}
}
# TODO: improve and drop!
# TODO: improve and drop!
...
...
bin/epm-whatdepends
View file @
7cc72170
...
@@ -31,7 +31,9 @@ epm_whatdepends()
...
@@ -31,7 +31,9 @@ epm_whatdepends()
# by package name
# by package name
case
$PMTYPE
in
case
$PMTYPE
in
apt-rpm
)
apt-rpm
)
CMD
=
"apt-cache whatdepends"
#CMD="apt-cache whatdepends"
# more quiet
CMD
=
"apt-cache rdepends"
;;
;;
apt-dpkg|aptitude-dpkg
)
apt-dpkg|aptitude-dpkg
)
CMD
=
"apt-cache rdepends"
CMD
=
"apt-cache rdepends"
...
...
bin/tools_eget
View file @
7cc72170
#!/bin/sh
#!/bin/sh
# eget - simply shell on wget for loading directories over http
# eget - simply shell on wget for loading directories over http
(wget does not support wildcard for http)
# Example use:
# Example use:
# eget
f
tp://ftp.altlinux.ru/pub/security/ssl/*
# eget
ht
tp://ftp.altlinux.ru/pub/security/ssl/*
#
#
# Copyright (C) 2014-2014, 2016 Etersoft
# Copyright (C) 2014-2014, 2016 Etersoft
# Copyright (C) 2014 Daniil Mikhailov <danil@etersoft.ru>
# Copyright (C) 2014 Daniil Mikhailov <danil@etersoft.ru>
# Copyright (C) 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2016
-2017
Vitaly Lipatov <lav@etersoft.ru>
#
#
# This program is free software: you can redistribute it and/or modify
# 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
# it under the terms of the GNU Affero General Public License as published by
...
@@ -23,12 +23,31 @@
...
@@ -23,12 +23,31 @@
WGET
=
"wget"
WGET
=
"wget"
# TODO: passthrou all wget options
if
[
"
$1
"
=
"-q"
]
;
then
if
[
"
$1
"
=
"-q"
]
;
then
WGET
=
"wget -q"
WGET
=
"wget -q"
shift
shift
fi
fi
# TODO:
if
[
"
$1
"
=
"--list"
]
;
then
LISTONLY
=
"
$1
"
shift
fi
fatal
()
{
echo
"
$*
"
>
&2
exit
1
}
# check man glob
filter_glob
()
{
# translate glob to regexp
grep
"^
$(
echo
"
$1
"
|
sed
-e
"s|
\*
|.*|g"
-e
"s|
\?
|.|g"
)
$"
}
# download to this file
# download to this file
WGET_OPTION_TARGET
=
WGET_OPTION_TARGET
=
if
[
"
$1
"
=
"-O"
]
;
then
if
[
"
$1
"
=
"-O"
]
;
then
...
@@ -40,51 +59,56 @@ fi
...
@@ -40,51 +59,56 @@ fi
# TODO:
# TODO:
# -P support
# -P support
# If ftp protocol or have no asterisk, just download
if
[
-z
"
$1
"
]
;
then
# TODO: use has()
echo
"eget - wget wrapper"
>
&2
if
echo
"
$1
"
|
grep
-q
"
\(
^ftp://
\|
[^*]
\)
"
;
then
fatal
"Run with URL, like http://somesite.ru/dir/*.log"
fi
# do not support /
if
echo
"
$1
"
|
grep
-q
"/$"
;
then
fatal
"Use http://example.com/e/* to download all files in dir"
fi
# If ftp protocol, just download
if
echo
"
$1
"
|
grep
-q
"^ftp://"
;
then
[
-n
"
$LISTONLY
"
]
&&
fatal
"Error: list files for ftp:// do not supported yet"
$WGET
$WGET_OPTION_TARGET
"
$1
"
$WGET
$WGET_OPTION_TARGET
"
$1
"
exit
exit
fi
fi
echo
"Fall to http workaround"
# drop mask part
URL
=
"
$(
dirname
"
$1
"
)
/"
if
echo
"
$URL
"
|
grep
-q
"[*?]"
;
then
fatal
"Error: there are globbing symbols (*?) in
$URL
"
fi
URL
=
$(
echo
"
$1
"
|
grep
"/$"
||
dirname
"
$1
"
)
# mask allowed only in last part of path
# mask allowed only in last part of path
MASK
=
$(
basename
"
$1
"
)
MASK
=
$(
basename
"
$1
"
)
get_index
()
# If have no wildcard symbol like asterisk, just download
{
if
echo
"
$MASK
"
|
grep
-qv
"[*?]"
;
then
MYTMPDIR
=
"
$(
mktemp
-d
)
"
$WGET
$WGET_OPTION_TARGET
"
$1
"
INDEX
=
$MYTMPDIR
/index
exit
$WGET
$URL
-O
$INDEX
fi
}
print_file
s
()
get_url
s
()
{
{
cat
$INDEX
|
grep
-o
-E
'href="([^\*/"#]+)"'
|
cut
-d
'"'
-f2
$WGET
-O-
$URL
|
\
grep
-o
-E
'href="([^\*/"#]+)"'
|
cut
-d
'"'
-f2
}
}
create_fake_files
()
if
[
-n
"
$LISTONLY
"
]
;
then
{
WGET
=
"
$WGET
-q"
DIRALLFILES
=
"
$MYTMPDIR
/files/"
for
fn
in
$(
get_urls | filter_glob
"
$MASK
"
)
;
do
mkdir
-p
"
$DIRALLFILES
"
echo
"
$(
basename
"
$fn
"
)
"
print_files |
while
read
-r
line
;
do
touch
$DIRALLFILES
/
$(
basename
"
$line
"
)
done
done
}
exit
fi
download_files
()
ERROR
=
0
{
for
fn
in
$(
get_urls | filter_glob
"
$MASK
"
)
;
do
ERROR
=
0
$WGET
"
$URL
/
$(
basename
"
$fn
"
)
"
||
ERROR
=
1
for
line
in
$DIRALLFILES
/
$MASK
;
do
done
$WGET
$URL
/
$(
basename
"
$line
"
)
||
ERROR
=
1
exit
$ERROR
done
return
$ERROR
}
get_index
||
exit
create_fake_files
download_files
||
echo
"There was some download errors"
>
&2
rm
-rf
"
$MYTMPDIR
"
check_code.sh
View file @
7cc72170
...
@@ -12,6 +12,7 @@ EXCL="$EXCL,SC2154,SC2002"
...
@@ -12,6 +12,7 @@ EXCL="$EXCL,SC2154,SC2002"
if
[
-n
"
$1
"
]
;
then
if
[
-n
"
$1
"
]
;
then
shellcheck
$EXCL
"
$1
"
shellcheck
$EXCL
"
$1
"
checkbashisms
-f
"
$1
"
exit
exit
fi
fi
...
...
eepm.spec
View file @
7cc72170
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
#
#
Name: eepm
Name: eepm
Version: 2.
1.8
Version: 2.
3.1
Release: alt0.M80P.1
Release: alt0.M80P.1
Summary: Etersoft EPM package manager
Summary: Etersoft EPM package manager
...
@@ -43,8 +43,8 @@ See detailed description here: http://wiki.etersoft.ru/EPM
...
@@ -43,8 +43,8 @@ See detailed description here: http://wiki.etersoft.ru/EPM
# install to datadir and so on
# install to datadir and so on
# do not use uncommon makeinstall_std here
# do not use uncommon makeinstall_std here
%make_install install DESTDIR=%buildroot datadir=%_datadir bindir=%_bindir mandir=%_mandir version=%version-%release
%make_install install DESTDIR=%buildroot datadir=%_datadir bindir=%_bindir mandir=%_mandir version=%version-%release
install -m 0755 packed/epm.sh %buildroot/%_datadir/%name/epm-packed.sh
#
install -m 0755 packed/epm.sh %buildroot/%_datadir/%name/epm-packed.sh
install -m 0755 packed/serv.sh %buildroot/%_datadir/%name/serv-packed.sh
#
install -m 0755 packed/serv.sh %buildroot/%_datadir/%name/serv-packed.sh
mkdir -p %buildroot%_sysconfdir/bash_completion.d/
mkdir -p %buildroot%_sysconfdir/bash_completion.d/
install -m 0644 bash_completion/serv %buildroot%_sysconfdir/bash_completion.d/serv
install -m 0644 bash_completion/serv %buildroot%_sysconfdir/bash_completion.d/serv
...
@@ -54,6 +54,11 @@ ln -s serv %buildroot%_sysconfdir/bash_completion.d/cerv
...
@@ -54,6 +54,11 @@ ln -s serv %buildroot%_sysconfdir/bash_completion.d/cerv
chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
chmod a+x %buildroot%_datadir/%name/tools_*
chmod a+x %buildroot%_datadir/%name/tools_*
%if %_vendor == "alt"
# use external eget
rm -f %buildroot%_datadir/%name/tools_eget
%endif
%files
%files
%doc README TODO LICENSE
%doc README TODO LICENSE
%_bindir/epm*
%_bindir/epm*
...
@@ -68,9 +73,35 @@ chmod a+x %buildroot%_datadir/%name/tools_*
...
@@ -68,9 +73,35 @@ chmod a+x %buildroot%_datadir/%name/tools_*
%_sysconfdir/bash_completion.d/cerv
%_sysconfdir/bash_completion.d/cerv
%changelog
%changelog
*
Thu Nov 02 2017 Vitaly Lipatov <lav@altlinux.ru> 2.1.8
-alt0.M80P.1
*
Sun Nov 19 2017 Vitaly Lipatov <lav@altlinux.ru> 2.3.1
-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script)
- backport to ALTLinux p8 (by rpmbph script)
* Sun Nov 19 2017 Vitaly Lipatov <lav@altlinux.ru> 2.3.1-alt1
- epm whatdepends: use rdepends
- repofix: fix signing when we have /
- query_file: only inform about epm sf using
- allow ei/ik install any package(s) from Korinf
- ei/ik: add support for --list [mask], install via eget
* Sun Nov 12 2017 Vitaly Lipatov <lav@altlinux.ru> 2.3.0-alt2
- epm: rewrite release_upgrade for ALT
- autoremove: small improvement
- remove: add support dry mode for rpm/apt
* Sat Nov 11 2017 Vitaly Lipatov <lav@altlinux.ru> 2.2.0-alt1
- use external eget on ALT
- disable one file version packing
- update internal eget to 2.0
* Fri Nov 10 2017 Vitaly Lipatov <lav@altlinux.ru> 2.1.10-alt1
- install: print low level install command if args is empty
- epm: add wd alias for whatdepends
- epm-clean: add --noconfirm for pacman
- fix and text install via url with wildcard
* Wed Nov 08 2017 Vitaly Lipatov <lav@altlinux.ru> 2.1.9-alt1
- tasknumber: fix bashism
* Thu Nov 02 2017 Vitaly Lipatov <lav@altlinux.ru> 2.1.8-alt1
* Thu Nov 02 2017 Vitaly Lipatov <lav@altlinux.ru> 2.1.8-alt1
- epm addrepo: use http for ALT archive, add date format checking
- epm addrepo: use http for ALT archive, add date format checking
- ep-seach: use ~ for negate and ^ for a begin of line in __epm_search_make_grep
- ep-seach: use ~ for negate and ^ for a begin of line in __epm_search_make_grep
...
...
pack_in_onefile.sh
View file @
7cc72170
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
#
#
# Run for create one-file-scripts
# Run for create one-file-scripts
#
#
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016
, 2017
Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016
, 2017
Vitaly Lipatov <lav@etersoft.ru>
#
#
# This program is free software: you can redistribute it and/or modify
# 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
# it under the terms of the GNU Affero General Public License as published by
...
@@ -24,14 +24,17 @@ incorporate_subfile()
...
@@ -24,14 +24,17 @@ incorporate_subfile()
{
{
cat
<<
EOF
>>
$OUTPUT
cat
<<
EOF
>>
$OUTPUT
internal_
$1
()
################# incorporate
$1
#################
internal_
$(
basename
$1
)
()
{
{
EOF
EOF
cat
bin/
$1
|
grep
-v
"^#!/bin/sh"
|
sed
-e
"s| exit
$|
return|g"
>>
$OUTPUT
cat
$1
|
grep
-v
"^#!/bin/sh"
|
sed
-e
"s| exit
$|
return|g"
>>
$OUTPUT
cat
<<
EOF
>>
$OUTPUT
cat
<<
EOF
>>
$OUTPUT
}
}
################# end of incorporated
$1
#################
EOF
EOF
}
}
...
@@ -43,7 +46,8 @@ get_version()
...
@@ -43,7 +46,8 @@ get_version()
filter_out
()
filter_out
()
{
{
grep
-v
"^[ ]*load_helper "
|
\
grep
-v
"^[ ]*load_helper "
|
\
sed
-e
's|$SHAREDIR/tools_eget|internal_tools_eget|g'
|
\
sed
-e
's|^eget()|disabled_eget()|g'
|
\
sed
-e
's|^onefile_eget()|eget()|g'
|
\
sed
-e
's|$SHAREDIR/tools_json|internal_tools_json|g'
|
\
sed
-e
's|$SHAREDIR/tools_json|internal_tools_json|g'
|
\
sed
-e
's|DISTRVENDOR=$PROGDIR/distr_info|DISTRVENDOR=internal_distr_info|g'
|
\
sed
-e
's|DISTRVENDOR=$PROGDIR/distr_info|DISTRVENDOR=internal_distr_info|g'
|
\
sed
-e
"s|@VERSION@|
$(
get_version
)
|g"
sed
-e
"s|@VERSION@|
$(
get_version
)
|g"
...
@@ -63,9 +67,10 @@ for i in bin/epm-sh-functions $(ls -1 bin/$PACKCOMMAND-* | grep -v epm-sh-functi
...
@@ -63,9 +67,10 @@ for i in bin/epm-sh-functions $(ls -1 bin/$PACKCOMMAND-* | grep -v epm-sh-functi
cat
$i
|
grep
-v
"^#"
cat
$i
|
grep
-v
"^#"
done
| filter_out
>>
$OUTPUT
done
| filter_out
>>
$OUTPUT
incorporate_subfile distr_info
incorporate_subfile bin/distr_info
incorporate_subfile tools_eget
#incorporate_subfile /usr/bin/eget
incorporate_subfile tools_json
incorporate_subfile bin/tools_eget
incorporate_subfile bin/tools_json
awk
'BEGIN{desk=0}{if(desk>0) {print} ; if(/^load_helper epm-sh-functions/){desk++}}'
<bin/
$PACKCOMMAND
| filter_out
>>
$OUTPUT
awk
'BEGIN{desk=0}{if(desk>0) {print} ; if(/^load_helper epm-sh-functions/){desk++}}'
<bin/
$PACKCOMMAND
| filter_out
>>
$OUTPUT
chmod
0755
$OUTPUT
chmod
0755
$OUTPUT
...
...
packed/epm.sh
View file @
7cc72170
This diff is collapsed.
Click to expand it.
packed/serv.sh
View file @
7cc72170
...
@@ -144,7 +144,7 @@ docmd_foreach()
...
@@ -144,7 +144,7 @@ docmd_foreach()
sudocmd
()
sudocmd
()
{
{
showcmd
"
$SUDO
$*
"
[
-n
"
$SUDO
"
]
&&
showcmd
"
$SUDO
$*
"
||
showcmd
"
$*
"
$SUDO
$@
$SUDO
$@
}
}
...
@@ -178,6 +178,11 @@ get_lastarg()
...
@@ -178,6 +178,11 @@ get_lastarg()
echon
"
$lastarg
"
echon
"
$lastarg
"
}
}
isnumber
()
{
echo
"
$*
"
| filter_strip_spaces |
grep
-q
"^[0-9]
\+
$"
}
filter_strip_spaces
()
filter_strip_spaces
()
{
{
# possible use just
# possible use just
...
@@ -285,12 +290,12 @@ withtimeout()
...
@@ -285,12 +290,12 @@ withtimeout()
{
{
local
TO
=
$(
which
timeout
2>/dev/null
||
which gtimeout 2>/dev/null
)
local
TO
=
$(
which
timeout
2>/dev/null
||
which gtimeout 2>/dev/null
)
if
[
-x
"
$TO
"
]
;
then
if
[
-x
"
$TO
"
]
;
then
$TO
$@
$TO
"
$@
"
return
return
fi
fi
# fallback: drop time arg and run without timeout
# fallback: drop time arg and run without timeout
shift
shift
$@
"
$@
"
}
}
set_eatmydata
()
set_eatmydata
()
...
@@ -299,7 +304,7 @@ set_eatmydata()
...
@@ -299,7 +304,7 @@ set_eatmydata()
[
-n
"
$EPMNOEATMYDATA
"
]
&&
return
[
-n
"
$EPMNOEATMYDATA
"
]
&&
return
# use if possible
# use if possible
which eatmydata
>
/dev/null 2>/dev/null
||
return
which eatmydata
>
/dev/null 2>/dev/null
||
return
SUDO
=
"
$SUDO
eatmydata"
[
-n
"
$SUDO
"
]
&&
SUDO
=
"
$SUDO
eatmydata"
||
SUDO
=
"
eatmydata"
[
-n
"
$verbose
"
]
&&
info
"Uwaga! eatmydata is installed, we will use it for disable all sync operations."
[
-n
"
$verbose
"
]
&&
info
"Uwaga! eatmydata is installed, we will use it for disable all sync operations."
return
0
return
0
}
}
...
@@ -351,6 +356,20 @@ assure_exists()
...
@@ -351,6 +356,20 @@ assure_exists()
__epm_assure
"
$1
"
$package
$3
||
fatal
"Can't assure in '
$1
' command from
$package$textpackage
package"
__epm_assure
"
$1
"
$package
$3
||
fatal
"Can't assure in '
$1
' command from
$package$textpackage
package"
}
}
disabled_eget
()
{
# use internal eget only if exists
if
[
-s
$SHAREDIR
/tools_eget
]
;
then
$SHAREDIR
/tools_eget
"
$@
"
return
fi
assure_exists eget
# run external command, not the function
EGET
=
$(
which eget
)
||
fatal
"Missed command eget from installed package eget"
$EGET
"
$@
"
}
eget
()
eget
()
{
{
assure_exists wget
assure_exists wget
...
@@ -1000,6 +1019,7 @@ _print_additional_usage
...
@@ -1000,6 +1019,7 @@ _print_additional_usage
}
}
################# incorporate bin/distr_info #################
internal_distr_info
()
internal_distr_info
()
{
{
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Author: Vitaly Lipatov <lav@etersoft.ru>
...
@@ -1028,6 +1048,11 @@ has()
...
@@ -1028,6 +1048,11 @@ has()
grep
"
$*
"
"
$DISTROFILE
"
>
/dev/null 2>&1
grep
"
$*
"
"
$DISTROFILE
"
>
/dev/null 2>&1
}
}
firstupper
()
{
echo
"
$*
"
|
sed
's/.*/\u&/'
}
# Translate DISTRIB_ID to vendor name (like %_vendor does)
# Translate DISTRIB_ID to vendor name (like %_vendor does)
rpmvendor
()
rpmvendor
()
{
{
...
@@ -1049,11 +1074,12 @@ pkgvendor()
...
@@ -1049,11 +1074,12 @@ pkgvendor()
# Print pkgtype (need DISTRIB_ID var)
# Print pkgtype (need DISTRIB_ID var)
pkgtype
()
pkgtype
()
{
{
# TODO: try use generic names
case
$(
pkgvendor
)
in
case
$(
pkgvendor
)
in
freebsd
)
echo
"tbz"
;;
freebsd
)
echo
"tbz"
;;
sunos
)
echo
"pkg.gz"
;;
sunos
)
echo
"pkg.gz"
;;
slackware|mopslinux
)
echo
"tgz"
;;
slackware|mopslinux
)
echo
"tgz"
;;
archlinux
)
echo
"pkg.tar.xz"
;;
archlinux
|manjaro
)
echo
"pkg.tar.xz"
;;
gentoo
)
echo
"tbz2"
;;
gentoo
)
echo
"tbz2"
;;
windows
)
echo
"exe"
;;
windows
)
echo
"exe"
;;
android
)
echo
"apk"
;;
android
)
echo
"apk"
;;
...
@@ -1143,7 +1169,7 @@ elif distro slackware-version ; then
...
@@ -1143,7 +1169,7 @@ elif distro slackware-version ; then
elif
distro os-release
&&
which apk 2>/dev/null
>
/dev/null
;
then
elif
distro os-release
&&
which apk 2>/dev/null
>
/dev/null
;
then
# shellcheck disable=SC1090
# shellcheck disable=SC1090
.
$ROOTDIR
/etc/os-release
.
$ROOTDIR
/etc/os-release
DISTRIB_ID
=
"
$
ID
"
DISTRIB_ID
=
"
$
(
firstupper
"
$ID
"
)
"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
elif
distro os-release
&&
which tce-ab 2>/dev/null
>
/dev/null
;
then
elif
distro os-release
&&
which tce-ab 2>/dev/null
>
/dev/null
;
then
...
@@ -1165,6 +1191,7 @@ elif distro arch-release ; then
...
@@ -1165,6 +1191,7 @@ elif distro arch-release ; then
DISTRIB_RELEASE
=
"2011"
DISTRIB_RELEASE
=
"2011"
fi
fi
# Elbrus
elif
distro mcst_version
;
then
elif
distro mcst_version
;
then
DISTRIB_ID
=
"MCST"
DISTRIB_ID
=
"MCST"
DISTRIB_RELEASE
=
$(
cat
"
$DISTROFILE
"
|
grep
"release"
|
sed
-e
"s|.*release
\(
[0-9]*
\)
.*|
\1
|g"
)
DISTRIB_RELEASE
=
$(
cat
"
$DISTROFILE
"
|
grep
"release"
|
sed
-e
"s|.*release
\(
[0-9]*
\)
.*|
\1
|g"
)
...
@@ -1275,6 +1302,14 @@ elif distro SuSe-release || distro SuSE-release ; then
...
@@ -1275,6 +1302,14 @@ elif distro SuSe-release || distro SuSE-release ; then
DISTRIB_ID
=
"SLES"
DISTRIB_ID
=
"SLES"
fi
fi
# https://www.freedesktop.org/software/systemd/man/os-release.html
elif
distro os-release
;
then
# shellcheck disable=SC1090
.
$ROOTDIR
/etc/os-release
DISTRIB_ID
=
"
$(
firstupper
"
$ID
"
)
"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
[
-n
"
$DISTRIB_RELEASE
"
]
||
DISTRIB_RELEASE
=
"CUR"
# fixme: can we detect by some file?
# fixme: can we detect by some file?
elif
[
"
$(
uname
)
"
=
"FreeBSD"
]
;
then
elif
[
"
$(
uname
)
"
=
"FreeBSD"
]
;
then
DISTRIB_ID
=
"FreeBSD"
DISTRIB_ID
=
"FreeBSD"
...
@@ -1317,6 +1352,112 @@ elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then
...
@@ -1317,6 +1352,112 @@ elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then
esac
esac
fi
fi
get_base_os_name
()
{
local
DIST_OS
# Resolve the os
DIST_OS
=
`
uname
-s
|
tr
[
:upper:]
[
:lower:] |
tr
-d
"
\t\r\n
"
`
case
"
$DIST_OS
"
in
'sunos'
)
DIST_OS
=
"solaris"
;;
'hp-ux'
|
'hp-ux64'
)
DIST_OS
=
"hpux"
;;
'darwin'
|
'oarwin'
)
DIST_OS
=
"macosx"
;;
'unix_sv'
)
DIST_OS
=
"unixware"
;;
'freebsd'
|
'openbsd'
|
'netbsd'
)
DIST_OS
=
"freebsd"
;;
esac
echo
"
$DIST_OS
"
}
get_arch
()
{
local
DIST_ARCH
# Resolve the architecture
DIST_ARCH
=
`
uname
-m
|
tr
[
:upper:]
[
:lower:] |
tr
-d
"
\t\r\n
"
`
case
"
$DIST_ARCH
"
in
'amd64'
|
'ia32'
|
'i386'
|
'i486'
|
'i586'
|
'i686'
|
'x86_64'
)
DIST_ARCH
=
"x86"
;;
'ia64'
|
'ia-64'
)
DIST_ARCH
=
"ia64"
;;
'ip27'
|
'mips'
)
DIST_ARCH
=
"mips"
;;
'powermacintosh'
|
'power'
|
'powerpc'
|
'power_pc'
|
'ppc64'
)
DIST_ARCH
=
"ppc"
;;
'pa_risc'
|
'pa-risc'
)
DIST_ARCH
=
"parisc"
;;
'sun4u'
|
'sparcv9'
)
DIST_ARCH
=
"sparc"
;;
'9000/800'
)
DIST_ARCH
=
"parisc"
;;
armv
*
)
if
[
-z
"
`
readelf
-A
/proc/self/exe |
grep
Tag_ABI_VFP_args
`
"
]
;
then
DIST_ARCH
=
"armel"
else
DIST_ARCH
=
"armhf"
fi
;;
esac
echo
"
$DIST_ARCH
"
}
get_bit_size
()
{
local
DIST_BIT
# Check if we are running on 64bit platform, seems like a workaround for now...
DIST_BIT
=
`
uname
-m
|
tr
[
:upper:]
[
:lower:] |
tr
-d
"
\t\r\n
"
`
case
"
$DIST_BIT
"
in
'amd64'
|
'ia64'
|
'x86_64'
|
'ppc64'
)
DIST_BIT
=
"64"
;;
# 'pa_risc' | 'pa-risc') # Are some of these 64bit? Least not all...
# BIT="64"
# ;;
'sun4u'
|
'sparcv9'
)
# Are all sparcs 64?
DIST_BIT
=
"64"
;;
# '9000/800')
# DIST_BIT="64"
# ;;
*
)
# In any other case default to 32
DIST_BIT
=
"32"
;;
esac
echo
"
$DIST_BIT
"
}
get_memory_size
()
{
local
detected
=
0
local
DIST_OS
=
$(
get_base_os_name
)
if
[
$DIST_OS
=
"macosx"
]
then
detected
=
$((
`
sysctl hw.memsize |
sed
s/
"hw.memsize: "
//
`
/
1024
/
1024
))
elif
[
$DIST_OS
=
"freebsd"
]
then
detected
=
$((
`
sysctl hw.physmem |
sed
s/
"hw.physmem: "
//
`
/
1024
/
1024
))
elif
[
$DIST_OS
=
"linux"
]
then
detected
=
$((
`
cat
/proc/meminfo |
grep
MemTotal |
awk
'{print $2}'
`
/
1024
))
fi
# Exit codes only support values between 0 and 255. So use stdout.
echo
$detected
}
case
$1
in
case
$1
in
-p
)
-p
)
# override DISTRIB_ID
# override DISTRIB_ID
...
@@ -1329,6 +1470,10 @@ case $1 in
...
@@ -1329,6 +1470,10 @@ case $1 in
echo
"Usage: distr_vendor [options] [args]"
echo
"Usage: distr_vendor [options] [args]"
echo
"-p [SystemName] - print type of packaging system"
echo
"-p [SystemName] - print type of packaging system"
echo
"-d - print distro name"
echo
"-d - print distro name"
echo
"-a - print hardware architecture"
echo
"-b - print size of arch bit (32/64)"
echo
"-m - print system memory size (in MB)"
echo
"-o - print base os name"
echo
"-v - print version of distro"
echo
"-v - print version of distro"
echo
"-e - print full name of distro with version (by default)"
echo
"-e - print full name of distro with version (by default)"
echo
"-s [SystemName] - print name of distro for build system (like in the package release name)"
echo
"-s [SystemName] - print name of distro for build system (like in the package release name)"
...
@@ -1340,6 +1485,18 @@ case $1 in
...
@@ -1340,6 +1485,18 @@ case $1 in
-d
)
-d
)
echo
$DISTRIB_ID
echo
$DISTRIB_ID
;;
;;
-a
)
get_arch
;;
-b
)
get_bit_size
;;
-m
)
get_memory_size
;;
-o
)
get_base_os_name
;;
-v
)
-v
)
echo
$DISTRIB_RELEASE
echo
$DISTRIB_RELEASE
;;
;;
...
@@ -1366,16 +1523,19 @@ case $1 in
...
@@ -1366,16 +1523,19 @@ case $1 in
esac
esac
}
}
################# end of incorporated bin/distr_info #################
################# incorporate bin/tools_eget #################
internal_tools_eget
()
internal_tools_eget
()
{
{
# eget - simply shell on wget for loading directories over http
# eget - simply shell on wget for loading directories over http
(wget does not support wildcard for http)
# Example use:
# Example use:
# eget
f
tp://ftp.altlinux.ru/pub/security/ssl/*
# eget
ht
tp://ftp.altlinux.ru/pub/security/ssl/*
#
#
# Copyright (C) 2014-2014, 2016 Etersoft
# Copyright (C) 2014-2014, 2016 Etersoft
# Copyright (C) 2014 Daniil Mikhailov <danil@etersoft.ru>
# Copyright (C) 2014 Daniil Mikhailov <danil@etersoft.ru>
# Copyright (C) 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2016
-2017
Vitaly Lipatov <lav@etersoft.ru>
#
#
# This program is free software: you can redistribute it and/or modify
# 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
# it under the terms of the GNU Affero General Public License as published by
...
@@ -1410,29 +1570,39 @@ fi
...
@@ -1410,29 +1570,39 @@ fi
# TODO:
# TODO:
# -P support
# -P support
# If ftp protocol or have no asterisk, just download
if
[
-z
"
$1
"
]
;
then
# TODO: use has()
echo
"eget - wget wrapper"
>
&2
if
echo
"
$1
"
|
grep
-q
"
\(
^ftp://
\|
[^*]
\)
"
;
then
echo
"Run with URL, like http://somesite.ru/dir/*.log"
>
&2
exit
1
fi
# If ftp protocol, just download
if
echo
"
$1
"
|
grep
-q
"^ftp://"
;
then
$WGET
$WGET_OPTION_TARGET
"
$1
"
return
fi
# drop mask part (if has /$, not changed)
URL
=
$(
echo
"
$1
"
|
grep
"/$"
||
dirname
"
$1
"
)
# If have no wildcard symbol like asterisk and no / at the end, just download
if
[
"
$URL
"
!=
"
$1
"
]
&&
echo
"
$1
"
|
grep
-qv
"[*?]"
;
then
$WGET
$WGET_OPTION_TARGET
"
$1
"
$WGET
$WGET_OPTION_TARGET
"
$1
"
return
return
fi
fi
echo
"Fall to http workaround"
echo
"Fall to http workaround"
URL
=
$(
echo
"
$1
"
|
grep
"/$"
||
dirname
"
$1
"
)
# mask allowed only in last part of path
# mask allowed only in last part of path
MASK
=
$(
basename
"
$1
"
)
MASK
=
$(
basename
"
$1
"
)
# TODO: skip create_fake_files for full dir
get_index
()
# add * if full dir
{
#[ "$URL" != "$1" ] && MASK="*"
MYTMPDIR
=
"
$(
mktemp
-d
)
"
INDEX
=
$MYTMPDIR
/index
$WGET
$URL
-O
$INDEX
}
print_files
()
print_files
()
{
{
cat
$INDEX
|
grep
-o
-E
'href="([^\*/"#]+)"'
|
cut
-d
'"'
-f2
$WGET
-O-
$URL
|
\
grep
-o
-E
'href="([^\*/"#]+)"'
|
cut
-d
'"'
-f2
}
}
create_fake_files
()
create_fake_files
()
...
@@ -1448,18 +1618,23 @@ create_fake_files()
...
@@ -1448,18 +1618,23 @@ create_fake_files()
download_files
()
download_files
()
{
{
ERROR
=
0
ERROR
=
0
# TODO: test fix / at the end
for
line
in
$DIRALLFILES
/
$MASK
;
do
for
line
in
$DIRALLFILES
/
$MASK
;
do
[
-r
"
$line
"
]
||
{
ERROR
=
1
;
break
;
}
$WGET
$URL
/
$(
basename
"
$line
"
)
||
ERROR
=
1
$WGET
$URL
/
$(
basename
"
$line
"
)
||
ERROR
=
1
done
done
return
$ERROR
return
$ERROR
}
}
get_index
||
return
MYTMPDIR
=
"
$(
mktemp
-d
)
"
create_fake_files
create_fake_files
download_files
||
echo
"There was some download errors"
>
&2
download_files
||
echo
"There was some download errors"
>
&2
rm
-rf
"
$MYTMPDIR
"
rm
-rf
"
$MYTMPDIR
"
}
}
################# end of incorporated bin/tools_eget #################
################# incorporate bin/tools_json #################
internal_tools_json
()
internal_tools_json
()
{
{
...
@@ -1673,6 +1848,8 @@ fi
...
@@ -1673,6 +1848,8 @@ fi
# vi: expandtab sw=2 ts=2
# vi: expandtab sw=2 ts=2
}
}
################# end of incorporated bin/tools_json #################
INITDIR
=
/etc/init.d
INITDIR
=
/etc/init.d
...
@@ -1771,7 +1948,7 @@ $(get_help HELPOPT)
...
@@ -1771,7 +1948,7 @@ $(get_help HELPOPT)
print_version
()
print_version
()
{
{
echo
"Service manager version 2.
1.1
"
echo
"Service manager version 2.
3.0
"
echo
"Running on
$(
$DISTRVENDOR
)
with
$SERVICETYPE
"
echo
"Running on
$(
$DISTRVENDOR
)
with
$SERVICETYPE
"
echo
"Copyright (c) Etersoft 2012, 2013, 2016"
echo
"Copyright (c) Etersoft 2012, 2013, 2016"
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
...
...
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