Commit 1841bca5 authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to p7 as 1.5.16-alt0.M70P.1 (with rpmbph script)

parents f207ecba ba7c9b33
--dump-options for write simple bash completition
add epm site / epmurl in replace to rpmurl add epm site / epmurl in replace to rpmurl
yum remove $(package-cleanup --orphans yum remove $(package-cleanup --orphans
......
...@@ -58,7 +58,7 @@ print_version() ...@@ -58,7 +58,7 @@ print_version()
{ {
echo "EPM package manager version @VERSION@" echo "EPM package manager version @VERSION@"
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-2014" 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."
} }
...@@ -246,7 +246,7 @@ check_command() ...@@ -246,7 +246,7 @@ check_command()
downgrade) # HELPCMD: downgrade [all] packages to the repo state downgrade) # HELPCMD: downgrade [all] packages to the repo state
epm_cmd=downgrade epm_cmd=downgrade
;; ;;
download) # HELPCMD: download package(s) file to the current dir download) # HELPCMD: download package(s) file to the current dir
epm_cmd=download epm_cmd=download
;; ;;
simulate) # HELPCMD: simulate install with check requires simulate) # HELPCMD: simulate install with check requires
...@@ -255,6 +255,9 @@ check_command() ...@@ -255,6 +255,9 @@ check_command()
audit) # HELPCMD: audits installed packages against known vulnerabilities audit) # HELPCMD: audits installed packages against known vulnerabilities
epm_cmd=audit epm_cmd=audit
;; ;;
site|url) # HELPCMD: open package's site in a browser (use -p for open packages.altlinux.org site)
epm_cmd=site
;;
-V|checkpkg|integrity) # HELPCMD: check package file integrity (checksum) -V|checkpkg|integrity) # HELPCMD: check package file integrity (checksum)
epm_cmd=checkpkg epm_cmd=checkpkg
;; ;;
......
...@@ -47,9 +47,9 @@ __epm_assure() ...@@ -47,9 +47,9 @@ __epm_assure()
{ {
if is_dirpath "$1" ; then if is_dirpath "$1" ; then
if [ -r "$1" ] ; then if [ -e "$1" ] ; then
if [ -n "$verbose" ] ; then if [ -n "$verbose" ] ; then
info "File $1 is exists." info "File or directory $1 is already exists."
epm qf "$1" epm qf "$1"
fi fi
return 0 return 0
...@@ -57,7 +57,6 @@ __epm_assure() ...@@ -57,7 +57,6 @@ __epm_assure()
[ -n "$2" ] || fatal "You need run with package name param when use with absolute path" [ -n "$2" ] || fatal "You need run with package name param when use with absolute path"
# TODO: below we install in some semimanual way
docmd epm --auto --skip-installed install "$2" docmd epm --auto --skip-installed install "$2"
return return
fi fi
...@@ -74,18 +73,13 @@ __epm_assure() ...@@ -74,18 +73,13 @@ __epm_assure()
# TODO: use package name normalization # TODO: use package name normalization
info "Installing appropriate package for $1 command..." info "Installing appropriate package for $1 command..."
# TODO: why we can't use epm install here? it can be non interactive and skip-installed
# QUESTION: how we can this package is installed if its not?
load_helper epm-install
local PACKAGE="$2" local PACKAGE="$2"
[ -n "$PACKAGE" ] || PACKAGE="$1" [ -n "$PACKAGE" ] || PACKAGE="$1"
#epm install $2
# copied from epm_install local PACKAGEVERSION="$3"
local names="$(echo "$PACKAGE" | filter_out_installed_packages)" warning "TODO: check for PACKAGEVERSION is missed"
non_interactive=1 epm_install_names $names docmd epm --auto --skip-installed install "$PACKAGE"
} }
...@@ -94,5 +88,5 @@ epm_assure() ...@@ -94,5 +88,5 @@ epm_assure()
[ -n "$pkg_filenames" ] || fatal "Assure: Missing params. Check $0 --help for info." [ -n "$pkg_filenames" ] || fatal "Assure: Missing params. Check $0 --help for info."
# use helper func for extract separate params # use helper func for extract separate params
__epm_assure $pkg_filenames __epm_assure $(eval echo $quoted_args)
} }
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2014 Etersoft # Copyright (C) 2014, 2015 Etersoft
# Copyright (C) 2014 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2014, 2015 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -24,6 +24,8 @@ __is_repo_info_download() ...@@ -24,6 +24,8 @@ __is_repo_info_download()
if [ -r /var/cache/apt ] ; then if [ -r /var/cache/apt ] ; then
# FIXME: only if root permissions # FIXME: only if root permissions
test -r /var/cache/apt/pkgcache.bin || return test -r /var/cache/apt/pkgcache.bin || return
# if repo older than 1 day, return false
test -n "$(find /var/cache/apt/pkgcache.bin -ctime +1)" || return
fi fi
;; ;;
*) *)
......
...@@ -19,17 +19,15 @@ ...@@ -19,17 +19,15 @@
# copied from etersoft-build-utils/bin/rpmqf # copied from etersoft-build-utils/bin/rpmqf
# use and modify TOFILE recursively
__do_query_real_file() __do_query_real_file()
{ {
local LINKTO1 LINKTO
local TOFILE local TOFILE
# get canonical path # get canonical path
if [ -e "$1" ] ; then if [ -e "$1" ] ; then
TOFILE=$1 TOFILE="$1"
else else
TOFILE=`which $1 2>/dev/null || echo $1` TOFILE=$(which "$1" 2>/dev/null || echo "$1")
if [ "$TOFILE" != "$1" ] ; then if [ "$TOFILE" != "$1" ] ; then
info "Note: $1 is placed as $TOFILE" info "Note: $1 is placed as $TOFILE"
fi fi
...@@ -37,10 +35,12 @@ __do_query_real_file() ...@@ -37,10 +35,12 @@ __do_query_real_file()
# get value of symbolic link # get value of symbolic link
if [ -L "$TOFILE" ] ; then if [ -L "$TOFILE" ] ; then
__do_query $TOFILE local LINKTO
LINKTO=`readlink "$TOFILE"` __do_query "$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
fi fi
FULLFILEPATH="$TOFILE" FULLFILEPATH="$TOFILE"
...@@ -158,7 +158,7 @@ epm_query_file() ...@@ -158,7 +158,7 @@ epm_query_file()
for pkg in $pkg_filenames ; do for pkg in $pkg_filenames ; do
__do_query_real_file "$pkg" __do_query_real_file "$pkg"
__do_query $FULLFILEPATH || pkg_filenames=$FULLFILEPATH epm_search_file __do_query "$FULLFILEPATH" || pkg_filenames="$FULLFILEPATH" epm_search_file
done done
} }
...@@ -36,8 +36,7 @@ __check_yum_result() ...@@ -36,8 +36,7 @@ __check_yum_result()
{ {
grep "^No package" $1 && return 1 grep "^No package" $1 && return 1
grep "^Complete!" $1 && return 0 grep "^Complete!" $1 && return 0
grep "^Exiting on user Command" $1 && return 0 grep "Exiting on user [Cc]ommand" $1 && return 0
grep "^Exiting on user command" $1 && return 0
# dnf issue # dnf issue
grep "^Operation aborted." $1 && return 0 grep "^Operation aborted." $1 && return 0
# return default result by default # return default result by default
......
#!/bin/sh
#
# Copyright (C) 2015 Etersoft
# Copyright (C) 2015 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/>.
#
load_helper epm-query
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
}
# FIXME: Copied from etersoft-build-utils
# Query variables from rpm package
querypackage()
{
local FORMAT="%{$2}"
local INSTALLED="-p"
# if name empty, use third param as format string
[ -n "$2" ] || FORMAT="$3"
# if not file, drop -p for get from rpm base
[ -e "$1" ] || INSTALLED=""
rpmquery $INSTALLED --queryformat "$FORMAT" $1
}
# FIXME: Copied from etersoft-build-utils
# return source package name by binary rpm package file
get_sourcepkg_name()
{
local FILE="$1"
local PKGVERSION=$(querypackage "$FILE" VERSION)
querypackage "$FILE" sourcerpm | sed -e "s|-$PKGVERSION.*||g"
}
query_package_url()
{
local URL
case $PMTYPE in
*-rpm)
querypackage "$1" URL
#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 "http://packages.altlinux.org/$loc/Sisyphus/srpms"
}
query_altlinux_url()
{
local URL
case $PMTYPE in
*-rpm)
local srpm=$(get_sourcepkg_name "$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"
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
#for f in $pkg_names ; do
# LANG=C epm info $f
#done
# TODO: -p for p.a.o (see rpmurl)
}
# 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. Do not edit it.
# #
Name: eepm Name: eepm
Version: 1.5.13 Version: 1.5.16
Release: alt0.M70P.1 Release: alt0.M70P.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
...@@ -67,9 +67,21 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}* ...@@ -67,9 +67,21 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv %_sysconfdir/bash_completion.d/cerv
%changelog %changelog
* Tue Jul 21 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.13-alt0.M70P.1 * Sun Aug 16 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.16-alt0.M70P.1
- backport to ALTLinux p7 (by rpmbph script) - backport to ALTLinux p7 (by rpmbph script)
* Sun Aug 16 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.16-alt1
- run update if repo info older than 1 day
- epm-query_file: fix read link
- add epm url|site command (with -p arg for open at packages.altlinux.org)
* Wed Aug 12 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.15-alt1
- epm-assure: fix for dir checking support
- epm query file: fix recursion result and more quoting
* Fri Jul 24 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.14-alt1
- simulate: allow Exiting on user Command in any place of the line
* Tue Jul 21 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.13-alt1 * Tue Jul 21 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.13-alt1
- epm-assure: add support for checking any path on a file system - epm-assure: add support for checking any path on a file system
- small fixes - small fixes
......
...@@ -306,7 +306,7 @@ assure_exists() ...@@ -306,7 +306,7 @@ assure_exists()
eget() eget()
{ {
$PROGDIR/tools-eget "$@" $SHAREDIR/tools-eget "$@"
} }
get_package_type() get_package_type()
...@@ -400,7 +400,7 @@ case $DISTRNAME in ...@@ -400,7 +400,7 @@ case $DISTRNAME in
;; ;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific) Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
CMD="yum-rpm" CMD="yum-rpm"
#which dnf 2>/dev/null >/dev/null && CMD=dnf-rpm which dnf 2>/dev/null >/dev/null && test -d /var/lib/dnf/yumdb && CMD=dnf-rpm
;; ;;
Slackware) Slackware)
CMD="slackpkg" CMD="slackpkg"
...@@ -484,10 +484,37 @@ __check_command_in_path() ...@@ -484,10 +484,37 @@ __check_command_in_path()
} }
rhas()
{
echo "$1" | egrep -q -- "$2"
}
is_dirpath()
{
[ "$1" = "." ] && return $?
rhas "$1" "/"
}
__epm_assure() __epm_assure()
{ {
if is_dirpath "$1" ; then
if [ -e "$1" ] ; then
if [ -n "$verbose" ] ; then
info "File or directory $1 is already exists."
epm qf "$1"
fi
return 0
fi
[ -n "$2" ] || fatal "You need run with package name param when use with absolute path"
docmd epm --auto --skip-installed install "$2"
return
fi
if __check_command_in_path "$1" >/dev/null ; then if __check_command_in_path "$1" >/dev/null ; then
if [ -n "$verbose" ] ; then if [ -n "$verbose" ] ; then
local compath="$(__check_command_in_path "$1")" local compath="$(__check_command_in_path "$1")"
...@@ -500,16 +527,13 @@ __epm_assure() ...@@ -500,16 +527,13 @@ __epm_assure()
# TODO: use package name normalization # TODO: use package name normalization
info "Installing appropriate package for $1 command..." info "Installing appropriate package for $1 command..."
load_helper epm-install
local PACKAGE="$2" local PACKAGE="$2"
[ -n "$PACKAGE" ] || PACKAGE="$1" [ -n "$PACKAGE" ] || PACKAGE="$1"
#epm install $2
# copied from epm_install local PACKAGEVERSION="$3"
local names="$(echo "$PACKAGE" | filter_out_installed_packages)" warning "TODO: check for PACKAGEVERSION is missed"
non_interactive=1 epm_install_names $names docmd epm --auto --skip-installed install "$PACKAGE"
} }
...@@ -518,7 +542,7 @@ epm_assure() ...@@ -518,7 +542,7 @@ epm_assure()
[ -n "$pkg_filenames" ] || fatal "Assure: Missing params. Check $0 --help for info." [ -n "$pkg_filenames" ] || fatal "Assure: Missing params. Check $0 --help for info."
# use helper func for extract separate params # use helper func for extract separate params
__epm_assure $pkg_filenames __epm_assure $(eval echo $quoted_args)
} }
# File bin/epm-audit: # File bin/epm-audit:
...@@ -536,6 +560,64 @@ esac ...@@ -536,6 +560,64 @@ esac
} }
# File bin/epm-autoorphans:
epm_autoorphans()
{
case $PMTYPE in
#apt-rpm)
# ALT Linux only
#__epm_autoremove_altrpm
# ALT Linux only
#assure_exists remove-old-kernels
#sudocmd remove-old-kernels
# ;;
apt-dpkg|aptitude-dpkg)
assure_exists deborphan
showcmd deborphan
deborphan | sudocmd epm remove
;;
#aura)
# sudocmd aura -Oj
# ;;
yum-rpm)
showcmd package-cleanup --orphans
local PKGLIST=$(package-cleanup --orphans)
sudocmd epm remove $PKGLIST
;;
urpm-rpm)
showcmd urpmq --auto-orphans
sudocmd urpme --auto-orphans
;;
#emerge)
# sudocmd emerge --depclean
# assure_exists revdep-rebuild
# sudocmd revdep-rebuild
# ;;
pacman)
sudocmd pacman -Qdtq | sudocmd pacman -Rs -
;;
#slackpkg)
# clean-system removes non official packages
#sudocmd slackpkg clean-system
# ;;
#guix)
# sudocmd guix gc
# ;;
#pkgng)
# sudocmd pkg autoremove
# ;;
#zypper-rpm)
# sudocmd zypper clean
# ;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
# File bin/epm-autoremove: # File bin/epm-autoremove:
__epm_autoremove_altrpm() __epm_autoremove_altrpm()
...@@ -560,10 +642,11 @@ epm_autoremove() ...@@ -560,10 +642,11 @@ epm_autoremove()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
assure_exists remove-old-kernels
# ALT Linux only # ALT Linux only
__epm_autoremove_altrpm __epm_autoremove_altrpm
# ALT Linux only # ALT Linux only
assure_exists remove-old-kernels
sudocmd remove-old-kernels sudocmd remove-old-kernels
;; ;;
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
...@@ -582,17 +665,19 @@ case $PMTYPE in ...@@ -582,17 +665,19 @@ case $PMTYPE in
sudocmd yum remove $PKGLIST sudocmd yum remove $PKGLIST
done done
;; ;;
urpm-rpm) # see autoorhans
sudocmd urpme --auto-orphans #urpm-rpm)
;; # sudocmd urpme --auto-orphans
# ;;
emerge) emerge)
sudocmd emerge --depclean sudocmd emerge --depclean
assure_exists revdep-rebuild assure_exists revdep-rebuild
sudocmd revdep-rebuild sudocmd revdep-rebuild
;; ;;
pacman) # see autoorhans
sudocmd pacman -Qdtq | sudocmd pacman -Rs - #pacman)
;; # sudocmd pacman -Qdtq | sudocmd pacman -Rs -
# ;;
slackpkg) slackpkg)
# clean-system removes non official packages # clean-system removes non official packages
#sudocmd slackpkg clean-system #sudocmd slackpkg clean-system
...@@ -645,7 +730,7 @@ __epm_changelog_local_names() ...@@ -645,7 +730,7 @@ __epm_changelog_local_names()
[ -z "$*" ] && return [ -z "$*" ] && return
case $PMTYPE in case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm) apt-rpm|yum-rpm|dnf-rpm|urpm-rpm|zypper-rpm)
docmd_foreach "rpm --changelog" $@ | less docmd_foreach "rpm --changelog" $@ | less
;; ;;
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
...@@ -1040,6 +1125,9 @@ epm_downgrade() ...@@ -1040,6 +1125,9 @@ epm_downgrade()
# can do update repobase automagically # can do update repobase automagically
sudocmd yum downgrade $pkg_filename sudocmd yum downgrade $pkg_filename
;; ;;
dnf-rpm)
sudocmd dnf downgrade $pkg_filename
;;
urpm-rpm) urpm-rpm)
assure_exists urpm-reposync urpm-tools assure_exists urpm-reposync urpm-tools
sudocmd urpm-reposync -v sudocmd urpm-reposync -v
...@@ -1050,6 +1138,22 @@ epm_downgrade() ...@@ -1050,6 +1138,22 @@ epm_downgrade()
esac esac
} }
# File bin/epm-download:
epm_download()
{
local CMD
case $PMTYPE in
dnf-rpm)
sudocmd dnf download $pkg_filename
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
# File bin/epm-filelist: # File bin/epm-filelist:
...@@ -1080,6 +1184,11 @@ __epm_filelist_remote() ...@@ -1080,6 +1184,11 @@ __epm_filelist_remote()
# TODO: use RESTful interface to prometeus? See ALT bug #29496 # TODO: use RESTful interface to prometeus? See ALT bug #29496
docmd_foreach __alt_local_content_filelist $@ docmd_foreach __alt_local_content_filelist $@
;; ;;
apt-dpkg)
assure_exists apt-file
sudocmd apt-file update
docmd apt-file list $@
;;
*) *)
fatal "Query filelist for non installed packages does not realized" fatal "Query filelist for non installed packages does not realized"
;; ;;
...@@ -1161,6 +1270,7 @@ __epm_filelist_name() ...@@ -1161,6 +1270,7 @@ __epm_filelist_name()
# TODO: add less # TODO: add less
docmd $CMD $pkg_names && return docmd $CMD $pkg_names && return
# TODO: may be we need check is installed before prev. line?
is_installed $pkg_names || __epm_filelist_remote $pkg_names is_installed $pkg_names || __epm_filelist_remote $pkg_names
} }
...@@ -1433,6 +1543,9 @@ epm_ni_install_names() ...@@ -1433,6 +1543,9 @@ epm_ni_install_names()
yum-rpm) yum-rpm)
sudocmd yum -y $YUMOPTIONS install $@ sudocmd yum -y $YUMOPTIONS install $@
return ;; return ;;
dnf-rpm)
sudocmd dnf -y $YUMOPTIONS install $@
return ;;
urpm-rpm) urpm-rpm)
sudocmd urpmi --auto $URPMOPTIONS $@ sudocmd urpmi --auto $URPMOPTIONS $@
return ;; return ;;
...@@ -1650,12 +1763,17 @@ epm_install() ...@@ -1650,12 +1763,17 @@ epm_install()
# Download urls via eget pkg_urls and use eget # Download urls via eget pkg_urls and use eget
# TODO: use optimization (rpm can download packages by url, yum too?) # TODO: use optimization (rpm can download packages by url, yum too?)
download_pkg_urls "$pkg_urls" #[ -n "$pkg_urls" ] && warning "URL using does not realize yet"
#download_pkg_urls "$pkg_urls"
# temp. hack
pkg_files="$pkg_files $pkg_urls"
# TODO: add downloaded files to $pkg_files
[ -z "$pkg_files$pkg_names" ] && info "Skip empty install list" && return 22 [ -z "$pkg_files$pkg_names$pkg_urls" ] && info "Skip empty install list" && return 22
local names="$(echo $pkg_names | filter_out_installed_packages)" local names="$(echo $pkg_names | filter_out_installed_packages)"
local files="$(echo $pkg_files | filter_out_installed_packages)" local files="$(echo $pkg_files | filter_out_installed_packages)"
local urls="$(echo $pkg_urls | filter_out_installed_packages)"
[ -z "$files$names" ] && info "Skip empty install list" && return 22 [ -z "$files$names" ] && info "Skip empty install list" && return 22
...@@ -1925,6 +2043,7 @@ epm_programs() ...@@ -1925,6 +2043,7 @@ epm_programs()
epm_provides_files() epm_provides_files()
{ {
local pkg_files="$@"
[ -n "$pkg_files" ] || return [ -n "$pkg_files" ] || return
local PKGTYPE="$(get_package_type $pkg_files)" local PKGTYPE="$(get_package_type $pkg_files)"
...@@ -1948,6 +2067,7 @@ epm_provides_files() ...@@ -1948,6 +2067,7 @@ epm_provides_files()
epm_provides_names() epm_provides_names()
{ {
local pkg_names="$@"
local CMD local CMD
[ -n "$pkg_names" ] || return [ -n "$pkg_names" ] || return
...@@ -2002,8 +2122,8 @@ epm_provides() ...@@ -2002,8 +2122,8 @@ epm_provides()
{ {
[ -n "$pkg_filenames" ] || fatal "Provides: missing package(s) name" [ -n "$pkg_filenames" ] || fatal "Provides: missing package(s) name"
epm_provides_files epm_provides_files $pkg_files
epm_provides_names epm_provides_names $pkg_names
} }
# File bin/epm-query: # File bin/epm-query:
...@@ -2177,14 +2297,13 @@ epm_query() ...@@ -2177,14 +2297,13 @@ epm_query()
__do_query_real_file() __do_query_real_file()
{ {
local LINKTO1 LINKTO
local TOFILE local TOFILE
# get canonical path # get canonical path
if [ -e "$1" ] ; then if [ -e "$1" ] ; then
TOFILE=$1 TOFILE="$1"
else else
TOFILE=`which $1 2>/dev/null || echo $1` TOFILE=$(which "$1" 2>/dev/null || echo "$1")
if [ "$TOFILE" != "$1" ] ; then if [ "$TOFILE" != "$1" ] ; then
info "Note: $1 is placed as $TOFILE" info "Note: $1 is placed as $TOFILE"
fi fi
...@@ -2192,10 +2311,12 @@ __do_query_real_file() ...@@ -2192,10 +2311,12 @@ __do_query_real_file()
# get value of symbolic link # get value of symbolic link
if [ -L "$TOFILE" ] ; then if [ -L "$TOFILE" ] ; then
__do_query $TOFILE local LINKTO
LINKTO=`readlink "$TOFILE"` __do_query "$TOFILE"
LINKTO=$(readlink "$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
fi fi
FULLFILEPATH="$TOFILE" FULLFILEPATH="$TOFILE"
...@@ -2226,7 +2347,7 @@ __do_query() ...@@ -2226,7 +2347,7 @@ __do_query()
showcmd dpkg -S $1 showcmd dpkg -S $1
dpkg_print_name_version $(dpkg -S $1 | grep -v "^diversion by" | sed -e "s|:.*||") dpkg_print_name_version $(dpkg -S $1 | grep -v "^diversion by" | sed -e "s|:.*||")
return ;; return ;;
yum-rpm|urpm-rpm) yum-rpm|dnf-rpm|urpm-rpm)
CMD="rpm -qf" CMD="rpm -qf"
;; ;;
zypper-rpm) zypper-rpm)
...@@ -2313,7 +2434,7 @@ epm_query_file() ...@@ -2313,7 +2434,7 @@ epm_query_file()
for pkg in $pkg_filenames ; do for pkg in $pkg_filenames ; do
__do_query_real_file "$pkg" __do_query_real_file "$pkg"
__do_query $FULLFILEPATH || pkg_filenames=$FULLFILEPATH epm_search_file __do_query "$FULLFILEPATH" || pkg_filenames="$FULLFILEPATH" epm_search_file
done done
} }
...@@ -2765,6 +2886,7 @@ esac ...@@ -2765,6 +2886,7 @@ esac
epm_requires_files() epm_requires_files()
{ {
local pkg_files="$@"
[ -n "$pkg_files" ] || return [ -n "$pkg_files" ] || return
local PKGTYPE="$(get_package_type $pkg_files)" local PKGTYPE="$(get_package_type $pkg_files)"
...@@ -2786,6 +2908,7 @@ epm_requires_files() ...@@ -2786,6 +2908,7 @@ epm_requires_files()
epm_requires_names() epm_requires_names()
{ {
local pkg_names="$@"
local CMD local CMD
[ -n "$pkg_names" ] || return [ -n "$pkg_names" ] || return
...@@ -2844,8 +2967,8 @@ docmd $CMD $pkg_names ...@@ -2844,8 +2967,8 @@ docmd $CMD $pkg_names
epm_requires() epm_requires()
{ {
[ -n "$pkg_filenames" ] || fatal "Requires: missing package(s) name" [ -n "$pkg_filenames" ] || fatal "Requires: missing package(s) name"
epm_requires_files epm_requires_files $pkg_files
epm_requires_names epm_requires_names $pkg_names
} }
# File bin/epm-search: # File bin/epm-search:
...@@ -3091,8 +3214,9 @@ __check_yum_result() ...@@ -3091,8 +3214,9 @@ __check_yum_result()
{ {
grep "^No package" $1 && return 1 grep "^No package" $1 && return 1
grep "^Complete!" $1 && return 0 grep "^Complete!" $1 && return 0
grep "^Exiting on user Command" $1 && return 0 grep "Exiting on user [Cc]ommand" $1 && return 0
grep "^Exiting on user command" $1 && return 0 # dnf issue
grep "^Operation aborted." $1 && return 0
# return default result by default # return default result by default
return $2 return $2
} }
...@@ -3133,6 +3257,12 @@ EOF ...@@ -3133,6 +3257,12 @@ EOF
RES=$? RES=$?
clean_store_output clean_store_output
return $RES ;; return $RES ;;
dnf-rpm)
LC_ALL=C store_output sudocmd dnf --assumeno install $filenames
__check_yum_result $RC_STDOUT $?
RES=$?
clean_store_output
return $RES ;;
urpm-rpm) urpm-rpm)
CMD="urpmi --test --auto" CMD="urpmi --test --auto"
;; ;;
...@@ -3223,7 +3353,12 @@ case $PMTYPE in ...@@ -3223,7 +3353,12 @@ case $PMTYPE in
sudocmd aptitude update || exit sudocmd aptitude update || exit
;; ;;
yum-rpm) yum-rpm)
sudocmd yum check-update info "update command is stubbed for yum"
#sudocmd yum check-update
;;
dnf-rpm)
info "update command is stubbed for dnf"
#sudocmd dnf check-update
;; ;;
urpm-rpm) urpm-rpm)
sudocmd urpmi.update -a sudocmd urpmi.update -a
...@@ -3763,9 +3898,9 @@ $(get_help HELPOPT) ...@@ -3763,9 +3898,9 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "EPM package manager version 1.5.10" echo "EPM package manager version 1.5.15"
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-2014" 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."
} }
...@@ -3941,6 +4076,9 @@ check_command() ...@@ -3941,6 +4076,9 @@ check_command()
autoremove) # HELPCMD: auto remove unneeded package(s) autoremove) # HELPCMD: auto remove unneeded package(s)
epm_cmd=autoremove epm_cmd=autoremove
;; ;;
autoorphans|--orphans) # HELPCMD: remove all packages not from the repository
epm_cmd=autoorphans
;;
upgrade|dist-upgrade) # HELPCMD: performs upgrades of package software distributions upgrade|dist-upgrade) # HELPCMD: performs upgrades of package software distributions
epm_cmd=upgrade epm_cmd=upgrade
;; ;;
...@@ -3950,6 +4088,9 @@ check_command() ...@@ -3950,6 +4088,9 @@ check_command()
downgrade) # HELPCMD: downgrade [all] packages to the repo state downgrade) # HELPCMD: downgrade [all] packages to the repo state
epm_cmd=downgrade epm_cmd=downgrade
;; ;;
download) # HELPCMD: download package(s) file to the current dir
epm_cmd=download
;;
simulate) # HELPCMD: simulate install with check requires simulate) # HELPCMD: simulate install with check requires
epm_cmd=simulate epm_cmd=simulate
;; ;;
...@@ -4023,7 +4164,7 @@ check_filenames() ...@@ -4023,7 +4164,7 @@ check_filenames()
elif [ -d "$opt" ] ; then elif [ -d "$opt" ] ; then
pkg_dirs="$pkg_dirs $opt" pkg_dirs="$pkg_dirs $opt"
elif echo "$opt" | grep -q "://" ; then elif echo "$opt" | grep -q "://" ; then
pkg_urls="$pkg_names $opt" pkg_urls="$pkg_urls $opt"
else else
pkg_names="$pkg_names $opt" pkg_names="$pkg_names $opt"
fi fi
...@@ -4051,10 +4192,11 @@ fi ...@@ -4051,10 +4192,11 @@ fi
pkg_files=$(strip_spaces "$pkg_files") pkg_files=$(strip_spaces "$pkg_files")
pkg_dirs=$(strip_spaces "$pkg_dirs") pkg_dirs=$(strip_spaces "$pkg_dirs")
pkg_names=$(strip_spaces "$pkg_names") # in common case dirs equals to names only suddenly
pkg_names=$(strip_spaces "$pkg_names $pkg_dirs")
pkg_urls=$(strip_spaces "$pkg_urls") pkg_urls=$(strip_spaces "$pkg_urls")
pkg_filenames=$(strip_spaces "$pkg_files $pkg_dirs $pkg_names") pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
# Just debug # Just debug
#echover "command: $epm_cmd" #echover "command: $epm_cmd"
......
...@@ -304,7 +304,7 @@ assure_exists() ...@@ -304,7 +304,7 @@ assure_exists()
eget() eget()
{ {
$PROGDIR/tools-eget "$@" $SHAREDIR/tools-eget "$@"
} }
get_package_type() get_package_type()
...@@ -398,7 +398,7 @@ case $DISTRNAME in ...@@ -398,7 +398,7 @@ case $DISTRNAME in
;; ;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific) Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
CMD="yum-rpm" CMD="yum-rpm"
#which dnf 2>/dev/null >/dev/null && CMD=dnf-rpm which dnf 2>/dev/null >/dev/null && test -d /var/lib/dnf/yumdb && CMD=dnf-rpm
;; ;;
Slackware) Slackware)
CMD="slackpkg" CMD="slackpkg"
...@@ -574,6 +574,30 @@ serv_list_startup() ...@@ -574,6 +574,30 @@ serv_list_startup()
esac esac
} }
# File bin/serv-restart:
serv_restart()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
sudocmd service $SERVICE restart "$@"
;;
service-initd|service-update)
sudocmd $INITDIR/$SERVICE restart "$@"
;;
systemd)
sudocmd systemctl restart $SERVICE "$@"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
esac
}
# File bin/serv-start: # File bin/serv-start:
serv_start() serv_start()
...@@ -1147,7 +1171,7 @@ $(get_help HELPOPT) ...@@ -1147,7 +1171,7 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "Service manager version 1.5.10" echo "Service manager version 1.5.15"
echo "Running on $($DISTRVENDOR)" echo "Running on $($DISTRVENDOR)"
echo "Copyright (c) Etersoft 2012, 2013" echo "Copyright (c) Etersoft 2012, 2013"
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."
...@@ -1182,7 +1206,9 @@ check_command() ...@@ -1182,7 +1206,9 @@ check_command()
serv_cmd=usage serv_cmd=usage
withoutservicename=1 withoutservicename=1
;; ;;
#restart) # HELPCMD: restart service restart) # HELPCMD: restart service
serv_cmd=restart
;;
#reload) # HELPCMD: reload service #reload) # HELPCMD: reload service
start) # HELPCMD: start service start) # HELPCMD: start service
serv_cmd=start serv_cmd=start
......
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