Commit dd584ea6 authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents 5000593e 2effb75e
dotty - через ссылки на реальные названия (epm req верхнего уровня)
менеджер пакетов из NetBSD — pkgsrc (команды для поиска нужных пакетов – pkgin update; pkgin avail; pkgin search). менеджер пакетов из NetBSD — pkgsrc (команды для поиска нужных пакетов – pkgin update; pkgin avail; pkgin search).
Загрузку конфига Загрузку конфига
......
...@@ -80,6 +80,7 @@ show_command_only= ...@@ -80,6 +80,7 @@ show_command_only=
epm_cmd= epm_cmd=
pkg_files= pkg_files=
pkg_names= pkg_names=
pkg_urls=
quoted_args= quoted_args=
progname="${0##*/}" progname="${0##*/}"
...@@ -142,7 +143,7 @@ check_command() ...@@ -142,7 +143,7 @@ check_command()
-e|-P|remove|delete|uninstall|erase|e) # HELPCMD: remove (delete) package(s) from the database and the system -e|-P|remove|delete|uninstall|erase|e) # HELPCMD: remove (delete) package(s) from the database and the system
epm_cmd=remove epm_cmd=remove
;; ;;
-s|search) # HELPCMD: search in remote package repositories -s|search|s) # HELPCMD: search in remote package repositories
epm_cmd=search epm_cmd=search
;; ;;
-qp|qp|query_package) # HELPCMD: search in the list of installed packages -qp|qp|query_package) # HELPCMD: search in the list of installed packages
...@@ -288,6 +289,7 @@ check_option() ...@@ -288,6 +289,7 @@ check_option()
short="--short" short="--short"
;; ;;
--sort) # HELPOPT: sort output, f.i. --sort=size (supported only for packages command) --sort) # HELPOPT: sort output, f.i. --sort=size (supported only for packages command)
# TODO: how to read arg?
sort="$1" sort="$1"
;; ;;
--auto) # HELPOPT: non interactive mode --auto) # HELPOPT: non interactive mode
...@@ -302,14 +304,18 @@ check_option() ...@@ -302,14 +304,18 @@ check_option()
check_filenames() check_filenames()
{ {
local opt="$1" local opt
# files can be with full path or have extension via . for opt in $* ; do
if [ -f "$opt" ] && echo "$opt" | grep -q "[/\.]" ; then # files can be with full path or have extension via .
pkg_files="$pkg_files $opt" if [ -f "$opt" ] && echo "$opt" | grep -q "[/\.]" ; then
else pkg_files="$pkg_files $opt"
pkg_names="$pkg_names $opt" elif echo "$opt" | grep -q "://" ; then
fi pkg_urls="$pkg_names $opt"
quoted_args="$quoted_args \"$opt\"" else
pkg_names="$pkg_names $opt"
fi
quoted_args="$quoted_args \"$opt\""
done
} }
FLAGENDOPTS= FLAGENDOPTS=
...@@ -319,18 +325,20 @@ for opt in "$@" ; do ...@@ -319,18 +325,20 @@ for opt in "$@" ; do
check_command $opt && continue check_command $opt && continue
check_option $opt && continue check_option $opt && continue
fi fi
# Note: will parse all params separately (no package names with spaces!)
check_filenames $opt check_filenames $opt
done done
# if input is not console, get pkg from it too # if input is not console, get pkg from it too
if ! inputisatty ; then if ! inputisatty ; then
for opt in $(timeout 1 cat 2>/dev/null) ; do for opt in $(withtimeout 1 cat) ; do
check_filenames $opt check_filenames $opt
done done
fi fi
pkg_files=$(strip_spaces "$pkg_files") pkg_files=$(strip_spaces "$pkg_files")
pkg_names=$(strip_spaces "$pkg_names") pkg_names=$(strip_spaces "$pkg_names")
pkg_urls=$(strip_spaces "$pkg_urls")
pkg_filenames=$(strip_spaces "$pkg_files $pkg_names") pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
......
...@@ -22,7 +22,7 @@ epm_addrepo() ...@@ -22,7 +22,7 @@ epm_addrepo()
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
assure_exists apt-repo assure_exists apt-repo
sudocmd apt-repo add $pkg_filenames sudocmd apt-repo add "$pkg_filenames"
;; ;;
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
info "You need manually add repo to /etc/apt/sources.list" info "You need manually add repo to /etc/apt/sources.list"
...@@ -31,13 +31,13 @@ case $PMTYPE in ...@@ -31,13 +31,13 @@ case $PMTYPE in
info "You need manually add repo to /etc/yum.repos.d/" info "You need manually add repo to /etc/yum.repos.d/"
;; ;;
urpm-rpm) urpm-rpm)
sudocmd urpmi.addmedia $pkg_filenames sudocmd urpmi.addmedia "$pkg_filenames"
;; ;;
zypper-rpm) zypper-rpm)
sudocmd zypper ar $pkg_filenames sudocmd zypper ar "$pkg_filenames"
;; ;;
emerge) emerge)
sudocmd layman -a $pkg_filenames sudocmd layman -a $"pkg_filenames"
;; ;;
pacman) pacman)
info "You need manually add repo to /etc/pacman.conf" info "You need manually add repo to /etc/pacman.conf"
...@@ -45,7 +45,7 @@ case $PMTYPE in ...@@ -45,7 +45,7 @@ case $PMTYPE in
#sudocmd repo-add $pkg_filenames #sudocmd repo-add $pkg_filenames
;; ;;
npackd) npackd)
sudocmd npackdcl add-repo --url=$pkg_filenames sudocmd npackdcl add-repo --url="$pkg_filenames"
;; ;;
slackpkg) slackpkg)
info "You need manually add repo to /etc/slackpkg/mirrors" info "You need manually add repo to /etc/slackpkg/mirrors"
......
...@@ -39,7 +39,7 @@ __epm_assure() ...@@ -39,7 +39,7 @@ __epm_assure()
info "Command $1 is exists: $compath" info "Command $1 is exists: $compath"
epm qf "$compath" epm qf "$compath"
fi fi
return return 0
fi fi
# TODO: use package name normalization # TODO: use package name normalization
......
...@@ -24,7 +24,7 @@ __epm_autoremove_altrpm() ...@@ -24,7 +24,7 @@ __epm_autoremove_altrpm()
load_helper epm-packages load_helper epm-packages
info info
info "Just removing all non -devel libs packages not need by anything" info "Just removing all non -devel libs packages not need by anything"
for pkg in $(short=1 pkg_filenames= epm_packages | grep -- "^lib" | grep -v -- "-devel$" | grep -v -- ^libreoffice ) ; do for pkg in $(short=1 pkg_filenames= epm_packages | grep -- "^lib" | grep -v -- "-devel$" | grep -v -- "-debuginfo$" | grep -v -- ^libreoffice | grep -v -- libnss- ) ; do
sudocmd rpm -v -e $pkg && flag=1 sudocmd rpm -v -e $pkg && flag=1
done done
......
...@@ -34,6 +34,7 @@ __epm_changelog_files() ...@@ -34,6 +34,7 @@ __epm_changelog_files()
# TODO: detect every file # TODO: detect every file
case $(get_package_type $1) in case $(get_package_type $1) in
rpm) rpm)
assure_exists rpm
docmd_foreach "rpm -p --changelog" $@ | less docmd_foreach "rpm -p --changelog" $@ | less
;; ;;
# deb) # deb)
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2009, 2012, 2013 Etersoft # Copyright (C) 2009, 2012, 2013, 2014 Etersoft
# Copyright (C) 2009, 2012, 2013 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2009, 2012, 2013, 2014 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -24,14 +24,22 @@ check_pkg_integrity() ...@@ -24,14 +24,22 @@ check_pkg_integrity()
case $(get_package_type $PKG) in case $(get_package_type $PKG) in
rpm) rpm)
assure_exists rpm
docmd rpm --checksig $PKG docmd rpm --checksig $PKG
;; ;;
deb) deb)
assure_exists dpkg
# FIXME: debsums -ca package ? # FIXME: debsums -ca package ?
docmd dpkg --contents $PKG >/dev/null && echo "Package $PKG is correct." docmd dpkg --contents $PKG >/dev/null && echo "Package $PKG is correct."
;; ;;
exe) exe)
true file $PKG | grep -q "executable for MS Windows"
;;
msi)
# TODO: add to patool via cabextract
assure_exists cabextract
#file $PKG | grep -q "Microsoft Office Document"
cabextract -t $PKG
;; ;;
ebuild) ebuild)
true true
......
...@@ -48,7 +48,7 @@ case $PMTYPE in ...@@ -48,7 +48,7 @@ case $PMTYPE in
slackpkg) slackpkg)
;; ;;
pkgng) pkgng)
sudo pkg clean sudocmd pkg clean -a
;; ;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
......
...@@ -25,6 +25,7 @@ epm_conflicts_files() ...@@ -25,6 +25,7 @@ epm_conflicts_files()
case $(get_package_type $pkg_files) in case $(get_package_type $pkg_files) in
rpm) rpm)
assure_exists rpm
docmd "rpm -q --conflicts -p" $pkg_files docmd "rpm -q --conflicts -p" $pkg_files
;; ;;
#deb) #deb)
......
#!/bin/sh
# eget - simply shell on wget for loading directories over http
# Example use:
# eget ftp://ftp.altlinux.ru/pub/security/ssl/*
#
# Copyright (C) 2014-2014 Etersoft
# Copyright (C) 2014-2014 Daniil Mikhailov <danil@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/>.
#
WGET="wget -q"
if echo "$1" | grep -q "\(^ftp://\|[^*]$\)" ; then
$WGET $1 && exit 0
fi
URL=$(echo $1 | grep /$ || dirname $1)
MASK=$(basename $1)
MYTMPDIR="$(mktemp -d)"
DIRALLFILES="$MYTMPDIR/files/"
get_index(){
INDEX=$MYTMPDIR/index
$WGET $URL -O $INDEX
}
save_temp_files(){
mkdir -p $DIRALLFILES
ALLFILES="$MYTMPDIR/allfiles"
cat $INDEX | grep -o -E 'href="([^\*/"#]+)"' | cut -d'"' -f2 > $ALLFILES
while read line ; do
touch $DIRALLFILES/$line
done <$ALLFILES
}
sort_files(){
for line in $DIRALLFILES/$MASK ; do
$WGET $URL/`basename "$line"` -P $CURRENTDIR/
done
}
get_index
save_temp_files
sort_files
...@@ -64,9 +64,11 @@ __epm_filelist_file() ...@@ -64,9 +64,11 @@ __epm_filelist_file()
# TODO: allow a new packages # TODO: allow a new packages
case $(get_package_type $1) in case $(get_package_type $1) in
rpm) rpm)
assure_exists rpm
CMD="rpm -qlp" CMD="rpm -qlp"
;; ;;
deb) deb)
assure_exists dpkg
CMD="dpkg --contents" CMD="dpkg --contents"
;; ;;
*) *)
......
...@@ -81,6 +81,15 @@ __separate_sudocmd() ...@@ -81,6 +81,15 @@ __separate_sudocmd()
return 0 return 0
} }
download_pkg_urls()
{
local url
[ -z "$1" ] && return
for url in $* ; do
eget $url || warning "Skipped"
done
}
# copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg # copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
epm_install_names() epm_install_names()
{ {
...@@ -124,6 +133,9 @@ epm_install_names() ...@@ -124,6 +133,9 @@ epm_install_names()
dnf-rpm) dnf-rpm)
sudocmd dnf install $@ sudocmd dnf install $@
return ;; return ;;
snappy)
sudocmd snappy install $@
return ;;
zypper-rpm) zypper-rpm)
sudocmd zypper install $ZYPPEROPTIONS $@ sudocmd zypper install $ZYPPEROPTIONS $@
return ;; return ;;
...@@ -237,6 +249,10 @@ epm_install_files() ...@@ -237,6 +249,10 @@ epm_install_files()
{ {
[ -z "$1" ] && return [ -z "$1" ] && return
# TODO: check read permissions
# sudo test -r FILE
# do not fallback to install_names if we have no permissions
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
sudocmd rpm -Uvh $force $nodeps $@ && return sudocmd rpm -Uvh $force $nodeps $@ && return
...@@ -332,7 +348,7 @@ epm_install_files() ...@@ -332,7 +348,7 @@ epm_install_files()
return ;; return ;;
slackpkg) slackpkg)
# FIXME: check for full package name # FIXME: check for full package name
# FIXME: broken status when use batch and default answer # FIXME: broken status when use batch and default answer
__separate_sudocmd_foreach "/sbin/installpkg" "/sbin/upgradepkg" $@ __separate_sudocmd_foreach "/sbin/installpkg" "/sbin/upgradepkg" $@
return ;; return ;;
esac esac
...@@ -389,6 +405,10 @@ epm_install() ...@@ -389,6 +405,10 @@ epm_install()
return return
fi fi
# Download urls via eget pkg_urls and use eget
# TODO: use optimization (rpm can download packages by url, yum too?)
download_pkg_urls "$pkg_urls"
[ -z "$pkg_files$pkg_names" ] && info "Skip empty install list" && return 22 [ -z "$pkg_files$pkg_names" ] && 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)"
......
...@@ -22,10 +22,11 @@ __epm_packages_sort() ...@@ -22,10 +22,11 @@ __epm_packages_sort()
# FIXME: sort depends on --sort value # FIXME: sort depends on --sort value
case $PMTYPE in case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm) apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm)
docmd rpm -qa --queryformat "%{size} %{name}-%{version}-%{release}\n" $pkg_filenames | sort -n # FIXME: space with quotes problems, use point instead
docmd rpm -qa --queryformat "%{size}.%{name}-%{version}-%{release}\n" $pkg_filenames | sort -n
;; ;;
apt-dpkg) apt-dpkg)
docmd dpkg-query -W --showformat="\${Size} \${Package}-\${Version}\n" $pkg_filenames | sort -n docmd dpkg-query -W --showformat="\${Size}.\${Package}-\${Version}\n" $pkg_filenames | sort -n
;; ;;
*) *)
fatal "Sorted package list are not realized for $PMTYPE" fatal "Sorted package list are not realized for $PMTYPE"
...@@ -48,6 +49,9 @@ case $PMTYPE in ...@@ -48,6 +49,9 @@ case $PMTYPE in
CMD="dpkg-query -W --showformat=\${Package}-\${Version}\n $pkg_filenames" CMD="dpkg-query -W --showformat=\${Package}-\${Version}\n $pkg_filenames"
[ -n "$short" ] && CMD="dpkg-query -W --showformat=\${Package}\n $pkg_filenames" [ -n "$short" ] && CMD="dpkg-query -W --showformat=\${Package}\n $pkg_filenames"
;; ;;
snappy)
CMD="snappy info"
;;
yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm) yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm)
CMD="rpm -qa $pkg_filenames" CMD="rpm -qa $pkg_filenames"
[ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames" [ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames"
...@@ -63,7 +67,11 @@ case $PMTYPE in ...@@ -63,7 +67,11 @@ case $PMTYPE in
return return
;; ;;
pkgng) pkgng)
CMD="pkg info -E $pkg_filenames" if [ -n "$pkg_filenames" ] ; then
CMD="pkg info -E $pkg_filenames"
else
CMD="pkg info"
fi
if [ -n "$short" ] ; then if [ -n "$short" ] ; then
docmd $CMD | sed -e "s| .*||g" | sed -e "s|-[0-9].*||g" docmd $CMD | sed -e "s| .*||g" | sed -e "s|-[0-9].*||g"
else else
...@@ -85,9 +93,9 @@ case $PMTYPE in ...@@ -85,9 +93,9 @@ case $PMTYPE in
conary) conary)
CMD="conary query" CMD="conary query"
;; ;;
# chocolatey) chocolatey)
# CMD="chocolatey list" CMD="chocolatey list"
# ;; ;;
slackpkg) slackpkg)
CMD="ls -1 /var/log/packages/" CMD="ls -1 /var/log/packages/"
if [ -n "$short" ] ; then if [ -n "$short" ] ; then
......
...@@ -22,10 +22,18 @@ load_helper epm-query_file ...@@ -22,10 +22,18 @@ load_helper epm-query_file
# Inspired by http://www.altlinux.org/Tips # Inspired by http://www.altlinux.org/Tips
epm_programs() epm_programs()
{ {
local DESKTOPDIR=/usr/share/applications case $DISTRNAME in
FreeBSD|NetBSD|OpenBSD|Solaris)
local DESKTOPDIR=/usr/local/share/applications
;;
*)
local DESKTOPDIR=/usr/share/applications
;;
esac
[ -d "$DESKTOPDIR" ] || fatal "There is no $DESKTOPDIR dir on the system." [ -d "$DESKTOPDIR" ] || fatal "There is no $DESKTOPDIR dir on the system."
#find /usr/share/applications -type f -name "*.desktop" | while read f; do pkg_files="$f" quiet=1 short=1 epm_query_file ; done | sort -u #find /usr/share/applications -type f -name "*.desktop" | while read f; do pkg_files="$f" quiet=1 short=1 epm_query_file ; done | sort -u
showcmd "find $DESKTOPDIR -type f -name "*.desktop" | xargs $0 -qf --quiet --short | sort -u" showcmd "find $DESKTOPDIR -type f -name "*.desktop" | xargs $0 -qf --quiet --short | sort -u"
find /usr/share/applications -type f -name "*.desktop" | \ find $DESKTOPDIR -type f -name "*.desktop" | \
xargs $0 -qf --quiet --short | sort -u xargs $0 -qf --quiet --short | sort -u
} }
...@@ -27,9 +27,11 @@ epm_provides_files() ...@@ -27,9 +27,11 @@ epm_provides_files()
case $PKGTYPE in case $PKGTYPE in
rpm) rpm)
assure_exists rpm
docmd rpm -q --provides -p $pkg_files docmd rpm -q --provides -p $pkg_files
;; ;;
deb) deb)
assure_exists dpkg
# FIXME: will we provide ourself? # FIXME: will we provide ourself?
docmd dpkg -I $pkg_files | grep "^ *Provides:" | sed "s|^ *Provides:||g" docmd dpkg -I $pkg_files | grep "^ *Provides:" | sed "s|^ *Provides:||g"
;; ;;
......
...@@ -34,6 +34,9 @@ epm_reinstall_names() ...@@ -34,6 +34,9 @@ epm_reinstall_names()
dnf-rpm) dnf-rpm)
sudocmd dnf reinstall $@ sudocmd dnf reinstall $@
return ;; return ;;
pkgng)
sudocmf pkg install -f $@
return ;;
slackpkg) slackpkg)
sudocmd_foreach "/usr/sbin/slackpkg reinstall" $@ sudocmd_foreach "/usr/sbin/slackpkg reinstall" $@
return ;; return ;;
......
...@@ -88,6 +88,9 @@ epm_remove_names() ...@@ -88,6 +88,9 @@ epm_remove_names()
dnf-rpm) dnf-rpm)
sudocmd dnf remove $@ sudocmd dnf remove $@
return ;; return ;;
snappy)
sudocmd snappy uninstall $@
return ;;
zypper-rpm) zypper-rpm)
sudocmd zypper remove $@ sudocmd zypper remove $@
return ;; return ;;
......
...@@ -22,7 +22,7 @@ epm_removerepo() ...@@ -22,7 +22,7 @@ epm_removerepo()
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
assure_exists apt-repo assure_exists apt-repo
sudocmd apt-repo rm $pkg_filenames sudocmd apt-repo rm "$pkg_filenames"
;; ;;
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
info "You need remove repo from /etc/apt/sources.list" info "You need remove repo from /etc/apt/sources.list"
...@@ -31,19 +31,19 @@ case $PMTYPE in ...@@ -31,19 +31,19 @@ case $PMTYPE in
info "You need remove repo from /etc/yum.repos.d/" info "You need remove repo from /etc/yum.repos.d/"
;; ;;
urpm-rpm) urpm-rpm)
sudocmd urpmi.removemedia $pkg_filenames sudocmd urpmi.removemedia "$pkg_filenames"
;; ;;
zypper-rpm) zypper-rpm)
sudocmd zypper removerepo $pkg_filenames sudocmd zypper removerepo "$pkg_filenames"
;; ;;
emerge) emerge)
sudocmd layman -d$pkg_filenames sudocmd layman "-d$pkg_filenames"
;; ;;
pacman) pacman)
info "You need remove repo from /etc/pacman.conf" info "You need remove repo from /etc/pacman.conf"
;; ;;
npackd) npackd)
sudocmd npackdcl remove-repo --url=$pkg_filenames sudocmd npackdcl remove-repo --url="$pkg_filenames"
;; ;;
slackpkg) slackpkg)
info "You need remove repo from /etc/slackpkg/mirrors" info "You need remove repo from /etc/slackpkg/mirrors"
......
...@@ -27,9 +27,11 @@ epm_requires_files() ...@@ -27,9 +27,11 @@ epm_requires_files()
case "$PKGTYPE" in case "$PKGTYPE" in
rpm) rpm)
assure_exists rpm
docmd rpm -q --requires -p $pkg_files docmd rpm -q --requires -p $pkg_files
;; ;;
deb) deb)
assure_exists dpkg
a= docmd dpkg -I $pkg_files | grep "^ *Depends:" | sed "s|^ *Depends:||g" a= docmd dpkg -I $pkg_files | grep "^ *Depends:" | sed "s|^ *Depends:||g"
;; ;;
*) *)
......
...@@ -29,7 +29,8 @@ __alt_local_content_search() ...@@ -29,7 +29,8 @@ __alt_local_content_search()
{ {
[ -n "$USETTY" ] && echo "Search in $CI for $1..." [ -n "$USETTY" ] && echo "Search in $CI for $1..."
grep -h -- ".*$1.*\t" $CI | sed -e "s|\(.*\)\t\(.*\)|\2: \1|g" # note! tabulation below!
grep -h -- ".*$1.* " $CI | sed -e "s|\(.*\)\t\(.*\)|\2: \1|g"
} | $OUTCMD } | $OUTCMD
} }
......
...@@ -142,6 +142,7 @@ sudocmd() ...@@ -142,6 +142,7 @@ sudocmd()
} }
# Run every arg with sudocmd # Run every arg with sudocmd
# Returns on any error
sudocmd_foreach() sudocmd_foreach()
{ {
local cmd pkg local cmd pkg
...@@ -149,7 +150,7 @@ sudocmd_foreach() ...@@ -149,7 +150,7 @@ sudocmd_foreach()
#showcmd "$@" #showcmd "$@"
shift shift
for pkg in "$@" ; do for pkg in "$@" ; do
sudocmd "$cmd" $pkg sudocmd "$cmd" $pkg || return
done done
} }
...@@ -261,6 +262,12 @@ set_sudo() ...@@ -261,6 +262,12 @@ set_sudo()
SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'" SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'"
} }
withtimeout()
{
local TO=$(which timeout 2>/dev/null || which gtimeout 2>/dev/null)
[ -n "$TO" ] && $TO $@ || $@
}
set_eatmydata() set_eatmydata()
{ {
# skip if disabled # skip if disabled
...@@ -290,10 +297,15 @@ assure_exists() ...@@ -290,10 +297,15 @@ assure_exists()
load_helper epm-assure load_helper epm-assure
local package="$2" local package="$2"
[ -n "$package" ] || package="$(__get_package_for_command "$1")" [ -n "$package" ] || package="$(__get_package_for_command "$1")"
__epm_assure "$1" $package __epm_assure "$1" $package || fatal "Can't assure in '$1' command"
}
eget()
{
$PROGDIR/epm-eget "$@"
} }
# improve # TODO: improve and drop!
get_package_type() get_package_type()
{ {
local i local i
...@@ -314,6 +326,14 @@ get_package_type() ...@@ -314,6 +326,14 @@ get_package_type()
echo "tbz" echo "tbz"
return return
;; ;;
*.exe)
echo "exe"
return
;;
*.msi)
echo "msi"
return
;;
*) *)
#fatal "Don't know type of $1" #fatal "Don't know type of $1"
# return package name for info # return package name for info
...@@ -363,6 +383,7 @@ case $DISTRNAME in ...@@ -363,6 +383,7 @@ case $DISTRNAME in
Ubuntu|Debian|Mint) Ubuntu|Debian|Mint)
CMD="apt-dpkg" CMD="apt-dpkg"
#which aptitude 2>/dev/null >/dev/null && CMD=aptitude-dpkg #which aptitude 2>/dev/null >/dev/null && CMD=aptitude-dpkg
which snappy 2>/dev/null >/dev/null && CMD=snappy
;; ;;
Mandriva|ROSA) Mandriva|ROSA)
CMD="urpm-rpm" CMD="urpm-rpm"
......
...@@ -33,6 +33,9 @@ case $PMTYPE in ...@@ -33,6 +33,9 @@ case $PMTYPE in
#sudocmd apt-get -f install || exit #sudocmd apt-get -f install || exit
#sudocmd apt-get autoremove #sudocmd apt-get autoremove
;; ;;
#snappy)
# sudocmd snappy
# ;;
aptitude-dpkg) aptitude-dpkg)
sudocmd aptitude update || exit sudocmd aptitude update || exit
;; ;;
......
...@@ -44,6 +44,9 @@ epm_upgrade() ...@@ -44,6 +44,9 @@ epm_upgrade()
dnf-rpm) dnf-rpm)
CMD="dnf update" CMD="dnf update"
;; ;;
snappy)
CMD="snappy update"
;;
urpm-rpm) urpm-rpm)
# or --auto-select --replace-files # or --auto-select --replace-files
CMD="urpmi --auto-update" CMD="urpmi --auto-update"
......
...@@ -27,7 +27,10 @@ serv_enable() ...@@ -27,7 +27,10 @@ serv_enable()
is_service_autostart $1 && echo "Service $1 already enabled for startup" && return is_service_autostart $1 && echo "Service $1 already enabled for startup" && return
case $SERVICETYPE in case $SERVICETYPE in
service-chkconfig|service-upstart) service-chkconfig)
sudocmd chkconfig --add $1
;;
service-upstart)
sudocmd chkconfig $1 on sudocmd chkconfig $1 on
;; ;;
service-initd|service-update) service-initd|service-update)
......
# 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.4 Version: 1.5.7
Release: alt0.M70P.1 Release: alt0.M70P.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
...@@ -41,7 +41,8 @@ See detailed description here: http://wiki.etersoft.ru/EPM ...@@ -41,7 +41,8 @@ See detailed description here: http://wiki.etersoft.ru/EPM
%install %install
# install to datadir and so on # install to datadir and so on
%makeinstall_std datadir=%_datadir bindir=%_bindir mandir=%_mandir version=%version-%release # do not use uncommon makeinstall_std here
%make_install install DESTDIR=%buildroot datadir=%_datadir bindir=%_bindir mandir=%_mandir version=%version-%release
install -m 0755 packed/epm.sh %buildroot/%_datadir/%name/epm-packed.sh install -m 0755 packed/epm.sh %buildroot/%_datadir/%name/epm-packed.sh
install -m 0755 packed/serv.sh %buildroot/%_datadir/%name/serv-packed.sh install -m 0755 packed/serv.sh %buildroot/%_datadir/%name/serv-packed.sh
...@@ -66,9 +67,30 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}* ...@@ -66,9 +67,30 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv %_sysconfdir/bash_completion.d/cerv
%changelog %changelog
* Wed Jun 04 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.4-alt0.M70P.1 * Wed Dec 17 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.7-alt0.M70P.1
- backport to ALTLinux p7 (by rpmbph script) - backport to ALTLinux p7 (by rpmbph script)
* Fri Dec 05 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.7-alt1
- checkpkg: add msi checking
- epm-packages: fix --sort
- serv-enable: assure chkconfig add
- autoremove: do not remove libnss-*, *debuginfo
- fatal exit if assure_exists is failed
- epm: fix search file in ALT Linux repo
- epm: add 'epm s' like epms
- initial eget commit
* Thu Jul 17 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.6-alt1
- assure we have a command rpm/dpkg when work with a package file
- fix for use package name list in quotes
- fix build without rpm-build-altlinux-compat
* Sat Jun 07 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.5-alt1
- fix epmqp, epm clean for FreeBSD
- epm programs: use /usr/local/share/applications on BSD systems
- epm reinstall: add pkgng support
- fix timeout using on FreeBSD
* Wed Jun 04 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.4-alt1 * Wed Jun 04 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.4-alt1
- add initial support for FreeBSD's pkgng - add initial support for FreeBSD's pkgng
- add audit command for check installed packages against known vulnerabilities - add audit command for check installed packages against known vulnerabilities
......
...@@ -155,7 +155,7 @@ sudocmd_foreach() ...@@ -155,7 +155,7 @@ sudocmd_foreach()
#showcmd "$@" #showcmd "$@"
shift shift
for pkg in "$@" ; do for pkg in "$@" ; do
sudocmd "$cmd" $pkg sudocmd "$cmd" $pkg || return
done done
} }
...@@ -259,6 +259,12 @@ set_sudo() ...@@ -259,6 +259,12 @@ set_sudo()
SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'" SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'"
} }
withtimeout()
{
local TO=$(which timeout 2>/dev/null || which gtimeout 2>/dev/null)
[ -n "$TO" ] && $TO $@ || $@
}
set_eatmydata() set_eatmydata()
{ {
# skip if disabled # skip if disabled
...@@ -287,7 +293,12 @@ assure_exists() ...@@ -287,7 +293,12 @@ assure_exists()
load_helper epm-assure load_helper epm-assure
local package="$2" local package="$2"
[ -n "$package" ] || package="$(__get_package_for_command "$1")" [ -n "$package" ] || package="$(__get_package_for_command "$1")"
__epm_assure "$1" $package __epm_assure "$1" $package || fatal "Can't assure in '$1' command"
}
eget()
{
$PROGDIR/epm-eget "$@"
} }
get_package_type() get_package_type()
...@@ -310,6 +321,14 @@ get_package_type() ...@@ -310,6 +321,14 @@ get_package_type()
echo "tbz" echo "tbz"
return return
;; ;;
*.exe)
echo "exe"
return
;;
*.msi)
echo "msi"
return
;;
*) *)
#fatal "Don't know type of $1" #fatal "Don't know type of $1"
# return package name for info # return package name for info
...@@ -466,7 +485,10 @@ serv_enable() ...@@ -466,7 +485,10 @@ serv_enable()
is_service_autostart $1 && echo "Service $1 already enabled for startup" && return is_service_autostart $1 && echo "Service $1 already enabled for startup" && return
case $SERVICETYPE in case $SERVICETYPE in
service-chkconfig|service-upstart) service-chkconfig)
sudocmd chkconfig --add $1
;;
service-upstart)
sudocmd chkconfig $1 on sudocmd chkconfig $1 on
;; ;;
service-initd|service-update) service-initd|service-update)
...@@ -1112,7 +1134,7 @@ $(get_help HELPOPT) ...@@ -1112,7 +1134,7 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "Service manager version 1.5.4" echo "Service manager version 1.5.7"
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."
......
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