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
aeac7c5d
Commit
aeac7c5d
authored
Apr 07, 2016
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Plain Diff
backported to p7 as 1.6.3-alt0.M70P.1 (with rpmbph script)
parents
0bdbb892
5fd32a7e
Show whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
1165 additions
and
177 deletions
+1165
-177
TODO
TODO
+15
-0
distr_info
bin/distr_info
+5
-1
epm-addrepo
bin/epm-addrepo
+2
-1
epm-audit
bin/epm-audit
+3
-0
epm-autoorphans
bin/epm-autoorphans
+5
-1
epm-autoremove
bin/epm-autoremove
+7
-0
epm-check_updated_repo
bin/epm-check_updated_repo
+3
-2
epm-checksystem
bin/epm-checksystem
+9
-4
epm-clean
bin/epm-clean
+4
-0
epm-downgrade
bin/epm-downgrade
+42
-8
epm-filelist
bin/epm-filelist
+1
-1
epm-kernel_update
bin/epm-kernel_update
+1
-1
epm-optimize
bin/epm-optimize
+2
-0
epm-packages
bin/epm-packages
+1
-0
epm-print
bin/epm-print
+16
-4
epm-provides
bin/epm-provides
+1
-1
epm-query
bin/epm-query
+2
-2
epm-query_file
bin/epm-query_file
+1
-0
epm-query_package
bin/epm-query_package
+1
-0
epm-reinstall
bin/epm-reinstall
+1
-1
epm-removerepo
bin/epm-removerepo
+2
-1
epm-repofix
bin/epm-repofix
+3
-0
epm-requires
bin/epm-requires
+11
-0
epm-search
bin/epm-search
+11
-4
epm-search_file
bin/epm-search_file
+4
-0
epm-site
bin/epm-site
+9
-6
epm-update
bin/epm-update
+1
-0
epm-upgrade
bin/epm-upgrade
+2
-0
epm-whatdepends
bin/epm-whatdepends
+3
-0
epm-whatprovides
bin/epm-whatprovides
+3
-0
serv
bin/serv
+10
-4
serv-print
bin/serv-print
+23
-0
tools-eget
bin/tools-eget
+43
-19
check_reqs.sh
check_reqs.sh
+2
-0
eepm.spec
eepm.spec
+35
-7
epm.sh
packed/epm.sh
+828
-88
serv.sh
packed/serv.sh
+53
-21
No files found.
TODO
View file @
aeac7c5d
[18:21:12] <danil> Вот так можно:
RED='\033[0;31m' ; NC='\033[0m' b="b" ; echo -e "aba" | sed -e "s|${b}|\\${RED}${b}\\${NC}|g" | xargs -0 printf
[18:23:40] <danil> > Ты знаешь способы?
colorise_word(){ //aba b
RED='\033[0;31m'
NC='\033[0m' b="b"
echo -e "$1" | sed -e "s|${2}|\\${RED}${2}\\${NC}|g" | xargs -0 printf
}
[18:24:18] <lav> Ну в общем-то да... Ещё можно попробовать готовый
yum list extras – имена тех пакетов, которые наличествуют в системе, но которыми в репозиториях и не пахло, то есть установленные “в лоб”, например, через
--dump-options for write simple bash completition
--dump-options for write simple bash completition
add epm site / epmurl in replace to rpmurl
add epm site / epmurl in replace to rpmurl
...
...
bin/distr_info
View file @
aeac7c5d
...
@@ -87,8 +87,12 @@ fi
...
@@ -87,8 +87,12 @@ fi
if
distro altlinux-release
;
then
if
distro altlinux-release
;
then
DISTRIB_ID
=
"ALTLinux"
DISTRIB_ID
=
"ALTLinux"
if
has Sisyphus
;
then
DISTRIB_RELEASE
=
"Sisyphus"
if
has Sisyphus
;
then
DISTRIB_RELEASE
=
"Sisyphus"
elif
has
"ALT Linux 7.0"
;
then
DISTRIB_RELEASE
=
"p7"
elif
has
"ALT Linux 7."
;
then
DISTRIB_RELEASE
=
"p7"
elif
has
"ALT Linux 8."
;
then
DISTRIB_RELEASE
=
"p8"
elif
has
"Simply Linux 7."
;
then
DISTRIB_RELEASE
=
"p7"
elif
has
"Simply Linux 8."
;
then
DISTRIB_RELEASE
=
"p8"
elif
has
"ALT Linux 6.0"
;
then
DISTRIB_RELEASE
=
"p6"
elif
has
"ALT Linux 6.0"
;
then
DISTRIB_RELEASE
=
"p6"
elif
has
"ALT Linux p8"
;
then
DISTRIB_RELEASE
=
"p8"
elif
has
"ALT Linux p7"
;
then
DISTRIB_RELEASE
=
"p7"
elif
has
"ALT Linux p7"
;
then
DISTRIB_RELEASE
=
"p7"
elif
has
"ALT Linux p6"
;
then
DISTRIB_RELEASE
=
"p6"
elif
has
"ALT Linux p6"
;
then
DISTRIB_RELEASE
=
"p6"
elif
has
"ALT Linux p5"
;
then
DISTRIB_RELEASE
=
"p5"
elif
has
"ALT Linux p5"
;
then
DISTRIB_RELEASE
=
"p5"
...
...
bin/epm-addrepo
View file @
aeac7c5d
...
@@ -28,7 +28,8 @@ case $PMTYPE in
...
@@ -28,7 +28,8 @@ case $PMTYPE in
info
"You need manually add repo to /etc/apt/sources.list"
info
"You need manually add repo to /etc/apt/sources.list"
;;
;;
yum-rpm
)
yum-rpm
)
info
"You need manually add repo to /etc/yum.repos.d/"
assure_exists yum-utils
sudocmd yum-config-manager
--add-repo
"
$pkg_filenames
"
;;
;;
urpm-rpm
)
urpm-rpm
)
sudocmd urpmi.addmedia
"
$pkg_filenames
"
sudocmd urpmi.addmedia
"
$pkg_filenames
"
...
...
bin/epm-audit
View file @
aeac7c5d
...
@@ -19,6 +19,9 @@
...
@@ -19,6 +19,9 @@
epm_audit
()
epm_audit
()
{
{
[
-z
"
$pkg_filenames
"
]
||
fatal
"No arguments are allowed here"
case
$PMTYPE
in
case
$PMTYPE
in
pkgng
)
pkgng
)
sudocmd pkg audit
-F
sudocmd pkg audit
-F
...
...
bin/epm-autoorphans
View file @
aeac7c5d
...
@@ -19,6 +19,10 @@
...
@@ -19,6 +19,10 @@
epm_autoorphans
()
epm_autoorphans
()
{
{
[
-z
"
$pkg_filenames
"
]
||
fatal
"No arguments are allowed here"
case
$PMTYPE
in
case
$PMTYPE
in
#apt-rpm)
#apt-rpm)
# ALT Linux only
# ALT Linux only
...
@@ -31,7 +35,7 @@ case $PMTYPE in
...
@@ -31,7 +35,7 @@ case $PMTYPE in
apt-dpkg|aptitude-dpkg
)
apt-dpkg|aptitude-dpkg
)
assure_exists deborphan
assure_exists deborphan
showcmd deborphan
showcmd deborphan
deborphan | sudocmd epm remove
a
=
deborphan | sudocmd epm remove
;;
;;
#aura)
#aura)
# sudocmd aura -Oj
# sudocmd aura -Oj
...
...
bin/epm-autoremove
View file @
aeac7c5d
...
@@ -37,6 +37,10 @@ __epm_autoremove_altrpm()
...
@@ -37,6 +37,10 @@ __epm_autoremove_altrpm()
epm_autoremove
()
epm_autoremove
()
{
{
[
-z
"
$pkg_filenames
"
]
||
fatal
"No arguments are allowed here"
case
$PMTYPE
in
case
$PMTYPE
in
apt-rpm
)
apt-rpm
)
# ALT Linux only
# ALT Linux only
...
@@ -62,6 +66,9 @@ case $PMTYPE in
...
@@ -62,6 +66,9 @@ case $PMTYPE in
sudocmd yum remove
$PKGLIST
sudocmd yum remove
$PKGLIST
done
done
;;
;;
dnf-rpm
)
sudocmd dnf autoremove
;;
# see autoorhans
# see autoorhans
#urpm-rpm)
#urpm-rpm)
# sudocmd urpme --auto-orphans
# sudocmd urpme --auto-orphans
...
...
bin/epm-check_updated_repo
View file @
aeac7c5d
...
@@ -58,10 +58,11 @@ update_repo_if_needed()
...
@@ -58,10 +58,11 @@ update_repo_if_needed()
sudo
-n
true
2>/dev/null
||
{
info
"sudo requires a password, skip repo status checking"
;
return
0
;
}
sudo
-n
true
2>/dev/null
||
{
info
"sudo requires a password, skip repo status checking"
;
return
0
;
}
fi
fi
cd
/
if
!
__is_repo_info_downloaded
||
!
__is_repo_info_uptodate
;
then
if
!
__is_repo_info_downloaded
||
!
__is_repo_info_uptodate
;
then
load_helper epm-update
load_helper epm-update
epm_update
pkg_filenames
=
epm_update
return
fi
fi
cd
-
>
/dev/null
}
}
bin/epm-checksystem
View file @
aeac7c5d
...
@@ -22,10 +22,11 @@
...
@@ -22,10 +22,11 @@
epm_checksystem_ALTLinux
()
epm_checksystem_ALTLinux
()
{
{
local
TDIR
=
$(
mktemp
-d
)
local
TDIR
=
$(
mktemp
-d
)
assure_exists
time
touch
$TDIR
/added
touch
$TDIR
/added
for
ft
in
$(
ls
/usr/lib/rpm/
*
.filetrigger |
sort
)
;
do
for
ft
in
$(
ls
/usr/lib/rpm/
*
.filetrigger |
sort
)
;
do
echo
"Try run
$ft
..."
echo
"Try run
$ft
..."
echo
$TDIR
/added
$TDIR
/removed |
time
$ft
echo
$TDIR
/added
$TDIR
/removed |
a
=
time
$ft
done
done
rm
-f
$TDIR
/added fatal
rm
-f
$TDIR
/added fatal
rmdir
$TDIR
||
fatal
rmdir
$TDIR
||
fatal
...
@@ -50,6 +51,10 @@ esac
...
@@ -50,6 +51,10 @@ esac
}
}
SUDO
=
sudo
# direct debug run
DISTRNAME
=
ALTLinux
if
[
"
$1
"
=
"--debug"
]
;
then
epm_checksystem
shift
SUDO
=
sudo
DISTRNAME
=
ALTLinux
epm_checksystem
fi
bin/epm-clean
View file @
aeac7c5d
...
@@ -36,6 +36,10 @@ __remove_deb_apt_cache_file()
...
@@ -36,6 +36,10 @@ __remove_deb_apt_cache_file()
epm_clean
()
epm_clean
()
{
{
[
-z
"
$pkg_filenames
"
]
||
fatal
"No arguments are allowed here"
case
$PMTYPE
in
case
$PMTYPE
in
apt-rpm
)
apt-rpm
)
sudocmd apt-get clean
sudocmd apt-get clean
...
...
bin/epm-downgrade
View file @
aeac7c5d
#!/bin/sh
#!/bin/sh
#
#
# Copyright (C) 2012,2014 Etersoft
# Copyright (C) 2012,2014
,2016
Etersoft
# Copyright (C) 2012,2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012,2014
,2016
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
...
@@ -19,13 +19,39 @@
...
@@ -19,13 +19,39 @@
load_helper epm-check_updated_repo
load_helper epm-check_updated_repo
__epm_add_apt_downgrade_preferences
()
__epm_add_a
lt_a
pt_downgrade_preferences
()
{
{
[
-r
/etc/apt/preferences
]
&&
fatal
"/etc/apt/preferences already exists"
[
-r
/etc/apt/preferences
]
&&
fatal
"/etc/apt/preferences already exists"
cat
<<
EOF
|
$SUDO
tee /etc/apt/preferences
cat
<<
EOF
|
$SUDO
tee /etc/apt/preferences
# main repo
Package: *
Package: *
Pin: release c=
$1
Pin: release c=
classic
Pin-Priority: 1001
Pin-Priority: 1001
# overload with addon repo
Package: *
Pin: release c=addon
Pin-Priority: 1101
EOF
}
# See https://wiki.debian.org/ru/AptPreferences
__epm_add_deb_apt_downgrade_preferences
()
{
[
-r
/etc/apt/preferences
]
&&
fatal
"/etc/apt/preferences already exists"
info
"Running with /etc/apt/preferences:"
cat
<<
EOF
|
$SUDO
tee /etc/apt/preferences
Package: *
Pin: release a=stable
Pin-Priority: 1001
Package: *
Pin: release a=testing
Pin-Priority: 900
Package: *
Pin: release a=unstable
Pin-Priority: 800
EOF
EOF
}
}
...
@@ -45,21 +71,29 @@ epm_downgrade()
...
@@ -45,21 +71,29 @@ epm_downgrade()
case
$PMTYPE
in
case
$PMTYPE
in
apt-rpm
)
apt-rpm
)
__epm_add_apt_downgrade_preferences classic
||
return
__epm_add_alt_apt_downgrade_preferences
||
return
if
[
-n
"
$pkg_filenames
"
]
;
then
sudocmd apt-get
install
$pkg_filenames
else
sudocmd apt-get dist-upgrade
sudocmd apt-get dist-upgrade
fi
__epm_remove_apt_downgrade_preferences
__epm_remove_apt_downgrade_preferences
;;
;;
apt-dpkg
)
apt-dpkg
)
__epm_add_apt_downgrade_preferences testing
||
return
__epm_add_deb_apt_downgrade_preferences
||
return
if
[
-n
"
$pkg_filenames
"
]
;
then
sudocmd apt-get
install
$pkg_filenames
else
sudocmd apt-get dist-upgrade
sudocmd apt-get dist-upgrade
fi
__epm_remove_apt_downgrade_preferences
__epm_remove_apt_downgrade_preferences
;;
;;
yum-rpm
)
yum-rpm
)
# can do update repobase automagically
# can do update repobase automagically
sudocmd yum downgrade
$pkg_filename
sudocmd yum downgrade
$pkg_filename
s
;;
;;
dnf-rpm
)
dnf-rpm
)
sudocmd dnf downgrade
$pkg_filename
sudocmd dnf downgrade
$pkg_filename
s
;;
;;
urpm-rpm
)
urpm-rpm
)
assure_exists urpm-reposync urpm-tools
assure_exists urpm-reposync urpm-tools
...
...
bin/epm-filelist
View file @
aeac7c5d
...
@@ -43,7 +43,7 @@ __alt_local_content_filelist()
...
@@ -43,7 +43,7 @@ __alt_local_content_filelist()
__deb_local_content_filelist
()
__deb_local_content_filelist
()
{
{
showcmd
"apt-file list
$1
| grep '^
$1
: ' | sed -e 's|
$1
: ||g'"
showcmd
"apt-file list
$1
| grep '^
$1
: ' | sed -e 's|
$1
: ||g'"
apt-file list
"
$1
"
|
grep
"^
$1
: "
|
sed
-e
"s|
$1
: ||g"
a
=
a
pt-file list
"
$1
"
|
grep
"^
$1
: "
|
sed
-e
"s|
$1
: ||g"
}
}
...
...
bin/epm-kernel_update
View file @
aeac7c5d
...
@@ -24,7 +24,7 @@ epm_kernel_update()
...
@@ -24,7 +24,7 @@ epm_kernel_update()
case
$DISTRNAME
in
case
$DISTRNAME
in
ALTLinux
)
ALTLinux
)
assure_exists update-kernel
assure_exists update-kernel
sudocmd update-kernel
sudocmd update-kernel
$pkg_filenames
return
;;
return
;;
esac
esac
...
...
bin/epm-optimize
View file @
aeac7c5d
...
@@ -32,6 +32,8 @@ __repack_rpm_base()
...
@@ -32,6 +32,8 @@ __repack_rpm_base()
epm_optimize
()
epm_optimize
()
{
{
[
-z
"
$pkg_filenames
"
]
||
fatal
"No arguments are allowed here"
case
$PMTYPE
in
case
$PMTYPE
in
*
-rpm
)
*
-rpm
)
#__repack_rpm_base
#__repack_rpm_base
...
...
bin/epm-packages
View file @
aeac7c5d
...
@@ -134,6 +134,7 @@ case $PMTYPE in
...
@@ -134,6 +134,7 @@ case $PMTYPE in
CMD
=
"apt-cyg list
$pkg_filenames
"
CMD
=
"apt-cyg list
$pkg_filenames
"
if
[
-z
"
$short
"
]
;
then
if
[
-z
"
$short
"
]
;
then
showcmd
$CMD
showcmd
$CMD
# TODO: fix this slow way
for
i
in
$(
$CMD
)
;
do
for
i
in
$(
$CMD
)
;
do
__aptcyg_print_full
$i
__aptcyg_print_full
$i
done
done
...
...
bin/epm-print
View file @
aeac7c5d
#!/bin/sh
#!/bin/sh
#
#
# Copyright (C) 2015 Etersoft
# Copyright (C) 2015
, 2016
Etersoft
# Copyright (C) 2008, 2015 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2008, 2015
, 2016
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
...
@@ -77,6 +77,12 @@ print_srcname()
...
@@ -77,6 +77,12 @@ print_srcname()
print_name
$(
print_srcpkgname
"
$@
"
)
print_name
$(
print_srcpkgname
"
$@
"
)
}
}
print_specname
()
{
# CHECKME: it is possible to have two or more specs in one package?
rpm
-qlp
"
$@
"
|
grep
"
\.
spec
\$
"
}
print_srcpkgname
()
print_srcpkgname
()
{
{
query_package_field sourcerpm
"
$@
"
query_package_field sourcerpm
"
$@
"
...
@@ -113,9 +119,10 @@ cat <<EOF
...
@@ -113,9 +119,10 @@ cat <<EOF
epm print version [from filename|for package] NN print only version of package name or package file
epm print version [from filename|for package] NN print only version of package name or package file
epm print release [from filename|for package] NN print only release of package name or package file
epm print release [from filename|for package] NN print only release of package name or package file
epm print field FF for package NN print field of the package
epm print field FF for package NN print field of the package
epm print pkgname from filename NN print package name for package file
epm print pkgname from filename NN print package name for
the
package file
epm print srcname from filename NN print source name for package file
epm print srcname from filename NN print source name for
the
package file
epm print srcpkgname from [filename|package] NN print source package name for the binary package file
epm print srcpkgname from [filename|package] NN print source package name for the binary package file
epm print specname from filename NN print spec filename for the source package file
epm print binpkgfilelist in DIR for NN list binary package(s) filename(s) from DIR for the source package file
epm print binpkgfilelist in DIR for NN list binary package(s) filename(s) from DIR for the source package file
EOF
EOF
;;
;;
...
@@ -172,6 +179,11 @@ EOF
...
@@ -172,6 +179,11 @@ EOF
[
-n
"
$1
"
]
||
fatal
"Arg is missed"
[
-n
"
$1
"
]
||
fatal
"Arg is missed"
print_srcpkgname
"
$@
"
print_srcpkgname
"
$@
"
;;
;;
"specname"
)
[
-n
"
$FNFLAG
"
]
||
[
-n
"
$PKFLAG
"
]
||
fatal
"print
$WHAT
works only for filename(s)"
[
-n
"
$1
"
]
||
fatal
"Arg is missed"
print_specname
"
$@
"
;;
"binpkgfilelist"
)
"binpkgfilelist"
)
# TODO: rpm only
# TODO: rpm only
# TODO: replace get_binpkg_list
# TODO: replace get_binpkg_list
...
...
bin/epm-provides
View file @
aeac7c5d
...
@@ -63,7 +63,7 @@ case $PMTYPE in
...
@@ -63,7 +63,7 @@ case $PMTYPE in
return
return
fi
fi
;;
;;
urpm-rpm|zypper-rpm|yum-rpm
)
urpm-rpm|zypper-rpm|yum-rpm
|dnf-rpm
)
if
is_installed
$pkg_names
;
then
if
is_installed
$pkg_names
;
then
CMD
=
"rpm -q --provides"
CMD
=
"rpm -q --provides"
else
else
...
...
bin/epm-query
View file @
aeac7c5d
...
@@ -66,12 +66,12 @@ _query_via_packages_list()
...
@@ -66,12 +66,12 @@ _query_via_packages_list()
# Note: we use short=1 here due grep by ^name$
# Note: we use short=1 here due grep by ^name$
# separate first line for print out command
# separate first line for print out command
short
=
1
pkg_filenames
=
$firstpkg
epm_packages |
grep
-q
--
"
$grepexp
"
&&
quiet
=
1
pkg_filenames
=
$firstpkg
epm_packages
$firstpkg
||
res
=
1
short
=
1
pkg_filenames
=
$firstpkg
epm_packages |
grep
-q
--
"
$grepexp
"
&&
quiet
=
1
pkg_filenames
=
$firstpkg
epm_packages
||
res
=
1
local
pkg
local
pkg
for
pkg
in
"
$@
"
;
do
for
pkg
in
"
$@
"
;
do
grepexp
=
$(
_get_grep_exp
$pkg
)
grepexp
=
$(
_get_grep_exp
$pkg
)
short
=
1
pkg_filenames
=
$pkg
epm_packages 2>/dev/null |
grep
-q
--
"
$grepexp
"
&&
quiet
=
1
pkg_filenames
=
$pkg
epm_packages
$pkg
||
res
=
1
short
=
1
pkg_filenames
=
$pkg
epm_packages 2>/dev/null |
grep
-q
--
"
$grepexp
"
&&
quiet
=
1
pkg_filenames
=
$pkg
epm_packages
||
res
=
1
done
done
return
$res
return
$res
...
...
bin/epm-query_file
View file @
aeac7c5d
...
@@ -146,6 +146,7 @@ __do_short_query()
...
@@ -146,6 +146,7 @@ __do_short_query()
epm_query_file
()
epm_query_file
()
{
{
# И где это используется?
# in short mode print handle only real names and do short output
# in short mode print handle only real names and do short output
# TODO: move to separate command?
# TODO: move to separate command?
# FIXME: it is possible use query
# FIXME: it is possible use query
...
...
bin/epm-query_package
View file @
aeac7c5d
...
@@ -27,5 +27,6 @@ epm_query_package()
...
@@ -27,5 +27,6 @@ epm_query_package()
local
MGS
local
MGS
MGS
=
$(
eval
__epm_search_make_grep
$quoted_args
)
MGS
=
$(
eval
__epm_search_make_grep
$quoted_args
)
EXTRA_SHOWDOCMD
=
$MGS
EXTRA_SHOWDOCMD
=
$MGS
# Note: get all packages list and do grep
eval
"pkg_filenames= epm_packages
\"
$(
eval
get_firstarg
$quoted_args
)
\"
$MGS
"
eval
"pkg_filenames= epm_packages
\"
$(
eval
get_firstarg
$quoted_args
)
\"
$MGS
"
}
}
bin/epm-reinstall
View file @
aeac7c5d
...
@@ -35,7 +35,7 @@ epm_reinstall_names()
...
@@ -35,7 +35,7 @@ epm_reinstall_names()
sudocmd dnf reinstall
$@
sudocmd dnf reinstall
$@
return
;;
return
;;
pkgng
)
pkgng
)
sudocm
f
pkg
install
-f
$@
sudocm
d
pkg
install
-f
$@
return
;;
return
;;
slackpkg
)
slackpkg
)
sudocmd_foreach
"/usr/sbin/slackpkg reinstall"
$@
sudocmd_foreach
"/usr/sbin/slackpkg reinstall"
$@
...
...
bin/epm-removerepo
View file @
aeac7c5d
...
@@ -28,7 +28,8 @@ case $PMTYPE in
...
@@ -28,7 +28,8 @@ case $PMTYPE in
info
"You need remove repo from /etc/apt/sources.list"
info
"You need remove repo from /etc/apt/sources.list"
;;
;;
yum-rpm
)
yum-rpm
)
info
"You need remove repo from /etc/yum.repos.d/"
assure_exists yum-utils
sudocmd yum-config-manager
--disable
"
$pkg_filenames
"
;;
;;
urpm-rpm
)
urpm-rpm
)
sudocmd urpmi.removemedia
"
$pkg_filenames
"
sudocmd urpmi.removemedia
"
$pkg_filenames
"
...
...
bin/epm-repofix
View file @
aeac7c5d
...
@@ -31,6 +31,9 @@ __fix_apt_sources_list()
...
@@ -31,6 +31,9 @@ __fix_apt_sources_list()
epm_repofix
()
epm_repofix
()
{
{
[
-z
"
$pkg_filenames
"
]
||
fatal
"No arguments are allowed here"
case
$PMTYPE
in
case
$PMTYPE
in
apt-rpm
)
apt-rpm
)
assure_exists apt-repo
assure_exists apt-repo
...
...
bin/epm-requires
View file @
aeac7c5d
...
@@ -68,7 +68,18 @@ case $PMTYPE in
...
@@ -68,7 +68,18 @@ case $PMTYPE in
CMD
=
"rpm -q --requires"
CMD
=
"rpm -q --requires"
;;
;;
yum-rpm
)
yum-rpm
)
if
is_installed
$pkg_names
;
then
CMD
=
"rpm -q --requires"
else
CMD
=
"yum deplist"
CMD
=
"yum deplist"
fi
;;
dnf-rpm
)
if
is_installed
$pkg_names
;
then
CMD
=
"rpm -q --requires"
else
CMD
=
"dnf repoquery --requires"
fi
;;
;;
pacman
)
pacman
)
CMD
=
"pactree"
CMD
=
"pactree"
...
...
bin/epm-search
View file @
aeac7c5d
...
@@ -96,7 +96,7 @@ case $PMTYPE in
...
@@ -96,7 +96,7 @@ case $PMTYPE in
;;
;;
esac
esac
docmd
$CMD
$string
LANG
=
C
docmd
$CMD
$string
}
}
# TODO: use ^ as first word, use ~ for negate, for epmqp too
# TODO: use ^ as first word, use ~ for negate, for epmqp too
...
@@ -123,22 +123,28 @@ __epm_search_make_grep()
...
@@ -123,22 +123,28 @@ __epm_search_make_grep()
#list=$(strip_spaces $list | sed -e "s/ /|/g")
#list=$(strip_spaces $list | sed -e "s/ /|/g")
listN
=
$(
strip_spaces
$listN
|
sed
-e
"s/ /|/g"
|
sed
-e
"s/
\^
//g"
)
listN
=
$(
strip_spaces
$listN
|
sed
-e
"s/ /|/g"
|
sed
-e
"s/
\^
//g"
)
if
[
"
$short
"
]
;
then
echon
" | sed -e
\"
s| .*||g
\"
"
fi
[
-n
"
$listN
"
]
&&
echon
" | egrep -i -v --
\"
$listN
\"
"
[
-n
"
$listN
"
]
&&
echon
" | egrep -i -v --
\"
$listN
\"
"
# FIXME: The World has not idea how to do grep both string
# FIXME: The World has not idea how to do grep both string
# http://stackoverflow.com/questions/10110051/grep-with-two-strings-logical-and-in-regex?rq=1
# http://stackoverflow.com/questions/10110051/grep-with-two-strings-logical-and-in-regex?rq=1
# Need only if we have more than one word (with one word we will grep for colorify)
if
[
"
$(
echo
"
$list
"
|
wc
-w
)
"
-gt
1
]
;
then
for
i
in
$list
;
do
for
i
in
$list
;
do
# FIXME -n on MacOS?
# FIXME -n on MacOS?
echon
" | egrep -i --
\"
$i
\"
"
echon
" | egrep -i --
\"
$i
\"
"
done
done
if
[
"
$short
"
]
;
then
echon
" | sed -e
\"
s| .*||g
\"
"
fi
fi
# FIXME: move from it
# FIXME: move from it
#isatty || return
#isatty || return
# TODO: sorts word by length from large to short
local
COLO
=
""
local
COLO
=
""
# rule for colorife
# rule for colorife
for
i
in
$list
$listN
;
do
for
i
in
$list
$listN
;
do
...
@@ -146,6 +152,7 @@ __epm_search_make_grep()
...
@@ -146,6 +152,7 @@ __epm_search_make_grep()
COLO
=
"
$COLO$i
"
COLO
=
"
$COLO$i
"
done
done
# TODO: use some colorifer instead grep (check grep adove too)
if
[
-n
"
$list
"
]
;
then
if
[
-n
"
$list
"
]
;
then
echon
" | egrep -i
$EGREPCOLOR
--
\"
(
$COLO
)
\"
"
echon
" | egrep -i
$EGREPCOLOR
--
\"
(
$COLO
)
\"
"
fi
fi
...
...
bin/epm-search_file
View file @
aeac7c5d
...
@@ -49,9 +49,13 @@ case $PMTYPE in
...
@@ -49,9 +49,13 @@ case $PMTYPE in
docmd apt-file search
$pkg_filenames
docmd apt-file search
$pkg_filenames
return
;;
return
;;
yum-rpm
)
yum-rpm
)
# TODO
info
"Search by full packages list does not realized"
CMD
=
"yum provides"
CMD
=
"yum provides"
;;
;;
dnf-rpm
)
dnf-rpm
)
# TODO
info
"Search by full packages list does not realized"
CMD
=
"dnf provides"
CMD
=
"dnf provides"
;;
;;
urpm-rpm
)
urpm-rpm
)
...
...
bin/epm-site
View file @
aeac7c5d
#!/bin/sh
#!/bin/sh
#
#
# Copyright (C) 2015 Etersoft
# Copyright (C) 2015
,2016
Etersoft
# Copyright (C) 2015 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2015
,2016
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
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
load_helper epm-query
load_helper epm-query
load_helper epm-print
load_helper epm-print
PAOURL
=
"https://packages.altlinux.org"
run_command_if_exists
()
run_command_if_exists
()
{
{
local
CMD
=
"
$1
"
local
CMD
=
"
$1
"
...
@@ -41,12 +43,13 @@ open_browser()
...
@@ -41,12 +43,13 @@ open_browser()
__query_package_hl_url
()
__query_package_hl_url
()
{
{
local
PAOAPI
=
"
$PAOURL
/api"
case
$DISTRNAME
in
case
$DISTRNAME
in
ALTLinux
)
ALTLinux
)
# http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs
# http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs
epm assure curl
||
return
1
epm assure curl
||
return
1
showcmd curl
"
http://packages.altlinux.org/api
/srpms/
$1
"
showcmd curl
"
$PAOAPI
/srpms/
$1
"
curl
-s
--header
"Accept: application/json"
"
http://packages.altlinux.org/api
/srpms/
$1
"
|
grep
'"url"'
|
sed
-e
's|.*"url":"||g'
|
sed
-e
's|".*||g'
curl
-s
--header
"Accept: application/json"
"
$PAOAPI
/srpms/
$1
"
|
grep
'"url"'
|
sed
-e
's|.*"url":"||g'
|
sed
-e
's|".*||g'
return
0
return
0
;;
;;
esac
esac
...
@@ -87,7 +90,7 @@ get_pao_url()
...
@@ -87,7 +90,7 @@ get_pao_url()
*
)
*
)
loc
=
en
loc
=
en
esac
esac
echo
"
http://packages.altlinux.org
/
$loc
/Sisyphus/srpms"
echo
"
$PAOURL
/
$loc
/Sisyphus/srpms"
}
}
query_altlinux_url
()
query_altlinux_url
()
...
@@ -109,7 +112,7 @@ epm_site()
...
@@ -109,7 +112,7 @@ epm_site()
[
-n
"
$pkg_filenames
"
]
||
fatal
"Info: missing package(s) name"
[
-n
"
$pkg_filenames
"
]
||
fatal
"Info: missing package(s) name"
PAO
=
local
PAO
=
""
for
f
in
$pkg_names
$pkg_files
;
do
for
f
in
$pkg_names
$pkg_files
;
do
[
"
$f
"
=
"-p"
]
&&
PAO
=
"
$f
"
&&
continue
[
"
$f
"
=
"-p"
]
&&
PAO
=
"
$f
"
&&
continue
if
[
-n
"
$PAO
"
]
;
then
if
[
-n
"
$PAO
"
]
;
then
...
...
bin/epm-update
View file @
aeac7c5d
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
epm_update
()
epm_update
()
{
{
[
-z
"
$pkg_filenames
"
]
||
fatal
"No arguments are allowed here"
info
"Running command for update remote package repository database"
info
"Running command for update remote package repository database"
case
$PMTYPE
in
case
$PMTYPE
in
...
...
bin/epm-upgrade
View file @
aeac7c5d
...
@@ -23,6 +23,8 @@ epm_upgrade()
...
@@ -23,6 +23,8 @@ epm_upgrade()
{
{
local
CMD
local
CMD
[
-z
"
$pkg_filenames
"
]
||
fatal
"No arguments are allowed here"
# it is useful for first time running
# it is useful for first time running
update_repo_if_needed
update_repo_if_needed
...
...
bin/epm-whatdepends
View file @
aeac7c5d
...
@@ -40,6 +40,9 @@ case $PMTYPE in
...
@@ -40,6 +40,9 @@ case $PMTYPE in
yum-rpm
)
yum-rpm
)
CMD
=
"repoquery --whatrequires"
CMD
=
"repoquery --whatrequires"
;;
;;
dnf-rpm
)
CMD
=
"repoquery --whatrequires"
;;
emerge
)
emerge
)
assure_exists equery
assure_exists equery
CMD
=
"equery depends -a"
CMD
=
"equery depends -a"
...
...
bin/epm-whatprovides
View file @
aeac7c5d
...
@@ -38,6 +38,9 @@ case $PMTYPE in
...
@@ -38,6 +38,9 @@ case $PMTYPE in
yum-rpm
)
yum-rpm
)
CMD
=
"yum whatprovides"
CMD
=
"yum whatprovides"
;;
;;
dnf-rpm
)
CMD
=
"yum provides"
;;
zypper-rpm
)
zypper-rpm
)
CMD
=
"zypper what-provides"
CMD
=
"zypper what-provides"
;;
;;
...
...
bin/serv
View file @
aeac7c5d
#!/bin/sh
#!/bin/sh
#
#
# Copyright (C) 2012-2013 Etersoft
# Copyright (C) 2012-2013
, 2016
Etersoft
# Copyright (C) 2012-2013 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2013
, 2016
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
...
@@ -61,7 +61,9 @@ is_active_systemd()
...
@@ -61,7 +61,9 @@ is_active_systemd()
SYSTEMD_CGROUP_DIR
=
/sys/fs/cgroup/systemd
SYSTEMD_CGROUP_DIR
=
/sys/fs/cgroup/systemd
[
-x
"
$SYSTEMCTL
"
]
||
return
[
-x
"
$SYSTEMCTL
"
]
||
return
[
-d
"
$SYSTEMD_CGROUP_DIR
"
]
||
return
[
-d
"
$SYSTEMD_CGROUP_DIR
"
]
||
return
a
=
mountpoint
-q
"
$SYSTEMD_CGROUP_DIR
"
a
=
mountpoint
-q
"
$SYSTEMD_CGROUP_DIR
"
||
return
# some hack
pidof systemd
>
/dev/null
}
}
case
$DISTRNAME
in
case
$DISTRNAME
in
...
@@ -128,7 +130,7 @@ print_version()
...
@@ -128,7 +130,7 @@ print_version()
{
{
echo
"Service manager version @VERSION@"
echo
"Service manager version @VERSION@"
echo
"Running on
$(
$DISTRVENDOR
)
"
echo
"Running on
$(
$DISTRVENDOR
)
"
echo
"Copyright (c) Etersoft 2012, 2013"
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."
}
}
...
@@ -192,6 +194,10 @@ check_command()
...
@@ -192,6 +194,10 @@ check_command()
off|disable
)
# HELPCMD: remove service to run on startup and stop it now
off|disable
)
# HELPCMD: remove service to run on startup and stop it now
serv_cmd
=
disable
serv_cmd
=
disable
;;
;;
print
)
# HELPCMD: print some info
serv_cmd
=
print
withoutservicename
=
1
;;
*
)
*
)
return
1
return
1
;;
;;
...
...
bin/serv-print
0 → 100644
View file @
aeac7c5d
#!/bin/sh
#
# Copyright (C) 2016 Etersoft
# Copyright (C) 2016 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
serv_print
()
{
echo
"Detected init system:
$SERVICETYPE
"
}
bin/tools-eget
View file @
aeac7c5d
...
@@ -20,37 +20,61 @@
...
@@ -20,37 +20,61 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
WGET
=
"wget"
WGET
=
"wget -q"
if
[
"
$1
"
=
"-q"
]
;
then
WGET
=
"wget -q"
shift
fi
# TODO:
# -P support
# If ftp protocol or have no asterisk, jus download
# TODO: use has()
if
echo
"
$1
"
|
grep
-q
"
\(
^ftp://
\|
[^*]
$\
)"
;
then
if
echo
"
$1
"
|
grep
-q
"
\(
^ftp://
\|
[^*]
$\
)"
;
then
$WGET
$1
&&
exit
0
$WGET
"
$1
"
exit
fi
fi
URL
=
$(
echo
$1
|
grep
/
$
||
dirname
$1
)
MASK
=
$(
basename
$1
)
MYTMPDIR
=
"
$(
mktemp
-d
)
"
DIRALLFILES
=
"
$MYTMPDIR
/files/"
get_index
(){
echo
"Fall to http workaround"
URL
=
$(
echo
"
$1
"
|
grep
"/$"
||
dirname
"
$1
"
)
# mask allowed only in last part of path
MASK
=
$(
basename
"
$1
"
)
get_index
()
{
MYTMPDIR
=
"
$(
mktemp
-d
)
"
INDEX
=
$MYTMPDIR
/index
INDEX
=
$MYTMPDIR
/index
$WGET
$URL
-O
$INDEX
$WGET
$URL
-O
$INDEX
}
}
save_temp_files
(){
print_files
()
mkdir
-p
$DIRALLFILES
{
ALLFILES
=
"
$MYTMPDIR
/allfiles"
cat
$INDEX
|
grep
-o
-E
'href="([^\*/"#]+)"'
|
cut
-d
'"'
-f2
cat
$INDEX
|
grep
-o
-E
'href="([^\*/"#]+)"'
|
cut
-d
'"'
-f2
>
$ALLFILES
}
while
read
line
;
do
touch
$DIRALLFILES
/
$line
create_fake_files
()
done
<
$ALLFILES
{
DIRALLFILES
=
"
$MYTMPDIR
/files/"
mkdir
-p
"
$DIRALLFILES
"
print_files |
while
read
line
;
do
touch
$DIRALLFILES
/
$(
basename
"
$line
"
)
done
}
}
sort_files
(){
download_files
()
{
ERROR
=
0
for
line
in
$DIRALLFILES
/
$MASK
;
do
for
line
in
$DIRALLFILES
/
$MASK
;
do
$WGET
$URL
/
`
basename
"
$line
"
`
-P
$CURRENTDIR
/
$WGET
$URL
/
$(
basename
"
$line
"
)
||
ERROR
=
1
done
done
return
$ERROR
}
}
get_index
get_index
||
exit
save_temp_files
create_fake_files
sort_files
download_files
||
echo
"There was some download errors"
>
&2
rm
-rf
"
$MYTMPDIR
"
check_reqs.sh
0 → 100755
View file @
aeac7c5d
#!/bin/sh
/usr/lib/rpm/shell.req bin/epm-
*
|
sort
-u
eepm.spec
View file @
aeac7c5d
# This spec is backported to ALTLinux p7 automatically by rpmbph script
. Do not edit it
.
# This spec is backported to ALTLinux p7 automatically by rpmbph script
from etersoft-build-utils
.
#
#
Name: eepm
Name: eepm
Version: 1.
5.24
Version: 1.
6.3
Release: alt0.M70P.1
Release: alt0.M70P.1
Summary: Etersoft EPM package manager
Summary: Etersoft EPM package manager
...
@@ -67,8 +67,39 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
...
@@ -67,8 +67,39 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv
%_sysconfdir/bash_completion.d/cerv
%changelog
%changelog
* Mon Dec 07 2015 Andrey Cherepanov <cas@altlinux.org> 1.5.24-alt0.M70P.1
* Thu Apr 07 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.3-alt0.M70P.1
- Backport new version to p7 branch
- backport to ALTLinux p7 (by rpmbph script)
* Tue Apr 05 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.3-alt1
- epm-checksystem: add assure_exists time
- check_updated_repo fix epm update
* Thu Mar 17 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.2-alt2
- add check_reqs script and cleanup all reqs
* Thu Mar 17 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.2-alt1
- epm: print error for extra unallowed args
- drop time requires
* Fri Feb 26 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.1-alt1
- distr_info: add Simply Linux detection
- epm: use yum-config-manager for managing repo in yum based distros
- fix downgrade for LINUX@Etersoft, Debian, Ubuntu, add support for downgrade one or a few packages
- epm search: optimize grep when search for one word, apply short option before all, disable localized description
- epm-site: use https for packages.altlinux.org
- add serv print command
- serv: fix systemd detection
* Wed Jan 27 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.0-alt1
- release long term support version 1.6
- epm-print: add print specname
- rewrite eget
* Wed Dec 16 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.25-alt1
- epm-checksystem: fix working in packed
- fix packed version
- improve dnf support
- small fixes
* Tue Dec 01 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.24-alt1
* Tue Dec 01 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.24-alt1
- add support apt-cyg on Cygwin
- add support apt-cyg on Cygwin
...
@@ -76,9 +107,6 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
...
@@ -76,9 +107,6 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
- epm-check_updated_rep: do not check on deb systems
- epm-check_updated_rep: do not check on deb systems
- epm-query: fix print package version for other systems
- epm-query: fix print package version for other systems
* Sun Nov 22 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.23-alt0.M70P.1
- backport to ALTLinux p7 (by rpmbph script)
* Sun Nov 22 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.23-alt1
* Sun Nov 22 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.23-alt1
- epm install: disable update if try install local package files
- epm install: disable update if try install local package files
- epm clean: remove partial files
- epm clean: remove partial files
...
...
packed/epm.sh
View file @
aeac7c5d
...
@@ -249,6 +249,10 @@ set_sudo()
...
@@ -249,6 +249,10 @@ set_sudo()
SUDO
=
""
SUDO
=
""
# skip SUDO if disabled
# skip SUDO if disabled
[
-n
"
$EPMNOSUDO
"
]
&&
return
[
-n
"
$EPMNOSUDO
"
]
&&
return
if
[
"
$DISTRNAME
"
=
"Cygwin"
]
||
[
"
$DISTRNAME
"
=
"Windows"
]
;
then
# skip sudo using on Windows
return
fi
EFFUID
=
`
id
-u
`
EFFUID
=
`
id
-u
`
...
@@ -280,7 +284,7 @@ set_eatmydata()
...
@@ -280,7 +284,7 @@ set_eatmydata()
# 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"
SUDO
=
"
$SUDO
eatmydata"
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
}
}
...
@@ -426,6 +430,9 @@ case $DISTRNAME in
...
@@ -426,6 +430,9 @@ case $DISTRNAME in
Android
)
Android
)
CMD
=
"android"
CMD
=
"android"
;;
;;
Cygwin
)
CMD
=
"aptcyg"
;;
*
)
*
)
fatal
"Have no suitable DISTRNAME
$DISTRNAME
"
fatal
"Have no suitable DISTRNAME
$DISTRNAME
"
;;
;;
...
@@ -447,7 +454,8 @@ case $PMTYPE in
...
@@ -447,7 +454,8 @@ case $PMTYPE in
info
"You need manually add repo to /etc/apt/sources.list"
info
"You need manually add repo to /etc/apt/sources.list"
;;
;;
yum-rpm
)
yum-rpm
)
info
"You need manually add repo to /etc/yum.repos.d/"
assure_exists yum-utils
sudocmd yum-config-manager
--add-repo
"
$pkg_filenames
"
;;
;;
urpm-rpm
)
urpm-rpm
)
sudocmd urpmi.addmedia
"
$pkg_filenames
"
sudocmd urpmi.addmedia
"
$pkg_filenames
"
...
@@ -549,6 +557,9 @@ epm_assure()
...
@@ -549,6 +557,9 @@ epm_assure()
epm_audit
()
epm_audit
()
{
{
[
-z
"
$pkg_filenames
"
]
||
fatal
"No arguments are allowed here"
case
$PMTYPE
in
case
$PMTYPE
in
pkgng
)
pkgng
)
sudocmd pkg audit
-F
sudocmd pkg audit
-F
...
@@ -564,6 +575,10 @@ esac
...
@@ -564,6 +575,10 @@ esac
epm_autoorphans
()
epm_autoorphans
()
{
{
[
-z
"
$pkg_filenames
"
]
||
fatal
"No arguments are allowed here"
case
$PMTYPE
in
case
$PMTYPE
in
#apt-rpm)
#apt-rpm)
# ALT Linux only
# ALT Linux only
...
@@ -576,7 +591,7 @@ case $PMTYPE in
...
@@ -576,7 +591,7 @@ case $PMTYPE in
apt-dpkg|aptitude-dpkg
)
apt-dpkg|aptitude-dpkg
)
assure_exists deborphan
assure_exists deborphan
showcmd deborphan
showcmd deborphan
deborphan | sudocmd epm remove
a
=
deborphan | sudocmd epm remove
;;
;;
#aura)
#aura)
# sudocmd aura -Oj
# sudocmd aura -Oj
...
@@ -640,6 +655,10 @@ __epm_autoremove_altrpm()
...
@@ -640,6 +655,10 @@ __epm_autoremove_altrpm()
epm_autoremove
()
epm_autoremove
()
{
{
[
-z
"
$pkg_filenames
"
]
||
fatal
"No arguments are allowed here"
case
$PMTYPE
in
case
$PMTYPE
in
apt-rpm
)
apt-rpm
)
# ALT Linux only
# ALT Linux only
...
@@ -665,6 +684,9 @@ case $PMTYPE in
...
@@ -665,6 +684,9 @@ case $PMTYPE in
sudocmd yum remove
$PKGLIST
sudocmd yum remove
$PKGLIST
done
done
;;
;;
dnf-rpm
)
sudocmd dnf autoremove
;;
# see autoorhans
# see autoorhans
#urpm-rpm)
#urpm-rpm)
# sudocmd urpme --auto-orphans
# sudocmd urpme --auto-orphans
...
@@ -717,7 +739,7 @@ __epm_changelog_files()
...
@@ -717,7 +739,7 @@ __epm_changelog_files()
case
$(
get_package_type
$1
)
in
case
$(
get_package_type
$1
)
in
rpm
)
rpm
)
assure_exists rpm
assure_exists rpm
docmd_foreach
"rpm -p --changelog"
$@
| less
docmd_foreach
"rpm -
q -
p --changelog"
$@
| less
;;
;;
*
)
*
)
fatal
"Have no suitable command for
$1
"
fatal
"Have no suitable command for
$1
"
...
@@ -731,7 +753,7 @@ __epm_changelog_local_names()
...
@@ -731,7 +753,7 @@ __epm_changelog_local_names()
case
$PMTYPE
in
case
$PMTYPE
in
apt-rpm|yum-rpm|dnf-rpm|urpm-rpm|zypper-rpm
)
apt-rpm|yum-rpm|dnf-rpm|urpm-rpm|zypper-rpm
)
docmd_foreach
"rpm --changelog"
$@
| less
docmd_foreach
"rpm -
q -
-changelog"
$@
| less
;;
;;
apt-dpkg|aptitude-dpkg
)
apt-dpkg|aptitude-dpkg
)
docmd zcat /usr/share/doc/
$1
/changelog.Debian.gz | less
docmd zcat /usr/share/doc/
$1
/changelog.Debian.gz | less
...
@@ -775,7 +797,7 @@ __epm_changelog_unlocal_names()
...
@@ -775,7 +797,7 @@ __epm_changelog_unlocal_names()
docmd equery changes
-f
$1
| less
docmd equery changes
-f
$1
| less
;;
;;
*
)
*
)
fatal
"Have no suitable command for
$PMTYPE
"
fatal
"Have no suitable command for
$PMTYPE
. Try install the package firstly.
"
;;
;;
esac
esac
...
@@ -924,15 +946,75 @@ epm_checkpkg()
...
@@ -924,15 +946,75 @@ epm_checkpkg()
done
done
}
}
# File bin/epm-checksystem:
epm_checksystem_ALTLinux
()
{
local
TDIR
=
$(
mktemp
-d
)
assure_exists
time
touch
$TDIR
/added
for
ft
in
$(
ls
/usr/lib/rpm/
*
.filetrigger |
sort
)
;
do
echo
"Try run
$ft
..."
echo
$TDIR
/added
$TDIR
/removed |
a
=
time
$ft
done
rm
-f
$TDIR
/added fatal
rmdir
$TDIR
||
fatal
echo
"Count lines:"
wc
-l
/var/lib/rpm/files-awaiting-filetriggers
}
epm_checksystem
()
{
[
-n
"
$SUDO
"
]
||
fatal
"Do not use checksystem under root"
case
$DISTRNAME
in
ALTLinux
)
epm_checksystem_
$DISTRNAME
;;
*
)
fatal
"Have no suitable command for
$PMTYPE
"
;;
esac
}
if
[
"
$1
"
=
"--debug"
]
;
then
shift
SUDO
=
sudo
DISTRNAME
=
ALTLinux
epm_checksystem
fi
# File bin/epm-check_updated_repo:
# File bin/epm-check_updated_repo:
__is_repo_info_download
()
__is_repo_info_download
ed
()
{
{
case
$PMTYPE
in
case
$PMTYPE
in
apt-
*
)
apt-
*
)
if
[
-r
/var/cache/apt
]
;
then
if
[
-r
/var/cache/apt
]
;
then
# FIXME: only if root permissions
$SUDO
test
-r
/var/cache/apt/pkgcache.bin
||
return
test
-r
/var/cache/apt/pkgcache.bin
||
return
fi
;;
*
)
;;
esac
return
0
}
__is_repo_info_uptodate
()
{
case
$PMTYPE
in
apt-rpm
)
# apt-deb do not update lock file date
if
$SUDO
[
-r
/var/lib/apt/lists
]
;
then
local
LOCKFILE
=
/var/lib/apt/lists/lock
$SUDO
test
-r
$LOCKFILE
||
return
# if repo older than 1 day, return false
# find print string if file is obsoleted
test
-z
"
$(
$SUDO
find
$LOCKFILE
-mtime
+1
)
"
||
return
fi
fi
;;
;;
*
)
*
)
...
@@ -943,26 +1025,58 @@ __is_repo_info_download()
...
@@ -943,26 +1025,58 @@ __is_repo_info_download()
update_repo_if_needed
()
update_repo_if_needed
()
{
{
if
!
__is_repo_info_download
;
then
# check if we need skip update checking
load_helper epm-update
if
[
"
$1
"
=
"soft"
]
&&
[
-n
"
$SUDO
"
]
;
then
epm_
update
# if sudo requires a password, skip auto
update
return
sudo
-n
true
2>/dev/null
||
{
info
"sudo requires a password, skip repo status checking"
;
return
0
;
}
fi
fi
# TODO: if repo info is very obsoleted (a few days?), we need run update
cd
/
if
!
__is_repo_info_downloaded
||
!
__is_repo_info_uptodate
;
then
load_helper epm-update
pkg_filenames
=
epm_update
fi
cd
-
>
/dev/null
}
}
# File bin/epm-clean:
# File bin/epm-clean:
__remove_alt_apt_cache_file
()
{
sudocmd
rm
-vf
/var/cache/apt/
*
.bin
sudocmd
rm
-vf
/var/cache/apt/partial/
*
sudocmd
rm
-vf
/var/lib/apt/lists/
*
pkglist
*
sudocmd
rm
-vf
/var/lib/apt/lists/
*
release
*
}
__remove_deb_apt_cache_file
()
{
sudocmd
rm
-vf
/var/cache/apt/
*
.bin
sudocmd
rm
-vf
/var/cache/apt/archives/partial/
*
sudocmd
rm
-vf
/var/lib/apt/lists/
*
Packages
*
sudocmd
rm
-vf
/var/lib/apt/lists/
*
Release
*
sudocmd
rm
-vf
/var/lib/apt/lists/
*
Translation
*
}
epm_clean
()
epm_clean
()
{
{
[
-z
"
$pkg_filenames
"
]
||
fatal
"No arguments are allowed here"
case
$PMTYPE
in
case
$PMTYPE
in
apt-rpm
|apt-dpkg
)
apt-rpm
)
sudocmd apt-get clean
sudocmd apt-get clean
__remove_alt_apt_cache_file
;;
apt-dpkg
)
sudocmd apt-get clean
__remove_deb_apt_cache_file
;;
;;
aptitude-dpkg
)
aptitude-dpkg
)
sudocmd aptitude clean
sudocmd aptitude clean
__remove_deb_apt_cache_file
;;
;;
yum-rpm
)
yum-rpm
)
sudocmd yum clean all
sudocmd yum clean all
...
@@ -1086,13 +1200,36 @@ epm_conflicts()
...
@@ -1086,13 +1200,36 @@ epm_conflicts()
# File bin/epm-downgrade:
# File bin/epm-downgrade:
__epm_add_apt_downgrade_preferences
()
__epm_add_alt_apt_downgrade_preferences
()
{
[
-r
/etc/apt/preferences
]
&&
fatal
"/etc/apt/preferences already exists"
cat
<<
EOF
|
$SUDO
tee /etc/apt/preferences
Package: *
Pin: release c=classic
Pin-Priority: 1001
Package: *
Pin: release c=addon
Pin-Priority: 1101
EOF
}
__epm_add_deb_apt_downgrade_preferences
()
{
{
[
-r
/etc/apt/preferences
]
&&
fatal
"/etc/apt/preferences already exists"
[
-r
/etc/apt/preferences
]
&&
fatal
"/etc/apt/preferences already exists"
info
"Running with /etc/apt/preferences:"
cat
<<
EOF
|
$SUDO
tee /etc/apt/preferences
cat
<<
EOF
|
$SUDO
tee /etc/apt/preferences
Package: *
Package: *
Pin: release
c=
$1
Pin: release
a=stable
Pin-Priority: 1001
Pin-Priority: 1001
Package: *
Pin: release a=testing
Pin-Priority: 900
Package: *
Pin: release a=unstable
Pin-Priority: 800
EOF
EOF
}
}
...
@@ -1112,21 +1249,29 @@ epm_downgrade()
...
@@ -1112,21 +1249,29 @@ epm_downgrade()
case
$PMTYPE
in
case
$PMTYPE
in
apt-rpm
)
apt-rpm
)
__epm_add_apt_downgrade_preferences classic
||
return
__epm_add_alt_apt_downgrade_preferences
||
return
if
[
-n
"
$pkg_filenames
"
]
;
then
sudocmd apt-get
install
$pkg_filenames
else
sudocmd apt-get dist-upgrade
sudocmd apt-get dist-upgrade
fi
__epm_remove_apt_downgrade_preferences
__epm_remove_apt_downgrade_preferences
;;
;;
apt-dpkg
)
apt-dpkg
)
__epm_add_apt_downgrade_preferences testing
||
return
__epm_add_deb_apt_downgrade_preferences
||
return
if
[
-n
"
$pkg_filenames
"
]
;
then
sudocmd apt-get
install
$pkg_filenames
else
sudocmd apt-get dist-upgrade
sudocmd apt-get dist-upgrade
fi
__epm_remove_apt_downgrade_preferences
__epm_remove_apt_downgrade_preferences
;;
;;
yum-rpm
)
yum-rpm
)
# can do update repobase automagically
# can do update repobase automagically
sudocmd yum downgrade
$pkg_filename
sudocmd yum downgrade
$pkg_filename
s
;;
;;
dnf-rpm
)
dnf-rpm
)
sudocmd dnf downgrade
$pkg_filename
sudocmd dnf downgrade
$pkg_filename
s
;;
;;
urpm-rpm
)
urpm-rpm
)
assure_exists urpm-reposync urpm-tools
assure_exists urpm-reposync urpm-tools
...
@@ -1146,7 +1291,10 @@ epm_download()
...
@@ -1146,7 +1291,10 @@ epm_download()
case
$PMTYPE
in
case
$PMTYPE
in
dnf-rpm
)
dnf-rpm
)
sudocmd dnf download
$pkg_filename
sudocmd dnf download
$pkg_filenames
;;
aptcyg
)
sudocmd apt-cyg download
$pkg_filenames
;;
;;
*
)
*
)
fatal
"Have no suitable command for
$PMTYPE
"
fatal
"Have no suitable command for
$PMTYPE
"
...
@@ -1174,6 +1322,12 @@ __alt_local_content_filelist()
...
@@ -1174,6 +1322,12 @@ __alt_local_content_filelist()
}
|
$OUTCMD
}
|
$OUTCMD
}
}
__deb_local_content_filelist
()
{
showcmd
"apt-file list
$1
| grep '^
$1
: ' | sed -e 's|
$1
: ||g'"
a
=
apt-file list
"
$1
"
|
grep
"^
$1
: "
|
sed
-e
"s|
$1
: ||g"
}
__epm_filelist_remote
()
__epm_filelist_remote
()
{
{
...
@@ -1185,9 +1339,10 @@ __epm_filelist_remote()
...
@@ -1185,9 +1339,10 @@ __epm_filelist_remote()
docmd_foreach __alt_local_content_filelist
$@
docmd_foreach __alt_local_content_filelist
$@
;;
;;
apt-dpkg
)
apt-dpkg
)
assure_exists apt-file
assure_exists apt-file
||
return
sudocmd apt-file update
# if sudo requires a password, skip autoupdate
docmd apt-file list
$@
sudo
-n
true
2>/dev/null
&&
sudocmd apt-file update
||
info
"sudo requires a password, skip apt-file update"
docmd_foreach __deb_local_content_filelist
$@
;;
;;
*
)
*
)
fatal
"Query filelist for non installed packages does not realized"
fatal
"Query filelist for non installed packages does not realized"
...
@@ -1226,21 +1381,12 @@ __epm_filelist_name()
...
@@ -1226,21 +1381,12 @@ __epm_filelist_name()
[
-z
"
$*
"
]
&&
return
[
-z
"
$*
"
]
&&
return
case
$PMTYPE
in
case
$PMTYPE
in
apt
-rpm
)
*
-rpm
)
CMD
=
"rpm -ql"
CMD
=
"rpm -ql"
;;
;;
*
-dpkg
)
*
-dpkg
)
CMD
=
"dpkg -L"
CMD
=
"dpkg -L"
;;
;;
yum-rpm
)
CMD
=
"rpm -ql"
;;
urpm-rpm
)
CMD
=
"rpm -ql"
;;
zypper-rpm
)
CMD
=
"rpm -ql"
;;
android
)
android
)
CMD
=
"pm list packages -f"
CMD
=
"pm list packages -f"
;;
;;
...
@@ -1248,7 +1394,7 @@ __epm_filelist_name()
...
@@ -1248,7 +1394,7 @@ __epm_filelist_name()
CMD
=
"conary query --ls"
CMD
=
"conary query --ls"
;;
;;
pacman
)
pacman
)
docmd pacman
-Ql
$
pkg_names
|
sed
-e
"s|.* ||g"
| less
docmd pacman
-Ql
$
@
|
sed
-e
"s|.* ||g"
| less
return
return
;;
;;
emerge
)
emerge
)
...
@@ -1258,8 +1404,12 @@ __epm_filelist_name()
...
@@ -1258,8 +1404,12 @@ __epm_filelist_name()
pkgng
)
pkgng
)
CMD
=
"pkg info -l"
CMD
=
"pkg info -l"
;;
;;
aptcyg
)
docmd apt-cyg listfiles
$@
|
sed
-e
"s|^|/|g"
return
;;
slackpkg
)
slackpkg
)
is_installed
$
pkg_names
||
fatal
"Query filelist for non installed packages does not realized"
is_installed
$
@
||
fatal
"Query filelist for non installed packages does not realized"
docmd
awk
'BEGIN{desk=1}{if(/^FILE LIST:$/){desk=0} else if (desk==0) {print}}'
/var/log/packages/
${
pkg_filenames
}*
| less
docmd
awk
'BEGIN{desk=1}{if(/^FILE LIST:$/){desk=0} else if (desk==0) {print}}'
/var/log/packages/
${
pkg_filenames
}*
| less
return
return
;;
;;
...
@@ -1269,9 +1419,9 @@ __epm_filelist_name()
...
@@ -1269,9 +1419,9 @@ __epm_filelist_name()
esac
esac
# TODO: add less
# TODO: add less
docmd
$CMD
$
pkg_names
&&
return
docmd
$CMD
$
@
&&
return
# TODO: may be we need check is installed before prev. line?
# TODO: may be we need check is installed before prev. line?
is_installed
$
pkg_names
||
__epm_filelist_remote
$pkg_names
is_installed
$
@
||
__epm_filelist_remote
$@
}
}
...
@@ -1281,7 +1431,7 @@ epm_filelist()
...
@@ -1281,7 +1431,7 @@ epm_filelist()
__epm_filelist_file
$pkg_files
||
return
__epm_filelist_file
$pkg_files
||
return
__epm_filelist_name
$
pkg_names
||
return
__epm_filelist_name
$
(
print_name
$pkg_names
)
||
return
}
}
...
@@ -1369,6 +1519,9 @@ case $PMTYPE in
...
@@ -1369,6 +1519,9 @@ case $PMTYPE in
homebrew
)
homebrew
)
docmd brew info
$pkg_names
docmd brew info
$pkg_names
;;
;;
aptcyg
)
docmd apt-cyg show
$pkg_names
;;
*
)
*
)
fatal
"Have no suitable command for
$PMTYPE
"
fatal
"Have no suitable command for
$PMTYPE
"
;;
;;
...
@@ -1523,6 +1676,9 @@ epm_install_names()
...
@@ -1523,6 +1676,9 @@ epm_install_names()
android
)
android
)
fatal
"We still have no idea how to use package repository, ever if it is F-Droid."
fatal
"We still have no idea how to use package repository, ever if it is F-Droid."
return
;;
return
;;
aptcyg
)
sudocmd apt-cyg
install
$@
return
;;
*
)
*
)
fatal
"Have no suitable install command for
$PMTYPE
"
fatal
"Have no suitable install command for
$PMTYPE
"
;;
;;
...
@@ -1747,6 +1903,9 @@ epm_print_install_command()
...
@@ -1747,6 +1903,9 @@ epm_print_install_command()
android
)
android
)
echo
"pm install
$@
"
echo
"pm install
$@
"
;;
;;
aptcyg
)
echo
"apt-cyg install
$@
"
;;
*
)
*
)
fatal
"Have no suitable appropriate install command for
$PMTYPE
"
fatal
"Have no suitable appropriate install command for
$PMTYPE
"
;;
;;
...
@@ -1777,8 +1936,10 @@ epm_install()
...
@@ -1777,8 +1936,10 @@ epm_install()
[
-z
"
$files$names
"
]
&&
info
"Skip empty install list"
&&
return
22
[
-z
"
$files$names
"
]
&&
info
"Skip empty install list"
&&
return
22
if
[
-z
"
$files
"
]
;
then
# it is useful for first time running
# it is useful for first time running
update_repo_if_needed
update_repo_if_needed
fi
epm_install_names
$names
||
return
epm_install_names
$names
||
return
epm_install_files
$files
epm_install_files
$files
...
@@ -1893,7 +2054,7 @@ epm_kernel_update()
...
@@ -1893,7 +2054,7 @@ epm_kernel_update()
case
$DISTRNAME
in
case
$DISTRNAME
in
ALTLinux
)
ALTLinux
)
assure_exists update-kernel
assure_exists update-kernel
sudocmd update-kernel
sudocmd update-kernel
$pkg_filenames
return
;;
return
;;
esac
esac
...
@@ -1904,6 +2065,37 @@ epm_kernel_update()
...
@@ -1904,6 +2065,37 @@ epm_kernel_update()
esac
esac
}
}
# File bin/epm-optimize:
__repack_rpm_base
()
{
assure_exists db_dump
||
fatal
assure_exists db_load
||
fatal
cd
/var/lib/rpm
||
fatal
mv
Packages Packages.BACKUP
||
fatal
# mask dependencies with a=
a
=
db_dump Packages.BACKUP |
a
=
db_load Packages
||
fatal
rm
Packages.BACKUP
}
epm_optimize
()
{
[
-z
"
$pkg_filenames
"
]
||
fatal
"No arguments are allowed here"
case
$PMTYPE
in
*
-rpm
)
#__repack_rpm_base
#rm -f /var/lib/rpm/__db*
rpm
--rebuilddb
;;
*
)
fatal
"Have no suitable command for
$PMTYPE
"
;;
esac
}
# File bin/epm-packages:
# File bin/epm-packages:
__epm_packages_sort
()
__epm_packages_sort
()
...
@@ -1922,6 +2114,13 @@ case $PMTYPE in
...
@@ -1922,6 +2114,13 @@ case $PMTYPE in
esac
esac
}
}
__aptcyg_print_full
()
{
#showcmd apt-cyg show
local
VERSION
=
$(
apt-cyg show
"
$1
"
|
grep
-m1
"^version: "
|
sed
-e
"s|^version: ||g"
)
echo
"
$1
-
$VERSION
"
}
epm_packages
()
epm_packages
()
{
{
local
CMD
local
CMD
...
@@ -1934,8 +2133,10 @@ case $PMTYPE in
...
@@ -1934,8 +2133,10 @@ case $PMTYPE in
;;
;;
*
-dpkg
)
*
-dpkg
)
#CMD="dpkg -l $pkg_filenames"
#CMD="dpkg -l $pkg_filenames"
CMD
=
"dpkg-query -W --showformat=
\$
{Package}-
\$
{Version}
\n
$pkg_filenames
"
CMD
=
"dpkg-query -W --showformat=
\$
{db:Status-Abbrev}
\$
{Package}-
\$
{Version}
\n
$pkg_filenames
"
[
-n
"
$short
"
]
&&
CMD
=
"dpkg-query -W --showformat=
\$
{Package}
\n
$pkg_filenames
"
[
-n
"
$short
"
]
&&
CMD
=
"dpkg-query -W --showformat=
\$
{db:Status-Abbrev}
\$
{Package}
\n
$pkg_filenames
"
docmd
$CMD
|
grep
"^i"
|
sed
-e
"s|.* ||g"
return
;;
;;
snappy
)
snappy
)
CMD
=
"snappy info"
CMD
=
"snappy info"
...
@@ -2008,6 +2209,17 @@ case $PMTYPE in
...
@@ -2008,6 +2209,17 @@ case $PMTYPE in
docmd
$CMD
|
sed
-e
"s|^package:||g"
docmd
$CMD
|
sed
-e
"s|^package:||g"
return
return
;;
;;
aptcyg
)
CMD
=
"apt-cyg list
$pkg_filenames
"
if
[
-z
"
$short
"
]
;
then
showcmd
$CMD
# TODO: fix this slow way
for
i
in
$(
$CMD
)
;
do
__aptcyg_print_full
$i
done
return
fi
;;
*
)
*
)
fatal
"Have no suitable query command for
$PMTYPE
"
fatal
"Have no suitable query command for
$PMTYPE
"
;;
;;
...
@@ -2017,6 +2229,213 @@ docmd $CMD
...
@@ -2017,6 +2229,213 @@ docmd $CMD
}
}
# File bin/epm-policy:
epm_policy
()
{
[
-n
"
$pkg_names
"
]
||
fatal
"Info: missing package(s) name"
case
$PMTYPE
in
apt-rpm
)
docmd apt-cache policy
$pkg_names
;;
apt-dpkg
)
docmd apt-cache policy
$pkg_names
;;
*
)
fatal
"Have no suitable command for
$PMTYPE
"
;;
esac
}
# File bin/epm-print:
query_package_field
()
{
local
FORMAT
=
"%{
$1
}
\n
"
shift
local
INSTALLED
=
"-p"
# if not file, drop -p for get from rpm base
[
-e
"
$1
"
]
||
INSTALLED
=
""
rpmquery
$INSTALLED
--queryformat
"
$FORMAT
"
"
$@
"
}
print_binpkgfilelist
()
{
local
PKGDIR
=
$1
local
PKGNAME
=
$(
basename
$2
)
find
"
$PKGDIR
"
!
-name
'*\.src\.rpm'
-name
'*\.rpm'
-execdir
\
rpmquery
-p
--qf
=
'%{sourcerpm}\t%{name}-%{version}-%{release}.%{arch}.rpm\n'
"{}"
\;
\
|
grep
"^
$PKGNAME
[[:space:]].*"
|
cut
-f2
| xargs
-n1
-I
"{}"
echo
-n
"
$PKGDIR
/{} "
}
PKGNAMEMASK
=
"
\(
.*
\)
-
\(
[0-9].*
\)
-
\(
.*[0-9].*
\)
"
print_name
()
{
echo
"
$@
"
| xargs
-n1
echo
|
sed
-e
"s|
$PKGNAMEMASK
|
\1
|g"
}
print_version
()
{
echo
"
$1
"
| xargs
-n1
echo
|
sed
-e
"s|
$PKGNAMEMASK
|
\2
|g"
}
print_release
()
{
echo
"
$1
"
| xargs
-n1
echo
|
sed
-e
"s|
$PKGNAMEMASK
|
\3
|g"
}
print_pkgname
()
{
local
i
for
i
in
$@
;
do
# TODO: deb and other, arch string
echo
"
$(
basename
"
$i
"
)
"
|
sed
-e
"s|
\.
[a-z_0-9]*
\.
rpm||g"
-e
"s|
\(
.*
\)
_
\(
.*
\)
_[a-z_0-9]*
\.
deb|
\1
-
\2
|g"
done
}
print_srcname
()
{
print_name
$(
print_srcpkgname
"
$@
"
)
}
print_specname
()
{
# CHECKME: it is possible to have two or more specs in one package?
rpm
-qlp
"
$@
"
|
grep
"
\.
spec
\$
"
}
print_srcpkgname
()
{
query_package_field sourcerpm
"
$@
"
}
__epm_print
()
{
local
WHAT
=
"
$1
"
shift
local
FNFLAG
=
local
PKFLAG
=
[
"
$1
"
=
"from"
]
&&
shift
[
"
$1
"
=
"for"
]
&&
shift
[
"
$1
"
=
"in"
]
&&
shift
if
[
"
$1
"
=
"filename"
]
;
then
FNFLAG
=
"
$1
"
shift
fi
if
[
"
$1
"
=
"package"
]
;
then
PKFLAG
=
"
$1
"
shift
fi
case
"
$WHAT
"
in
""
)
fatal
"Use epm print help for get help."
;;
"-h"
|
"--help"
|
"help"
)
cat
<<
EOF
Examples:
epm print name [from filename|for package] NN print only name of package name or package file
epm print version [from filename|for package] NN print only version of package name or package file
epm print release [from filename|for package] NN print only release of package name or package file
epm print field FF for package NN print field of the package
epm print pkgname from filename NN print package name for the package file
epm print srcname from filename NN print source name for the package file
epm print srcpkgname from [filename|package] NN print source package name for the binary package file
epm print specname from filename NN print spec filename for the source package file
epm print binpkgfilelist in DIR for NN list binary package(s) filename(s) from DIR for the source package file
EOF
;;
"name"
)
[
-n
"
$1
"
]
||
fatal
"Arg is missed"
if
[
-n
"
$FNFLAG
"
]
;
then
print_name
$(
print_pkgname
"
$@
"
)
elif
[
-n
"
$PKFLAG
"
]
;
then
query_package_field
"name"
"
$@
"
else
print_name
"
$@
"
fi
;;
"version"
)
[
-n
"
$1
"
]
||
fatal
"Arg is missed"
if
[
-n
"
$FNFLAG
"
]
;
then
print_version
$(
print_pkgname
"
$@
"
)
elif
[
-n
"
$PKFLAG
"
]
;
then
query_package_field
"version"
"
$@
"
else
print_version
"
$@
"
fi
;;
"release"
)
[
-n
"
$1
"
]
||
fatal
"Arg is missed"
if
[
-n
"
$FNFLAG
"
]
;
then
print_release
$(
print_pkgname
"
$@
"
)
elif
[
-n
"
$PKFLAG
"
]
;
then
query_package_field
"release"
"
$@
"
else
print_release
"
$@
"
fi
;;
"field"
)
[
-n
"
$1
"
]
||
fatal
"Arg is missed"
local
FIELD
=
"
$1
"
shift
[
"
$1
"
=
"for"
]
&&
shift
query_package_field
"
$FIELD
"
"
$@
"
;;
"pkgname"
)
[
-n
"
$FNFLAG
"
]
||
fatal
"print
$WHAT
works only for filename(s)"
[
-n
"
$1
"
]
||
fatal
"Arg is missed"
# TODO: drop_pkg_extensions
print_pkgname
"
$@
"
;;
"srcname"
)
[
-n
"
$FNFLAG
"
]
||
fatal
"print
$WHAT
works only for filename(s)"
[
-n
"
$1
"
]
||
fatal
"Arg is missed"
print_srcname
"
$@
"
;;
"srcpkgname"
)
[
-n
"
$FNFLAG
"
]
||
[
-n
"
$PKFLAG
"
]
||
fatal
"print
$WHAT
works only for filename(s)"
[
-n
"
$1
"
]
||
fatal
"Arg is missed"
print_srcpkgname
"
$@
"
;;
"specname"
)
[
-n
"
$FNFLAG
"
]
||
[
-n
"
$PKFLAG
"
]
||
fatal
"print
$WHAT
works only for filename(s)"
[
-n
"
$1
"
]
||
fatal
"Arg is missed"
print_specname
"
$@
"
;;
"binpkgfilelist"
)
# TODO: rpm only
# TODO: replace get_binpkg_list
local
DIR
=
"
$1
"
shift
[
"
$1
"
=
"for"
]
&&
shift
[
-n
"
$DIR
"
]
||
fatal
"DIR arg is missed"
[
-n
"
$1
"
]
||
fatal
"source package filename is missed"
print_binpkgfilelist
"
$DIR
"
"
$1
"
;;
*
)
fatal
"Unknown command
$
epm print
$WHAT
. Use epm print help for get help."
;;
esac
}
epm_print
()
{
[
-n
"
$pkg_filenames
"
]
||
fatal
"Missed args. Use epm print help for get help."
__epm_print
$(
eval echo
$quoted_args
)
}
# File bin/epm-programs:
# File bin/epm-programs:
...
@@ -2083,7 +2502,7 @@ case $PMTYPE in
...
@@ -2083,7 +2502,7 @@ case $PMTYPE in
return
return
fi
fi
;;
;;
urpm-rpm|zypper-rpm|yum-rpm
)
urpm-rpm|zypper-rpm|yum-rpm
|dnf-rpm
)
if
is_installed
$pkg_names
;
then
if
is_installed
$pkg_names
;
then
CMD
=
"rpm -q --provides"
CMD
=
"rpm -q --provides"
else
else
...
@@ -2123,7 +2542,7 @@ epm_provides()
...
@@ -2123,7 +2542,7 @@ epm_provides()
[
-n
"
$pkg_filenames
"
]
||
fatal
"Provides: missing package(s) name"
[
-n
"
$pkg_filenames
"
]
||
fatal
"Provides: missing package(s) name"
epm_provides_files
$pkg_files
epm_provides_files
$pkg_files
epm_provides_names
$
pkg_names
epm_provides_names
$
(
print_name
$pkg_names
)
}
}
# File bin/epm-query:
# File bin/epm-query:
...
@@ -2139,7 +2558,7 @@ _get_grep_exp()
...
@@ -2139,7 +2558,7 @@ _get_grep_exp()
echo
"/
$1
$"
echo
"/
$1
$"
}
}
_query_via_packages_list
()
_
short
query_via_packages_list
()
{
{
local
res
=
0
local
res
=
0
local
grepexp
local
grepexp
...
@@ -2148,9 +2567,11 @@ _query_via_packages_list()
...
@@ -2148,9 +2567,11 @@ _query_via_packages_list()
grepexp
=
$(
_get_grep_exp
$firstpkg
)
grepexp
=
$(
_get_grep_exp
$firstpkg
)
# Note: we use short=1 here due grep by ^name$
# separate first line for print out command
# separate first line for print out command
short
=
1
pkg_filenames
=
$firstpkg
epm_packages |
grep
--
"
$grepexp
"
||
res
=
1
short
=
1
pkg_filenames
=
$firstpkg
epm_packages |
grep
--
"
$grepexp
"
||
res
=
1
local
pkg
for
pkg
in
"
$@
"
;
do
for
pkg
in
"
$@
"
;
do
grepexp
=
$(
_get_grep_exp
$pkg
)
grepexp
=
$(
_get_grep_exp
$pkg
)
short
=
1
pkg_filenames
=
$pkg
epm_packages 2>/dev/null |
grep
--
"
$grepexp
"
||
res
=
1
short
=
1
pkg_filenames
=
$pkg
epm_packages 2>/dev/null |
grep
--
"
$grepexp
"
||
res
=
1
...
@@ -2159,6 +2580,28 @@ _query_via_packages_list()
...
@@ -2159,6 +2580,28 @@ _query_via_packages_list()
return
$res
return
$res
}
}
_query_via_packages_list
()
{
local
res
=
0
local
grepexp
local
firstpkg
=
$1
shift
grepexp
=
$(
_get_grep_exp
$firstpkg
)
# Note: we use short=1 here due grep by ^name$
# separate first line for print out command
short
=
1
pkg_filenames
=
$firstpkg
epm_packages |
grep
-q
--
"
$grepexp
"
&&
quiet
=
1
pkg_filenames
=
$firstpkg
epm_packages
||
res
=
1
local
pkg
for
pkg
in
"
$@
"
;
do
grepexp
=
$(
_get_grep_exp
$pkg
)
short
=
1
pkg_filenames
=
$pkg
epm_packages 2>/dev/null |
grep
-q
--
"
$grepexp
"
&&
quiet
=
1
pkg_filenames
=
$pkg
epm_packages
||
res
=
1
done
return
$res
}
__epm_get_hilevel_nameform
()
__epm_get_hilevel_nameform
()
{
{
[
-n
"
$*
"
]
||
return
[
-n
"
$*
"
]
||
return
...
@@ -2194,7 +2637,7 @@ __epm_get_hilevel_name()
...
@@ -2194,7 +2637,7 @@ __epm_get_hilevel_name()
for
i
in
$@
;
do
for
i
in
$@
;
do
local
pkg
local
pkg
# get short form in pkg
# get short form in pkg
quiet
=
1
short
=
1
pkg
=
$(
__epm_query_
name
$i
)
||
continue
# drop not installed packages
quiet
=
1
pkg
=
$(
__epm_query_short
name
$i
)
||
continue
# drop not installed packages
# if already short form, skipped
# if already short form, skipped
[
"
$pkg
"
=
"
$i
"
]
&&
echo
"
$i
"
&&
continue
[
"
$pkg
"
=
"
$i
"
]
&&
echo
"
$i
"
&&
continue
# try get long form or use short form
# try get long form or use short form
...
@@ -2234,12 +2677,10 @@ __epm_query_name()
...
@@ -2234,12 +2677,10 @@ __epm_query_name()
case
$PMTYPE
in
case
$PMTYPE
in
*
-rpm
)
*
-rpm
)
CMD
=
"rpm -q"
CMD
=
"rpm -q"
[
-n
"
$short
"
]
&&
CMD
=
"rpm -q --queryformat %{name}
\n
"
;;
;;
*
-dpkg
)
*
-dpkg
)
#docmd dpkg -l $@ | grep "^ii"
#docmd dpkg -l $@ | grep "^ii"
CMD
=
"dpkg-query -W --showformat=
\$
{Package}-
\$
{Version}
\n
"
CMD
=
"dpkg-query -W --showformat=
\$
{Package}-
\$
{Version}
\n
"
[
-n
"
$short
"
]
&&
CMD
=
"dpkg-query -W --showformat=
\$
{Package}
\n
"
;;
;;
npackd
)
npackd
)
docmd
"npackdcl path --package=
$@
"
docmd
"npackdcl path --package=
$@
"
...
@@ -2267,9 +2708,48 @@ __epm_query_name()
...
@@ -2267,9 +2708,48 @@ __epm_query_name()
docmd
$CMD
$@
docmd
$CMD
$@
}
}
__epm_query_shortname
()
{
local
CMD
[
-z
"
$*
"
]
&&
return
case
$PMTYPE
in
*
-rpm
)
CMD
=
"rpm -q --queryformat %{name}
\n
"
;;
*
-dpkg
)
CMD
=
"dpkg-query -W --showformat=
\$
{Package}
\n
"
;;
npackd
)
docmd
"npackdcl path --package=
$@
"
return
;;
conary
)
CMD
=
"conary query"
;;
homebrew
)
warning
"fix query"
return
1
;;
# TODO: need to print name if exists
#pkgng)
# CMD="pkg info -e"
# ;;
# Note: slackpkg info pkgname
*
)
# default slow workaround
_shortquery_via_packages_list
$@
return
;;
esac
docmd
$CMD
$@
}
is_installed
()
is_installed
()
{
{
pkg_filenames
=
"
$@
"
pkg_names
=
"
$@
"
epm_query
>
/dev/null 2>/dev/null
short
=
1
pkg_filenames
=
"
$@
"
pkg_names
=
"
$@
"
epm_query
>
/dev/null 2>/dev/null
# broken way to recursive call here (overhead!)
# broken way to recursive call here (overhead!)
#epm installed $@ >/dev/null 2>/dev/null
#epm installed $@ >/dev/null 2>/dev/null
}
}
...
@@ -2289,7 +2769,11 @@ epm_query()
...
@@ -2289,7 +2769,11 @@ epm_query()
__epm_query_file
$pkg_files
||
return
__epm_query_file
$pkg_files
||
return
__epm_query_name
$pkg_names
||
return
if
[
-n
"
$short
"
]
;
then
__epm_query_shortname
$(
print_name
$pkg_names
)
||
return
else
__epm_query_name
$(
print_name
$pkg_names
)
||
return
fi
}
}
# File bin/epm-query_file:
# File bin/epm-query_file:
...
@@ -2313,7 +2797,7 @@ __do_query_real_file()
...
@@ -2313,7 +2797,7 @@ __do_query_real_file()
if
[
-L
"
$TOFILE
"
]
;
then
if
[
-L
"
$TOFILE
"
]
;
then
local
LINKTO
local
LINKTO
__do_query
"
$TOFILE
"
__do_query
"
$TOFILE
"
LINKTO
=
$(
readlink
"
$TOFILE
"
)
LINKTO
=
$(
readlink
-f
"
$TOFILE
"
)
info
"Note:
$TOFILE
is link to
$LINKTO
"
info
"Note:
$TOFILE
is link to
$LINKTO
"
__do_query_real_file
"
$LINKTO
"
__do_query_real_file
"
$LINKTO
"
return
return
...
@@ -2374,6 +2858,11 @@ __do_query()
...
@@ -2374,6 +2858,11 @@ __do_query()
ipkg
)
ipkg
)
CMD
=
"ipkg files"
CMD
=
"ipkg files"
;;
;;
aptcyg
)
#CMD="apt-cyg packageof"
# do not realized locally
return
1
;;
*
)
*
)
fatal
"Have no suitable query command for
$PMTYPE
"
fatal
"Have no suitable query command for
$PMTYPE
"
;;
;;
...
@@ -2417,6 +2906,7 @@ __do_short_query()
...
@@ -2417,6 +2906,7 @@ __do_short_query()
epm_query_file
()
epm_query_file
()
{
{
# И где это используется?
# in short mode print handle only real names and do short output
# in short mode print handle only real names and do short output
# TODO: move to separate command?
# TODO: move to separate command?
# FIXME: it is possible use query
# FIXME: it is possible use query
...
@@ -2449,6 +2939,7 @@ epm_query_package()
...
@@ -2449,6 +2939,7 @@ epm_query_package()
local
MGS
local
MGS
MGS
=
$(
eval
__epm_search_make_grep
$quoted_args
)
MGS
=
$(
eval
__epm_search_make_grep
$quoted_args
)
EXTRA_SHOWDOCMD
=
$MGS
EXTRA_SHOWDOCMD
=
$MGS
# Note: get all packages list and do grep
eval
"pkg_filenames= epm_packages
\"
$(
eval
get_firstarg
$quoted_args
)
\"
$MGS
"
eval
"pkg_filenames= epm_packages
\"
$(
eval
get_firstarg
$quoted_args
)
\"
$MGS
"
}
}
...
@@ -2470,7 +2961,7 @@ epm_reinstall_names()
...
@@ -2470,7 +2961,7 @@ epm_reinstall_names()
sudocmd dnf reinstall
$@
sudocmd dnf reinstall
$@
return
;;
return
;;
pkgng
)
pkgng
)
sudocm
f
pkg
install
-f
$@
sudocm
d
pkg
install
-f
$@
return
;;
return
;;
slackpkg
)
slackpkg
)
sudocmd_foreach
"/usr/sbin/slackpkg reinstall"
$@
sudocmd_foreach
"/usr/sbin/slackpkg reinstall"
$@
...
@@ -2585,7 +3076,7 @@ epm_remove_low()
...
@@ -2585,7 +3076,7 @@ epm_remove_low()
sudocmd rpm
-ev
$nodeps
$@
sudocmd rpm
-ev
$nodeps
$@
return
;;
return
;;
apt-dpkg|aptitude-dpkg
)
apt-dpkg|aptitude-dpkg
)
sudocmd dpkg
-P
$(
subst_option nodeps
--force-all
)
$
@
sudocmd dpkg
-P
$(
subst_option nodeps
--force-all
)
$
(
print_name
"
$@
"
)
return
;;
return
;;
pkgsrc
)
pkgsrc
)
sudocmd pkg_delete
-r
$@
sudocmd pkg_delete
-r
$@
...
@@ -2678,6 +3169,9 @@ epm_remove_names()
...
@@ -2678,6 +3169,9 @@ epm_remove_names()
homebrew
)
homebrew
)
sudocmd brew remove
$@
sudocmd brew remove
$@
return
;;
return
;;
aptcyg
)
sudocmd apt-cyg remove
$@
return
;;
ipkg
)
ipkg
)
sudocmd ipkg
$(
subst_option force
-force-depends
)
remove
$@
sudocmd ipkg
$(
subst_option force
-force-depends
)
remove
$@
return
;;
return
;;
...
@@ -2751,6 +3245,9 @@ epm_print_remove_command()
...
@@ -2751,6 +3245,9 @@ epm_print_remove_command()
ipkg
)
ipkg
)
echo
"ipkg remove
$@
"
echo
"ipkg remove
$@
"
;;
;;
aptcyg
)
echo
"apt-cyg remove
$@
"
;;
*
)
*
)
fatal
"Have no suitable appropriate remove command for
$PMTYPE
"
fatal
"Have no suitable appropriate remove command for
$PMTYPE
"
;;
;;
...
@@ -2798,7 +3295,8 @@ case $PMTYPE in
...
@@ -2798,7 +3295,8 @@ case $PMTYPE in
info
"You need remove repo from /etc/apt/sources.list"
info
"You need remove repo from /etc/apt/sources.list"
;;
;;
yum-rpm
)
yum-rpm
)
info
"You need remove repo from /etc/yum.repos.d/"
assure_exists yum-utils
sudocmd yum-config-manager
--disable
"
$pkg_filenames
"
;;
;;
urpm-rpm
)
urpm-rpm
)
sudocmd urpmi.removemedia
"
$pkg_filenames
"
sudocmd urpmi.removemedia
"
$pkg_filenames
"
...
@@ -2825,6 +3323,47 @@ esac
...
@@ -2825,6 +3323,47 @@ esac
}
}
# File bin/epm-repofix:
SUBST_ALT_RULE
=
's!^([^#].*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ](Sisyphus|p7[/ ]branch|p6[/ ]branch)[/ ](x86_64|i586|x86_64-i586|noarch) !\1 \2/\3/\4 !gi'
__fix_apt_sources_list
()
{
[
-n
"
$SUDO
"
]
&&
fatal
"run only under root"
for
i
in
"
$@
"
;
do
[
-s
"
$i
"
]
||
continue
perl
-i
.bak
-pe
"
$SUBST_ALT_RULE
"
$i
done
}
epm_repofix
()
{
[
-z
"
$pkg_filenames
"
]
||
fatal
"No arguments are allowed here"
case
$PMTYPE
in
apt-rpm
)
assure_exists apt-repo
docmd apt-repo list
__fix_apt_sources_list /etc/apt/sources.list
__fix_apt_sources_list /etc/apt/sources.list.d/
*
.list
docmd apt-repo list
# rebuild rpm database
#sudocmd rm -fv /var/lib/rpm/__db*
#sudocmd rpm --rebuilddb
;;
yum-rpm|dnf-rpm
)
sudocmd
rm
-fv
/var/lib/rpm/__db
*
sudocmd rpm
--rebuilddb
;;
*
)
fatal
"Have no suitable command for
$PMTYPE
"
;;
esac
}
# File bin/epm-repolist:
# File bin/epm-repolist:
print_apt_sources_list
()
print_apt_sources_list
()
...
@@ -2931,7 +3470,18 @@ case $PMTYPE in
...
@@ -2931,7 +3470,18 @@ case $PMTYPE in
CMD
=
"rpm -q --requires"
CMD
=
"rpm -q --requires"
;;
;;
yum-rpm
)
yum-rpm
)
if
is_installed
$pkg_names
;
then
CMD
=
"rpm -q --requires"
else
CMD
=
"yum deplist"
CMD
=
"yum deplist"
fi
;;
dnf-rpm
)
if
is_installed
$pkg_names
;
then
CMD
=
"rpm -q --requires"
else
CMD
=
"dnf repoquery --requires"
fi
;;
;;
pacman
)
pacman
)
CMD
=
"pactree"
CMD
=
"pactree"
...
@@ -2954,6 +3504,12 @@ case $PMTYPE in
...
@@ -2954,6 +3504,12 @@ case $PMTYPE in
#CMD="pkg rquery '%dn-%dv'"
#CMD="pkg rquery '%dn-%dv'"
CMD
=
"pkg info -d"
CMD
=
"pkg info -d"
;;
;;
aptcyg
)
#CMD="apt-cyg depends"
# print show version
docmd apt-cyg show
$pkg_names
|
grep
"^requires: "
|
sed
"s|^requires: ||g"
return
;;
*
)
*
)
fatal
"Have no suitable command for
$PMTYPE
"
fatal
"Have no suitable command for
$PMTYPE
"
;;
;;
...
@@ -2968,7 +3524,7 @@ epm_requires()
...
@@ -2968,7 +3524,7 @@ epm_requires()
{
{
[
-n
"
$pkg_filenames
"
]
||
fatal
"Requires: missing package(s) name"
[
-n
"
$pkg_filenames
"
]
||
fatal
"Requires: missing package(s) name"
epm_requires_files
$pkg_files
epm_requires_files
$pkg_files
epm_requires_names
$
pkg_names
epm_requires_names
$
(
print_name
$pkg_names
)
}
}
# File bin/epm-search:
# File bin/epm-search:
...
@@ -3043,12 +3599,15 @@ case $PMTYPE in
...
@@ -3043,12 +3599,15 @@ case $PMTYPE in
android
)
android
)
CMD
=
"pm list packages"
CMD
=
"pm list packages"
;;
;;
aptcyg
)
CMD
=
"apt-cyg searchall"
;;
*
)
*
)
fatal
"Have no suitable search command for
$PMTYPE
"
fatal
"Have no suitable search command for
$PMTYPE
"
;;
;;
esac
esac
docmd
$CMD
$string
LANG
=
C
docmd
$CMD
$string
}
}
__epm_search_make_grep
()
__epm_search_make_grep
()
...
@@ -3073,22 +3632,28 @@ __epm_search_make_grep()
...
@@ -3073,22 +3632,28 @@ __epm_search_make_grep()
#list=$(strip_spaces $list | sed -e "s/ /|/g")
#list=$(strip_spaces $list | sed -e "s/ /|/g")
listN
=
$(
strip_spaces
$listN
|
sed
-e
"s/ /|/g"
|
sed
-e
"s/
\^
//g"
)
listN
=
$(
strip_spaces
$listN
|
sed
-e
"s/ /|/g"
|
sed
-e
"s/
\^
//g"
)
if
[
"
$short
"
]
;
then
echon
" | sed -e
\"
s| .*||g
\"
"
fi
[
-n
"
$listN
"
]
&&
echon
" | egrep -i -v --
\"
$listN
\"
"
[
-n
"
$listN
"
]
&&
echon
" | egrep -i -v --
\"
$listN
\"
"
# FIXME: The World has not idea how to do grep both string
# FIXME: The World has not idea how to do grep both string
# http://stackoverflow.com/questions/10110051/grep-with-two-strings-logical-and-in-regex?rq=1
# http://stackoverflow.com/questions/10110051/grep-with-two-strings-logical-and-in-regex?rq=1
# Need only if we have more than one word (with one word we will grep for colorify)
if
[
"
$(
echo
"
$list
"
|
wc
-w
)
"
-gt
1
]
;
then
for
i
in
$list
;
do
for
i
in
$list
;
do
# FIXME -n on MacOS?
# FIXME -n on MacOS?
echon
" | egrep -i --
\"
$i
\"
"
echon
" | egrep -i --
\"
$i
\"
"
done
done
if
[
"
$short
"
]
;
then
echon
" | sed -e
\"
s| .*||g
\"
"
fi
fi
# FIXME: move from it
# FIXME: move from it
#isatty || return
#isatty || return
# TODO: sorts word by length from large to short
local
COLO
=
""
local
COLO
=
""
# rule for colorife
# rule for colorife
for
i
in
$list
$listN
;
do
for
i
in
$list
$listN
;
do
...
@@ -3096,6 +3661,7 @@ __epm_search_make_grep()
...
@@ -3096,6 +3661,7 @@ __epm_search_make_grep()
COLO
=
"
$COLO$i
"
COLO
=
"
$COLO$i
"
done
done
# TODO: use some colorifer instead grep (check grep adove too)
if
[
-n
"
$list
"
]
;
then
if
[
-n
"
$list
"
]
;
then
echon
" | egrep -i
$EGREPCOLOR
--
\"
(
$COLO
)
\"
"
echon
" | egrep -i
$EGREPCOLOR
--
\"
(
$COLO
)
\"
"
fi
fi
...
@@ -3107,7 +3673,7 @@ epm_search()
...
@@ -3107,7 +3673,7 @@ epm_search()
[
-n
"
$pkg_filenames
"
]
||
fatal
"Search: missing search argument(s)"
[
-n
"
$pkg_filenames
"
]
||
fatal
"Search: missing search argument(s)"
# it is useful for first time running
# it is useful for first time running
update_repo_if_needed
update_repo_if_needed
soft
# FIXME: do it better
# FIXME: do it better
local
MGS
local
MGS
...
@@ -3150,9 +3716,13 @@ case $PMTYPE in
...
@@ -3150,9 +3716,13 @@ case $PMTYPE in
docmd apt-file search
$pkg_filenames
docmd apt-file search
$pkg_filenames
return
;;
return
;;
yum-rpm
)
yum-rpm
)
# TODO
info
"Search by full packages list does not realized"
CMD
=
"yum provides"
CMD
=
"yum provides"
;;
;;
dnf-rpm
)
dnf-rpm
)
# TODO
info
"Search by full packages list does not realized"
CMD
=
"dnf provides"
CMD
=
"dnf provides"
;;
;;
urpm-rpm
)
urpm-rpm
)
...
@@ -3170,6 +3740,10 @@ case $PMTYPE in
...
@@ -3170,6 +3740,10 @@ case $PMTYPE in
ipkg
)
ipkg
)
CMD
=
"ipkg search"
CMD
=
"ipkg search"
;;
;;
aptcyg
)
docmd apt-cyg searchall
$(
echo
"
$pkg_filenames
"
|
sed
-e
"s| /| |g"
)
return
;;
*
)
*
)
fatal
"Have no suitable search file command for
$PMTYPE
"
fatal
"Have no suitable search file command for
$PMTYPE
"
;;
;;
...
@@ -3329,11 +3903,123 @@ epm_simulate()
...
@@ -3329,11 +3903,123 @@ epm_simulate()
}
}
# File bin/epm-site:
PAOURL
=
"https://packages.altlinux.org"
run_command_if_exists
()
{
local
CMD
=
"
$1
"
shift
if
which
"
$CMD
"
2>/dev/null
>
/dev/null
;
then
docmd
"
$CMD
"
"
$@
"
return
0
fi
return
1
}
open_browser
()
{
local
i
for
i
in
xdg-open firefox chromium links
;
do
run_command_if_exists
$i
"
$@
"
&&
return
done
}
__query_package_hl_url
()
{
local
PAOAPI
=
"
$PAOURL
/api"
case
$DISTRNAME
in
ALTLinux
)
# http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs
epm assure curl
||
return
1
showcmd curl
"
$PAOAPI
/srpms/
$1
"
curl
-s
--header
"Accept: application/json"
"
$PAOAPI
/srpms/
$1
"
|
grep
'"url"'
|
sed
-e
's|.*"url":"||g'
|
sed
-e
's|".*||g'
return
0
;;
esac
return
1
}
query_package_url
()
{
local
URL
case
$PMTYPE
in
*
-rpm
)
# TODO: for binary packages?
query_package_field URL
"
$1
"
||
__query_package_hl_url
"
$1
"
#LANG=C epm info "$1"
return
;;
esac
fatal
"rpm based distro supported only. TODO: Realize via web service?"
}
get_locale
()
{
local
loc
loc
=
$(
a
=
natspec
--locale
2>/dev/null
)
[
-n
"
$loc
"
]
||
loc
=
$LANG
echo
$loc
}
get_pao_url
()
{
local
loc
loc
=
$(
get_locale |
cut
-c1-2
)
case
$loc
in
en|ru|uk|br
)
loc
=
$loc
;;
*
)
loc
=
en
esac
echo
"
$PAOURL
/
$loc
/Sisyphus/srpms"
}
query_altlinux_url
()
{
local
URL
case
$PMTYPE
in
*
-rpm
)
local
srpm
=
$(
print_srcname
"
$1
"
)
[
-n
"
$srpm
"
]
||
fatal
"Can't get source name for
$1
"
echo
"
$(
get_pao_url
)
/
$srpm
"
return
;;
esac
fatal
"rpm based distro supported only. TODO: Realize via web service?"
}
epm_site
()
{
[
-n
"
$pkg_filenames
"
]
||
fatal
"Info: missing package(s) name"
local
PAO
=
""
for
f
in
$pkg_names
$pkg_files
;
do
[
"
$f
"
=
"-p"
]
&&
PAO
=
"
$f
"
&&
continue
if
[
-n
"
$PAO
"
]
;
then
pkg_url
=
$(
query_altlinux_url
$f
)
else
pkg_url
=
$(
query_package_url
$f
)
fi
[
-n
"
$pkg_url
"
]
&&
open_browser
"
$pkg_url
"
&&
continue
warning
"Can't get URL for
$f
package"
done
}
# File bin/epm-update:
# File bin/epm-update:
epm_update
()
epm_update
()
{
{
[
-z
"
$pkg_filenames
"
]
||
fatal
"No arguments are allowed here"
info
"Running command for update remote package repository database"
info
"Running command for update remote package repository database"
case
$PMTYPE
in
case
$PMTYPE
in
...
@@ -3354,10 +4040,12 @@ case $PMTYPE in
...
@@ -3354,10 +4040,12 @@ case $PMTYPE in
;;
;;
yum-rpm
)
yum-rpm
)
info
"update command is stubbed for yum"
info
"update command is stubbed for yum"
# yum makecache
#sudocmd yum check-update
#sudocmd yum check-update
;;
;;
dnf-rpm
)
dnf-rpm
)
info
"update command is stubbed for dnf"
info
"update command is stubbed for dnf"
# dnf makecache
#sudocmd dnf check-update
#sudocmd dnf check-update
;;
;;
urpm-rpm
)
urpm-rpm
)
...
@@ -3394,6 +4082,9 @@ case $PMTYPE in
...
@@ -3394,6 +4082,9 @@ case $PMTYPE in
# portsnap extract for the first time?
# portsnap extract for the first time?
sudocmd portsnap fetch update
sudocmd portsnap fetch update
;;
;;
aptcyg
)
sudocmd apt-cyg update
;;
*
)
*
)
fatal
"Have no suitable update command for
$PMTYPE
"
fatal
"Have no suitable update command for
$PMTYPE
"
;;
;;
...
@@ -3408,6 +4099,8 @@ epm_upgrade()
...
@@ -3408,6 +4099,8 @@ epm_upgrade()
{
{
local
CMD
local
CMD
[
-z
"
$pkg_filenames
"
]
||
fatal
"No arguments are allowed here"
# it is useful for first time running
# it is useful for first time running
update_repo_if_needed
update_repo_if_needed
...
@@ -3474,6 +4167,10 @@ epm_upgrade()
...
@@ -3474,6 +4167,10 @@ epm_upgrade()
guix
)
guix
)
CMD
=
"guix package -u"
CMD
=
"guix package -u"
;;
;;
aptcyg
)
docmd_foreach
"epm install"
$(
short
=
1 epm packages
)
return
;;
*
)
*
)
fatal
"Have no suitable command for
$PMTYPE
"
fatal
"Have no suitable command for
$PMTYPE
"
;;
;;
...
@@ -3500,10 +4197,13 @@ epm_Upgrade()
...
@@ -3500,10 +4197,13 @@ epm_Upgrade()
# File bin/epm-whatdepends:
# File bin/epm-whatdepends:
epm_whatdepends
()
epm_whatdepends
()
{
{
local
CMD
local
CMD
[
-n
"
$pkg_filenames
"
]
||
fatal
"Whatdepends: missing package(s) name"
[
-n
"
$pkg_files
"
]
&&
fatal
"whatdepends do not handle files"
[
-n
"
$pkg_names
"
]
||
fatal
"whatdepends: missing package(s) name"
local
pkg
=
$(
print_name
$pkg_names
)
case
$PMTYPE
in
case
$PMTYPE
in
apt-rpm
)
apt-rpm
)
...
@@ -3518,6 +4218,9 @@ case $PMTYPE in
...
@@ -3518,6 +4218,9 @@ case $PMTYPE in
yum-rpm
)
yum-rpm
)
CMD
=
"repoquery --whatrequires"
CMD
=
"repoquery --whatrequires"
;;
;;
dnf-rpm
)
CMD
=
"repoquery --whatrequires"
;;
emerge
)
emerge
)
assure_exists equery
assure_exists equery
CMD
=
"equery depends -a"
CMD
=
"equery depends -a"
...
@@ -3525,33 +4228,42 @@ case $PMTYPE in
...
@@ -3525,33 +4228,42 @@ case $PMTYPE in
pkgng
)
pkgng
)
CMD
=
"pkg info -r"
CMD
=
"pkg info -r"
;;
;;
aptcyg
)
CMD
=
"apt-cyg rdepends"
;;
*
)
*
)
fatal
"Have no suitable command for
$PMTYPE
"
fatal
"Have no suitable command for
$PMTYPE
"
;;
;;
esac
esac
docmd
$CMD
$pkg
_filenames
docmd
$CMD
$pkg
}
}
# File bin/epm-whatprovides:
# File bin/epm-whatprovides:
epm_whatprovides
()
epm_whatprovides
()
{
{
local
CMD
local
CMD
[
-n
"
$pkg_filenames
"
]
||
fatal
"Whatprovides: missing package(s) name"
[
-n
"
$pkg_files
"
]
&&
fatal
"whatprovides does not handle files"
[
-n
"
$pkg_names
"
]
||
fatal
"whatprovides: missing package(s) name"
local
pkg
=
$(
print_name
$pkg_names
)
case
$PMTYPE
in
case
$PMTYPE
in
conary
)
conary
)
CMD
=
"conary repquery --what-provides"
CMD
=
"conary repquery --what-provides"
;;
;;
apt-rpm|apt-dpkg|aptitude-dpkg
)
apt-rpm|apt-dpkg|aptitude-dpkg
)
LANG
=
C docmd apt-get
install
--print-uris
$pkg
_filenames
|
grep
"^Selecting"
|
cut
-f2
-d
" "
LANG
=
C docmd apt-get
install
--print-uris
$pkg
|
grep
"^Selecting"
|
cut
-f2
-d
" "
return
return
;;
;;
yum-rpm
)
yum-rpm
)
CMD
=
"yum whatprovides"
CMD
=
"yum whatprovides"
;;
;;
dnf-rpm
)
CMD
=
"yum provides"
;;
zypper-rpm
)
zypper-rpm
)
CMD
=
"zypper what-provides"
CMD
=
"zypper what-provides"
;;
;;
...
@@ -3560,7 +4272,7 @@ case $PMTYPE in
...
@@ -3560,7 +4272,7 @@ case $PMTYPE in
;;
;;
esac
esac
docmd
$CMD
$pkg
_filenames
docmd
$CMD
$pkg
}
}
internal_distr_info
()
internal_distr_info
()
...
@@ -3618,7 +4330,8 @@ pkgtype()
...
@@ -3618,7 +4330,8 @@ pkgtype()
gentoo
)
echo
"tbz2"
;;
gentoo
)
echo
"tbz2"
;;
windows
)
echo
"exe"
;;
windows
)
echo
"exe"
;;
android
)
echo
"apk"
;;
android
)
echo
"apk"
;;
debian|ubuntu|mint|runtu
)
echo
"deb"
;;
cygwin
)
echo
"tar.xz"
;;
debian|ubuntu|mint|runtu|mcst
)
echo
"deb"
;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles
)
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles
)
echo
"rpm"
;;
echo
"rpm"
;;
fedora|redhat|scientific|centos|rhel
)
fedora|redhat|scientific|centos|rhel
)
...
@@ -3652,24 +4365,31 @@ fi
...
@@ -3652,24 +4365,31 @@ fi
# ALT Linux based
# ALT Linux based
if
distro altlinux-release
;
then
if
distro altlinux-release
;
then
DISTRIB_ID
=
"ALTLinux"
DISTRIB_ID
=
"ALTLinux"
if
has Strawberry
;
then
DISTRIB_RELEASE
=
"2.3"
if
has Sisyphus
;
then
DISTRIB_RELEASE
=
"Sisyphus"
elif
has Citron
;
then
DISTRIB_RELEASE
=
"2.4"
elif
has
"ALT Linux 7."
;
then
DISTRIB_RELEASE
=
"p7"
elif
has 20050723
;
then
DISTRIB_RELEASE
=
"3.0"
elif
has
"ALT Linux 8."
;
then
DISTRIB_RELEASE
=
"p8"
elif
has Ajuga
;
then
DISTRIB_RELEASE
=
"4.0"
elif
has
"Simply Linux 7."
;
then
DISTRIB_RELEASE
=
"p7"
elif
has 20070810
;
then
DISTRIB_RELEASE
=
"4.0"
elif
has
"Simply Linux 8."
;
then
DISTRIB_RELEASE
=
"p8"
elif
has
"ALT Linux 4.0"
;
then
DISTRIB_RELEASE
=
"4.0"
elif
has
"ALT Linux 6.0"
;
then
DISTRIB_RELEASE
=
"p6"
elif
has
"ALT Linux p8"
;
then
DISTRIB_RELEASE
=
"p8"
elif
has
"ALT Linux p7"
;
then
DISTRIB_RELEASE
=
"p7"
elif
has
"ALT Linux p6"
;
then
DISTRIB_RELEASE
=
"p6"
elif
has
"ALT Linux p5"
;
then
DISTRIB_RELEASE
=
"p5"
elif
has
"ALT Linux 5.1"
;
then
DISTRIB_RELEASE
=
"5.1"
elif
has
"ALT Linux 5.0"
;
then
DISTRIB_RELEASE
=
"5.0"
elif
has
"ALT Linux 4.1"
;
then
DISTRIB_RELEASE
=
"4.1"
elif
has
"ALT Linux 4.1"
;
then
DISTRIB_RELEASE
=
"4.1"
elif
has
"ALT Linux 4.0"
;
then
DISTRIB_RELEASE
=
"4.0"
elif
has Walnut
;
then
DISTRIB_RELEASE
=
"4.0"
elif
has Walnut
;
then
DISTRIB_RELEASE
=
"4.0"
elif
has 5.0
;
then
DISTRIB_RELEASE
=
"5.0"
elif
has 20070810
;
then
DISTRIB_RELEASE
=
"4.0"
elif
has 5.1
;
then
DISTRIB_RELEASE
=
"5.1"
elif
has Ajuga
;
then
DISTRIB_RELEASE
=
"4.0"
elif
has
"ALT Linux p5"
;
then
DISTRIB_RELEASE
=
"p5"
elif
has 20050723
;
then
DISTRIB_RELEASE
=
"3.0"
elif
has
"ALT Linux p6"
;
then
DISTRIB_RELEASE
=
"p6"
elif
has Citron
;
then
DISTRIB_RELEASE
=
"2.4"
elif
has
"ALT Linux p7"
;
then
DISTRIB_RELEASE
=
"p7"
elif
has 6.0
;
then
DISTRIB_RELEASE
=
"p6"
elif
has Centaurea
;
then
DISTRIB_RELEASE
=
"p6"
elif
has Sisyphus
;
then
DISTRIB_RELEASE
=
"Sisyphus"
fi
fi
elif
[
`
uname
-o
`
=
"Cygwin"
]
;
then
DISTRIB_ID
=
"Cygwin"
DISTRIB_RELEASE
=
"all"
elif
distro gentoo-release
;
then
elif
distro gentoo-release
;
then
DISTRIB_ID
=
"Gentoo"
DISTRIB_ID
=
"Gentoo"
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/portage/make.profile 2>/dev/null
)
||
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/make.profile
)
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/portage/make.profile 2>/dev/null
)
||
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/make.profile
)
...
@@ -3696,6 +4416,10 @@ elif distro arch-release ; then
...
@@ -3696,6 +4416,10 @@ elif distro arch-release ; then
DISTRIB_RELEASE
=
"2011"
DISTRIB_RELEASE
=
"2011"
fi
fi
elif
distro mcst_version
;
then
DISTRIB_ID
=
"MCST"
DISTRIB_RELEASE
=
$(
cat
"
$DISTROFILE
"
|
grep
"release"
|
sed
-e
"s|.*release
\(
[0-9]*
\)
.*|
\1
|g"
)
# for Ubuntu use standard LSB info
# for Ubuntu use standard LSB info
elif
[
"
$DISTRIB_ID
"
=
"Ubuntu"
]
&&
[
-n
"
$DISTRIB_RELEASE
"
]
;
then
elif
[
"
$DISTRIB_ID
"
=
"Ubuntu"
]
&&
[
-n
"
$DISTRIB_RELEASE
"
]
;
then
# use LSB version
# use LSB version
...
@@ -3878,6 +4602,8 @@ esac
...
@@ -3878,6 +4602,8 @@ esac
#PATH=$PATH:/sbin:/usr/sbin
#PATH=$PATH:/sbin:/usr/sbin
set_pm_type
set_sudo
set_sudo
check_tty
check_tty
...
@@ -3898,7 +4624,7 @@ $(get_help HELPOPT)
...
@@ -3898,7 +4624,7 @@ $(get_help HELPOPT)
print_version
()
print_version
()
{
{
echo
"EPM package manager version 1.
5.15
"
echo
"EPM package manager version 1.
6.3
"
echo
"Running on
$(
$DISTRVENDOR
)
('
$PMTYPE
' package manager uses '
$PKGFORMAT
' package format)"
echo
"Running on
$(
$DISTRVENDOR
)
('
$PMTYPE
' package manager uses '
$PKGFORMAT
' package format)"
echo
"Copyright (c) Etersoft 2012-2015"
echo
"Copyright (c) Etersoft 2012-2015"
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."
...
@@ -3908,7 +4634,6 @@ print_version()
...
@@ -3908,7 +4634,6 @@ print_version()
Usage
=
"Usage: epm [options] <command> [package name(s), package files]..."
Usage
=
"Usage: epm [options] <command> [package name(s), package files]..."
Descr
=
"epm - EPM package manager"
Descr
=
"epm - EPM package manager"
set_pm_type
verbose
=
verbose
=
quiet
=
quiet
=
...
@@ -4048,6 +4773,9 @@ check_command()
...
@@ -4048,6 +4773,9 @@ check_command()
assure
)
# HELPCMD: <command> [package]: install package if command does not exists
assure
)
# HELPCMD: <command> [package]: install package if command does not exists
epm_cmd
=
assure
epm_cmd
=
assure
;;
;;
policy
)
# HELPCMD: print detailed information about the priority selection of package
epm_cmd
=
policy
;;
# Repository control
# Repository control
update
)
# HELPCMD: update remote package repository databases
update
)
# HELPCMD: update remote package repository databases
...
@@ -4059,6 +4787,9 @@ check_command()
...
@@ -4059,6 +4787,9 @@ check_command()
repolist|sl|rl|listrepo
)
# HELPCMD: print repo list
repolist|sl|rl|listrepo
)
# HELPCMD: print repo list
epm_cmd
=
repolist
epm_cmd
=
repolist
;;
;;
repofix
)
# HELPCMD: fix paths in sources lists (ALT Linux only)
epm_cmd
=
repofix
;;
removerepo|rr
)
# HELPCMD: remove package repo
removerepo|rr
)
# HELPCMD: remove package repo
epm_cmd
=
removerepo
epm_cmd
=
removerepo
;;
;;
...
@@ -4097,10 +4828,23 @@ check_command()
...
@@ -4097,10 +4828,23 @@ check_command()
audit
)
# HELPCMD: audits installed packages against known vulnerabilities
audit
)
# HELPCMD: audits installed packages against known vulnerabilities
epm_cmd
=
audit
epm_cmd
=
audit
;;
;;
#checksystem) # HELPCMD: check system for known errors (package management related)
# epm_cmd=checksystem
# ;;
site|url
)
# HELPCMD: open package's site in a browser (use -p for open packages.altlinux.org site)
epm_cmd
=
site
;;
print
)
# HELPCMD: print various info, run epm print help for details
epm_cmd
=
print
;;
-V
|
checkpkg|integrity
)
# HELPCMD: check package file integrity (checksum)
-V
|
checkpkg|integrity
)
# HELPCMD: check package file integrity (checksum)
epm_cmd
=
checkpkg
epm_cmd
=
checkpkg
;;
;;
-h
|
--help
|
help
)
# HELPOPT: print this help
help
=
1
phelp
exit
0
;;
*
)
*
)
return
1
return
1
;;
;;
...
@@ -4111,10 +4855,6 @@ check_command()
...
@@ -4111,10 +4855,6 @@ check_command()
check_option
()
check_option
()
{
{
case
$1
in
case
$1
in
-h
|
--help
|
help
)
# HELPOPT: this help
phelp
exit
0
;;
-v
|
--version
)
# HELPOPT: print version
-v
|
--version
)
# HELPOPT: print version
print_version
print_version
exit
0
exit
0
...
...
packed/serv.sh
View file @
aeac7c5d
#!/bin/sh
#!/bin/sh
#
#
# Copyright (C) 2012-2013 Etersoft
# Copyright (C) 2012-2013
, 2016
Etersoft
# Copyright (C) 2012-2013 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2013
, 2016
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
...
@@ -247,6 +247,10 @@ set_sudo()
...
@@ -247,6 +247,10 @@ set_sudo()
SUDO
=
""
SUDO
=
""
# skip SUDO if disabled
# skip SUDO if disabled
[
-n
"
$EPMNOSUDO
"
]
&&
return
[
-n
"
$EPMNOSUDO
"
]
&&
return
if
[
"
$DISTRNAME
"
=
"Cygwin"
]
||
[
"
$DISTRNAME
"
=
"Windows"
]
;
then
# skip sudo using on Windows
return
fi
EFFUID
=
`
id
-u
`
EFFUID
=
`
id
-u
`
...
@@ -278,7 +282,7 @@ set_eatmydata()
...
@@ -278,7 +282,7 @@ set_eatmydata()
# 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"
SUDO
=
"
$SUDO
eatmydata"
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
}
}
...
@@ -424,6 +428,9 @@ case $DISTRNAME in
...
@@ -424,6 +428,9 @@ case $DISTRNAME in
Android
)
Android
)
CMD
=
"android"
CMD
=
"android"
;;
;;
Cygwin
)
CMD
=
"aptcyg"
;;
*
)
*
)
fatal
"Have no suitable DISTRNAME
$DISTRNAME
"
fatal
"Have no suitable DISTRNAME
$DISTRNAME
"
;;
;;
...
@@ -574,6 +581,13 @@ serv_list_startup()
...
@@ -574,6 +581,13 @@ serv_list_startup()
esac
esac
}
}
# File bin/serv-print:
serv_print
()
{
echo
"Detected init system:
$SERVICETYPE
"
}
# File bin/serv-restart:
# File bin/serv-restart:
...
@@ -819,7 +833,8 @@ pkgtype()
...
@@ -819,7 +833,8 @@ pkgtype()
gentoo
)
echo
"tbz2"
;;
gentoo
)
echo
"tbz2"
;;
windows
)
echo
"exe"
;;
windows
)
echo
"exe"
;;
android
)
echo
"apk"
;;
android
)
echo
"apk"
;;
debian|ubuntu|mint|runtu
)
echo
"deb"
;;
cygwin
)
echo
"tar.xz"
;;
debian|ubuntu|mint|runtu|mcst
)
echo
"deb"
;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles
)
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles
)
echo
"rpm"
;;
echo
"rpm"
;;
fedora|redhat|scientific|centos|rhel
)
fedora|redhat|scientific|centos|rhel
)
...
@@ -853,24 +868,31 @@ fi
...
@@ -853,24 +868,31 @@ fi
# ALT Linux based
# ALT Linux based
if
distro altlinux-release
;
then
if
distro altlinux-release
;
then
DISTRIB_ID
=
"ALTLinux"
DISTRIB_ID
=
"ALTLinux"
if
has Strawberry
;
then
DISTRIB_RELEASE
=
"2.3"
if
has Sisyphus
;
then
DISTRIB_RELEASE
=
"Sisyphus"
elif
has Citron
;
then
DISTRIB_RELEASE
=
"2.4"
elif
has
"ALT Linux 7."
;
then
DISTRIB_RELEASE
=
"p7"
elif
has 20050723
;
then
DISTRIB_RELEASE
=
"3.0"
elif
has
"ALT Linux 8."
;
then
DISTRIB_RELEASE
=
"p8"
elif
has Ajuga
;
then
DISTRIB_RELEASE
=
"4.0"
elif
has
"Simply Linux 7."
;
then
DISTRIB_RELEASE
=
"p7"
elif
has 20070810
;
then
DISTRIB_RELEASE
=
"4.0"
elif
has
"Simply Linux 8."
;
then
DISTRIB_RELEASE
=
"p8"
elif
has
"ALT Linux 4.0"
;
then
DISTRIB_RELEASE
=
"4.0"
elif
has
"ALT Linux 6.0"
;
then
DISTRIB_RELEASE
=
"p6"
elif
has
"ALT Linux p8"
;
then
DISTRIB_RELEASE
=
"p8"
elif
has
"ALT Linux p7"
;
then
DISTRIB_RELEASE
=
"p7"
elif
has
"ALT Linux p6"
;
then
DISTRIB_RELEASE
=
"p6"
elif
has
"ALT Linux p5"
;
then
DISTRIB_RELEASE
=
"p5"
elif
has
"ALT Linux 5.1"
;
then
DISTRIB_RELEASE
=
"5.1"
elif
has
"ALT Linux 5.0"
;
then
DISTRIB_RELEASE
=
"5.0"
elif
has
"ALT Linux 4.1"
;
then
DISTRIB_RELEASE
=
"4.1"
elif
has
"ALT Linux 4.1"
;
then
DISTRIB_RELEASE
=
"4.1"
elif
has
"ALT Linux 4.0"
;
then
DISTRIB_RELEASE
=
"4.0"
elif
has Walnut
;
then
DISTRIB_RELEASE
=
"4.0"
elif
has Walnut
;
then
DISTRIB_RELEASE
=
"4.0"
elif
has 5.0
;
then
DISTRIB_RELEASE
=
"5.0"
elif
has 20070810
;
then
DISTRIB_RELEASE
=
"4.0"
elif
has 5.1
;
then
DISTRIB_RELEASE
=
"5.1"
elif
has Ajuga
;
then
DISTRIB_RELEASE
=
"4.0"
elif
has
"ALT Linux p5"
;
then
DISTRIB_RELEASE
=
"p5"
elif
has 20050723
;
then
DISTRIB_RELEASE
=
"3.0"
elif
has
"ALT Linux p6"
;
then
DISTRIB_RELEASE
=
"p6"
elif
has Citron
;
then
DISTRIB_RELEASE
=
"2.4"
elif
has
"ALT Linux p7"
;
then
DISTRIB_RELEASE
=
"p7"
elif
has 6.0
;
then
DISTRIB_RELEASE
=
"p6"
elif
has Centaurea
;
then
DISTRIB_RELEASE
=
"p6"
elif
has Sisyphus
;
then
DISTRIB_RELEASE
=
"Sisyphus"
fi
fi
elif
[
`
uname
-o
`
=
"Cygwin"
]
;
then
DISTRIB_ID
=
"Cygwin"
DISTRIB_RELEASE
=
"all"
elif
distro gentoo-release
;
then
elif
distro gentoo-release
;
then
DISTRIB_ID
=
"Gentoo"
DISTRIB_ID
=
"Gentoo"
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/portage/make.profile 2>/dev/null
)
||
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/make.profile
)
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/portage/make.profile 2>/dev/null
)
||
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/make.profile
)
...
@@ -897,6 +919,10 @@ elif distro arch-release ; then
...
@@ -897,6 +919,10 @@ elif distro arch-release ; then
DISTRIB_RELEASE
=
"2011"
DISTRIB_RELEASE
=
"2011"
fi
fi
elif
distro mcst_version
;
then
DISTRIB_ID
=
"MCST"
DISTRIB_RELEASE
=
$(
cat
"
$DISTROFILE
"
|
grep
"release"
|
sed
-e
"s|.*release
\(
[0-9]*
\)
.*|
\1
|g"
)
# for Ubuntu use standard LSB info
# for Ubuntu use standard LSB info
elif
[
"
$DISTRIB_ID
"
=
"Ubuntu"
]
&&
[
-n
"
$DISTRIB_RELEASE
"
]
;
then
elif
[
"
$DISTRIB_ID
"
=
"Ubuntu"
]
&&
[
-n
"
$DISTRIB_RELEASE
"
]
;
then
# use LSB version
# use LSB version
...
@@ -1106,7 +1132,9 @@ is_active_systemd()
...
@@ -1106,7 +1132,9 @@ is_active_systemd()
SYSTEMD_CGROUP_DIR
=
/sys/fs/cgroup/systemd
SYSTEMD_CGROUP_DIR
=
/sys/fs/cgroup/systemd
[
-x
"
$SYSTEMCTL
"
]
||
return
[
-x
"
$SYSTEMCTL
"
]
||
return
[
-d
"
$SYSTEMD_CGROUP_DIR
"
]
||
return
[
-d
"
$SYSTEMD_CGROUP_DIR
"
]
||
return
a
=
mountpoint
-q
"
$SYSTEMD_CGROUP_DIR
"
a
=
mountpoint
-q
"
$SYSTEMD_CGROUP_DIR
"
||
return
# some hack
pidof systemd
>
/dev/null
}
}
case
$DISTRNAME
in
case
$DISTRNAME
in
...
@@ -1171,9 +1199,9 @@ $(get_help HELPOPT)
...
@@ -1171,9 +1199,9 @@ $(get_help HELPOPT)
print_version
()
print_version
()
{
{
echo
"Service manager version 1.
5.15
"
echo
"Service manager version 1.
6.3
"
echo
"Running on
$(
$DISTRVENDOR
)
"
echo
"Running on
$(
$DISTRVENDOR
)
"
echo
"Copyright (c) Etersoft 2012, 2013"
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."
}
}
...
@@ -1237,6 +1265,10 @@ check_command()
...
@@ -1237,6 +1265,10 @@ check_command()
off|disable
)
# HELPCMD: remove service to run on startup and stop it now
off|disable
)
# HELPCMD: remove service to run on startup and stop it now
serv_cmd
=
disable
serv_cmd
=
disable
;;
;;
print
)
# HELPCMD: print some info
serv_cmd
=
print
withoutservicename
=
1
;;
*
)
*
)
return
1
return
1
;;
;;
...
...
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