Commit e17a8887 authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to M60P as 1.4.1-alt0.M60P.1 (with rpmbph script)

parents 2d72a762 e4fccbad
......@@ -14,3 +14,6 @@ install:
mkdir -p $(DESTDIR)$(pkgdatadir)/
install -m 644 `ls -1 bin/* | grep "-"` $(DESTDIR)$(pkgdatadir)/
mkdir -p $(DESTDIR)$(mandir)/man1
cp -a `ls -1 man/*` $(DESTDIR)$(mandir)/man1/
......@@ -80,6 +80,7 @@ show_command_only=
epm_cmd=
pkg_files=
pkg_names=
quoted_args=
progname="${0##*/}"
......@@ -135,7 +136,7 @@ check_command()
-i|install|add) # HELPCMD: install package(s) from remote repositories or from local file
epm_cmd=install
;;
-e|-P|remove|delete|uninstall) # HELPCMD: remove (delete) package(s) from the database and the system
-e|-P|remove|delete|uninstall|erase) # HELPCMD: remove (delete) package(s) from the database and the system
epm_cmd=remove
;;
-s|search) # HELPCMD: search in remote package repositories
......@@ -182,6 +183,9 @@ check_command()
whatdepends) # HELPCMD: print packages dependences on that
epm_cmd=whatdepends
;;
whatprovides) # HELPCMD: print packages provides that target
epm_cmd=whatprovides
;;
-qa|list|packages|-l) # HELPCMD: list of installed package(s)
epm_cmd=packages
;;
......@@ -290,6 +294,7 @@ for opt in "$@" ; do
else
pkg_names="$pkg_names $opt"
fi
quoted_args="$quoted_args \"$opt\""
done
pkg_files=$(strip_spaces "$pkg_files")
......
......@@ -47,7 +47,10 @@ case $PMTYPE in
# sudocmd urpme --auto-orphans
# ;;
zypper-rpm)
sudocmd zypper verify || exit
sudocmd zypper verify
;;
conary)
sudocmd conary verify
;;
*)
fatal "Have no suitable command for $PMTYPE"
......
#!/bin/sh
#
# Copyright (C) 2009, 2012 Etersoft
# Copyright (C) 2009, 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2009, 2012, 2013 Etersoft
# Copyright (C) 2009, 2012, 2013 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -17,90 +17,30 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# TODO: move zip,rar,7z to arc project, and pack all to check_pkg_integrity
# also use arc project if installed
check_rpm_integrity()
{
docmd rpm --checksig $@
}
check_deb_integrity()
{
# FIXME: debsums -ca package ?
docmd dpkg --contents $@
}
check_bz2_integrity()
{
docmd bunzip -t $1
}
check_tbz_integrity()
{
check_bz2_integrity $@
}
check_gz_integrity()
{
docmd gunzip -t $1
}
check_tgz_integrity()
{
check_gz_integrity $@
}
check_zip_integrity()
{
docmd unzip -t $@
}
check_rar_integrity()
{
docmd unrar t $@
}
check_xz_integrity()
{
docmd xz -t $1
}
check_7z_integrity()
{
docmd 7z t $1
}
check_exe_integrity()
{
# skip
true
}
check_ebuild_integrity()
{
# skip
true
}
check_pkg_integrity()
{
local EXT=`echo "$1" | sed -e "s|.*\.\([a-z0-9]*\)\$|\1|g"`
local PKG="$1"
local RET
# TODO: Попробовать здесь оставить возможность перегрузки функций
case $EXT in
rpm)
docmd rpm --checksig $1
docmd rpm --checksig $PKG
;;
deb)
# FIXME: debsums -ca package ?
docmd dpkg --contents $1 >/dev/null && echo "Package $1 is correct."
docmd dpkg --contents $PKG >/dev/null && echo "Package $PKG is correct."
;;
bz2)
docmd bunzip -t $1
exe)
true
;;
ebuild)
true
;;
*)
check_${EXT}_integrity "$PKG" || fatal "Unknown package extension '$EXT' in $PKG package"
docmd erc test "$PKG" && return
which erc >/dev/null 2>/dev/null && fatal "Check failed"
fatal "Install erc package."
;;
esac
}
......@@ -125,6 +65,7 @@ esac
epm_checkpkg()
{
if [ -n "$pkg_names" ] ; then
echo "Suggest $pkg_names are names of installed packages"
__epm_check_installed_pkg $pkg_names
return
fi
......
......@@ -37,6 +37,7 @@ __epm_filelist_file()
;;
esac
# TODO: add less
docmd $CMD $@
}
......@@ -62,6 +63,9 @@ __epm_filelist_name()
zypper-rpm)
CMD="rpm -ql"
;;
conary)
CMD="conary query --ls"
;;
pacman)
docmd pacman -Ql $pkg_names | sed -e "s|.* ||g"
return
......@@ -76,6 +80,7 @@ __epm_filelist_name()
;;
esac
# TODO: add less
docmd $CMD $pkg_names && return
is_installed $pkg_names || fatal "Query filelist for non installed packages does not realized"
}
......
......@@ -67,6 +67,10 @@ case $PMTYPE in
# FIXME: --version=
docmd npackdcl info --package=$pkg_names
;;
conary)
is_installed $pkg_names && docmd conary query $pkg_names --info && return
docmd conary repquery $pkg_names --info
;;
slackpkg)
docmd /usr/sbin/slackpkg info $pkg_names
;;
......
......@@ -123,6 +123,9 @@ epm_install_names()
mpkg)
sudocmd mpkg install $@
return ;;
conary)
sudocmd conary update $@
return ;;
npackd)
# FIXME: correct arg
__separate_sudocmd_foreach "npackdcl add --package=" "npackdcl update --package=" $@
......
......@@ -70,6 +70,9 @@ case $PMTYPE in
CMD="npackdcl list --status=installed"
# TODO: use search if pkg_filenames is not empty
;;
conary)
CMD="conary query"
;;
# chocolatey)
# CMD="chocolatey list"
# ;;
......
......@@ -50,7 +50,7 @@ case $PMTYPE in
CMD="apt-cache depends"
fi
;;
urpm-rpm|zypper-rpm)
urpm-rpm|zypper-rpm|yum-rpm)
if is_installed $pkg_names ; then
CMD="rpm -q --provides"
else
......
......@@ -37,7 +37,7 @@ _query_via_packages_list()
return $res
}
# internal use only
# internal use only, for installed package
__epm_get_hilevel_nameform()
{
[ -n "$*" ] || return
......@@ -123,7 +123,11 @@ __epm_query_name()
[ -n "$short" ] && CMD="dpkg-query -W --showformat=\${Package}\n"
;;
npackd)
CMD="npackdcl path --package=$@"
docmd "npackdcl path --package=$@"
return
;;
conary)
CMD="conary query"
;;
brew)
warning "fix query"
......
......@@ -84,6 +84,9 @@ __do_query()
pacman)
CMD="pacman -Qo"
;;
conary)
CMD="conary query --path"
;;
slackpkg)
# note: need remove leading slash for grep
docmd grep -R -- "$(echo $@ | sed -e 's|^/\+||g')" /var/log/packages | sed -e "s|/var/log/packages/||g"
......
......@@ -18,9 +18,13 @@
#
load_helper epm-packages
load_helper epm-search
epm_query_package()
{
#showcmd grep --color "$pkg_filenames"
pkg_filenames= epm_packages | grep --color -- "$pkg_filenames"
[ -n "$pkg_filenames" ] || fatal "Please, use search with some argument"
# FIXME: do it better
local MGS=$(eval __epm_search_make_grep $quoted_args)
EXTRA_SHOWDOCMD=$MGS
eval "pkg_filenames= epm_packages \"$(eval get_firstarg $quoted_args)\" $MGS"
}
......@@ -31,7 +31,7 @@ epm_reinstall_names()
sudocmd dnf reinstall $@
return ;;
slackpkg)
sudocmd /usr/sbin/slackpkg reinstall $@
sudocmd_foreach "/usr/sbin/slackpkg reinstall" $@
return ;;
esac
......@@ -52,7 +52,7 @@ epm_reinstall_files()
sudocmd dpkg -i $@
return ;;
slackpkg)
sudocmd /sbin/installpkg $@
sudocmd_foreach "/sbin/installpkg" $@
return ;;
esac
......
......@@ -28,6 +28,7 @@ epm_release_upgrade()
docmd epm install apt rpm
showcmd "TODO: change repo"
docmd epm Upgrade
docmd epm update-kernel
;;
apt-dpkg)
sudocmd do-release-upgrade -d
......@@ -59,6 +60,9 @@ epm_release_upgrade()
pacman)
epm Upgrade
;;
conary)
epm Upgrade
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
......@@ -82,6 +82,9 @@ epm_remove_names()
mpkg)
sudocmd mpkg remove $@
return ;;
conary)
sudocmd conary erase $@
return ;;
npackd)
sudocmd npackdcl remove --package=$@
return ;;
......
......@@ -17,46 +17,46 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# copied from korinf/tools/run-script/scripts/search
epm_search()
__epm_search_output()
{
local CMD
[ -n "$pkg_filenames" ] || fatal "Run search without names"
local CMD
local string="$1"
case $PMTYPE in
apt-rpm|apt-dpkg)
CMD="apt-cache search"
CMD="apt-cache search --"
;;
urpm-rpm)
CMD="urpmq -y"
CMD="urpmq -y --"
;;
pkgsrc)
CMD="pkg_info -x"
CMD="pkg_info -x --"
;;
emerge)
CMD="emerge --search"
CMD="emerge --search --"
;;
pacman)
CMD="pacman -Ss"
CMD="pacman -Ss --"
;;
aura)
CMD="aura -As"
CMD="aura -As --"
;;
yum-rpm)
CMD="yum search"
CMD="yum search --"
;;
dnf-rpm)
CMD="dnf search"
CMD="dnf search --"
;;
zypper-rpm)
CMD="zypper search"
CMD="zypper search --"
;;
mpkg)
CMD="mpkg search"
;;
conary)
CMD="conary repquery"
;;
npackd)
docmd npackdcl search --query="$pkg_filenames" --status=all
docmd npackdcl search --query="$string" --status=all
return
;;
chocolatey)
......@@ -64,9 +64,8 @@ case $PMTYPE in
;;
slackpkg)
# FIXME
echo "FIXME: need case insensitive search"
docmd_foreach "/usr/sbin/slackpkg search" $pkg_filenames
return
echo "Note: case sensitive search"
CMD="/usr/sbin/slackpkg search --"
;;
homebrew)
CMD="brew search"
......@@ -76,6 +75,41 @@ case $PMTYPE in
;;
esac
docmd $CMD $pkg_filenames
docmd $CMD $string
}
# produce grep sequence
__epm_search_make_grep()
{
local i
[ -z "$*" ] && return
local list=
local listN=
for i in $@ ; do
local NOR="${i/^/}"
[ "$NOR" = "$i" ] && list="$list $NOR" || listN="$listN $NOR"
done
#list=$(strip_spaces $list | sed -e "s/ /|/g")
listN=$(strip_spaces $listN | sed -e "s/ /|/g")
[ -n "$listN" ] && echo -n " | egrep -i -v -- \"$listN\""
# 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
for i in $list ; do
echo -n " | egrep -i --color -- \"$i\""
done
}
# copied from korinf/tools/run-script/scripts/search
epm_search()
{
[ -n "$pkg_filenames" ] || fatal "Please, use search with some argument"
# FIXME: do it better
local MGS=$(eval __epm_search_make_grep $quoted_args)
EXTRA_SHOWDOCMD="$MGS"
eval "__epm_search_output \"$(eval get_firstarg $quoted_args)\" $MGS"
}
......@@ -92,7 +92,7 @@ showcmd()
# Print command line and run command line
docmd()
{
showcmd "$@"
showcmd "$@$EXTRA_SHOWDOCMD"
"$@"
}
......@@ -127,6 +127,18 @@ sudocmd_foreach()
done
}
get_firstarg()
{
echo -n "$1"
}
get_lastarg()
{
local lastarg
eval lastarg=\${$#}
echo -n "$lastarg"
}
filter_strip_spaces()
{
......@@ -267,6 +279,9 @@ case $DISTRNAME in
SUSE|SLED|SLES)
CMD="zypper-rpm"
;;
ForesightLinux|rPathLinux)
CMD="conary"
;;
Windows)
CMD="chocolatey"
;;
......
......@@ -51,6 +51,9 @@ epm_upgrade()
emerge)
CMD="emerge -NuDa world"
;;
conary)
CMD="conary updateall"
;;
pkgsrc)
CMD="freebsd-update fetch install"
;;
......
......@@ -24,9 +24,12 @@ epm_whatdepends()
# by package name
case $PMTYPE in
apt-rpm|apt-dpkg)
apt-rpm)
CMD="apt-cache whatdepends"
;;
apt-dpkg)
CMD="apt-cache rdepends"
;;
yum-rpm)
CMD="repoquery --whatrequires"
;;
......@@ -38,6 +41,6 @@ case $PMTYPE in
;;
esac
[ -n "$pkg_names" ] && docmd $CMD $pkg_names
docmd $CMD $pkg_names
}
#!/bin/sh
#
# Copyright (C) 2013 Etersoft
# Copyright (C) 2013 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/>.
#
epm_whatprovides()
{
local CMD
[ -n "$pkg_names" ] || fatal "Run query without names"
# by package name
case $PMTYPE in
conary)
CMD="conary repquery --what-provides"
;;
apt-rpm|apt-dpkg)
LANG=C docmd apt-get install --print-uris $pkg_filenames | grep "^Selecting" | cut -f2 -d" "
return
;;
yum-rpm)
CMD="yum whatprovides"
;;
zypper-rpm)
CMD="zypper what-provides"
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
docmd $CMD $pkg_names
}
# This spec is backported to ALTLinux p6 automatically by rpmbph script. Do not edit it.
#
Name: eepm
Version: 1.3.1
Version: 1.4.1
Release: alt0.M60P.1
Summary: Etersoft EPM package manager
......@@ -59,14 +59,31 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_bindir/serv
%_bindir/cerv
%_bindir/distr_info
%_man1dir/*
%_datadir/%name/
%_sysconfdir/bash_completion.d/serv
%_sysconfdir/bash_completion.d/cerv
%changelog
* Thu Jul 25 2013 Vitaly Lipatov <lav@altlinux.ru> 1.3.1-alt0.M60P.1
* Thu Sep 05 2013 Vitaly Lipatov <lav@altlinux.ru> 1.4.1-alt0.M60P.1
- backport to ALTLinux p6 (by rpmbph script)
* Thu Sep 05 2013 Vitaly Lipatov <lav@altlinux.ru> 1.4.1-alt1
- add initial man page file
- epm-filelist: add todo for less
- epm-search: add -- before search arg for support search "-some"
- improve whatprovides and whatdepends support
* Sun Aug 04 2013 Vitaly Lipatov <lav@altlinux.ru> 1.4.0-alt1
- query-package: make epmqp case insensitive
- epm-search: introduce grep extra args in search
- epm-search: output used grep command too
- epm-checkpkg: use erc when possible
- epm-query_package: allow grep sequence
- epm-search: try to colorize output
- add conary package manager support
- introduce epm-whatprovides
* Wed Jul 24 2013 Vitaly Lipatov <lav@altlinux.ru> 1.3.1-alt1
- epm-packages: add size sort support for rpm and dpkg
- fix epm query for non rpm/deb systems
......
'\" t
.\"
.\" Author: Vitaly Lipatov
.\"
.\" This file has been put into the public domain.
.\" You can do whatever you want with this file.
.\"
.TH EEPM 1 "August 2013" "Version 1.4"
.SH NAME
cerv \- wrapper for system service control command
.SH SYNOPSIS
.B cerv
.RI name
.RI <command>
.RI [parameters]
.PP
.B serv
is equivalent to
.BR "cerv" .
.br
.br
.SH DESCRIPTION
.BI
Cerv realized service(8) command behavior. It supports sysvinit, systemd, upstart and other service controls.
Please use cerv --help to get detail command explain.
.SH OPTIONS
.TP
.I -h
Display help
.TP
.I -V
Show version and exit
.SH BUGS
Please report any bugs to lav@etersoft.ru
.SH EXIT STATUS
.B cerv
will return zero on success and non zero on operation failure.
.SH SEE ALSO
.BR eepm (1), erc (1)
.TP
.B http://wiki.etersoft.ru/eepm
EEPM wiki page
'\" t
.\"
.\" Author: Vitaly Lipatov
.\"
.\" This file has been put into the public domain.
.\" You can do whatever you want with this file.
.\"
.TH EEPM 1 "August 2013" "Version 1.4"
.SH NAME
epm, epmi, epme, epms, epmq, epmcl, epmqa, epmqp, epmqf, epmqi, epmql, epmu \- wrapper for distro related package management system
.SH SYNOPSIS
.B eepm
.RI [ options ]...
.RI <command>...
.RI [package name(s), package file(s)]
.PP
.B eepm, upm
are equivalents to
.BR "epm" .
.br
.B epmi
is equivalent to
.BR "epm install" .
.br
.B epme
is equivalent to
.BR "epm remove" .
.br
.B epms
is equivalent to
.BR "epm search" .
.br
.B epmq
is equivalent to
.BR "epm query" .
.br
.B epmcl
is equivalent to
.BR "epm changelog" .
.br
.B epmqa
is equivalent to
.BR "epm packages" .
.br
.B epmqp
is equivalent to
.BR "epm query package" .
.br
.B epmqf
is equivalent to
.BR "epm query file" .
.br
.B epmqi
is equivalent to
.BR "epm info" .
.br
.B epmql
is equivalent to
.BR "epm filelist" .
.br
.B epmu
is equivalent to
.BR "epm update" .
.br
.SH DESCRIPTION
.BI
With eepm you can do all package management jobs with the same set of commands on any operation system or distributive.
.BI
Eepm can be used manually, in shell scripts or other programs.
Please use epm --help to get detail command explain.
.SH OPTIONS
.TP
.I -h
Display help
.TP
.I -V
Show version and exit
.TP
.I -v
activate verbose output, mainly useful for debugging.
.TP
.I --force
force operation
.SH BUGS
Please report any bugs to lav@etersoft.ru
.SH EXIT STATUS
.B any epm command
will return zero on success and non zero on operation failure.
.SH SEE ALSO
.BR cerv (1), erc (1)
.TP
.B http://wiki.etersoft.ru/eepm
EEPM wiki page
eepm.1
\ No newline at end of file
cerv.1
\ No newline at end of file
eepm.1
\ No newline at end of file
......@@ -103,7 +103,7 @@ showcmd()
docmd()
{
showcmd "$@"
showcmd "$@$EXTRA_SHOWDOCMD"
"$@"
}
......@@ -135,6 +135,18 @@ sudocmd_foreach()
done
}
get_firstarg()
{
echo -n "$1"
}
get_lastarg()
{
local lastarg
eval lastarg=\${$#}
echo -n "$lastarg"
}
filter_strip_spaces()
{
......@@ -265,6 +277,9 @@ case $DISTRNAME in
SUSE|SLED|SLES)
CMD="zypper-rpm"
;;
ForesightLinux|rPathLinux)
CMD="conary"
;;
Windows)
CMD="chocolatey"
;;
......@@ -966,7 +981,7 @@ $(get_help HELPOPT)
print_version()
{
echo "Service manager version 1.3.0"
echo "Service manager version 1.4.1"
echo "Running on $($DISTRVENDOR)"
echo "Copyright (c) Etersoft 2012, 2013"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment