Commit 17477ad5 authored by Vitaly Lipatov's avatar Vitaly Lipatov

introduce get_package_type and use it

parent 03702b58
......@@ -19,19 +19,21 @@
load_helper epm-query
# TODO: use
__epm_changelog_files()
{
[ -z "$*" ] && return
case $PMTYPE in
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm)
# TODO: detect every file
case $(get_package_type $1) in
rpm)
docmd_foreach "rpm -p --changelog" $@ | less
;;
# apt-dpkg)
#
# ;;
*)
fatal "Have no suitable command for $PMTYPE"
fatal "Have no suitable command for $1"
;;
esac
......
......@@ -19,11 +19,10 @@
check_pkg_integrity()
{
local EXT=`echo "$1" | sed -e "s|.*\.\([a-z0-9]*\)\$|\1|g"`
local PKG="$1"
local RET
case $EXT in
case $(get_package_type $PKG) in
rpm)
docmd rpm --checksig $PKG
;;
......
......@@ -19,16 +19,6 @@
load_helper epm-query
# TODO: move to appropriate place
_get_package_type()
{
local i
for i in deb rpm ; do
[ "${1/.$i/}" != "$1" ] && echo $i && return
done
return 0
}
__epm_filelist_file()
{
local CMD
......@@ -36,7 +26,7 @@ __epm_filelist_file()
[ -z "$*" ] && return
# TODO: allow a new packages
case $(_get_package_type $1) in
case $(get_package_type $1) in
rpm)
CMD="rpm -qlp"
;;
......
......@@ -28,6 +28,7 @@ __epm_info_rpm_low()
is_installed $pkg_names && docmd rpm -qi $pkg_names && return
}
# TODO: separate to _files and _names parts
epm_info()
{
case $PMTYPE in
......
......@@ -242,6 +242,18 @@ assure_exists()
esac
}
# improve
get_package_type()
{
local i
for i in deb rpm ; do
[ "${1/.$i/}" != "$1" ] && echo $i && return
done
echo "$1"
return 0
}
# print options description from HELPCMD/HELPOPT lines in the code
get_help()
{
......
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