Commit f207ecba authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents 8aa6e725 775185b4
add epm site / epmurl in replace to rpmurl
yum remove $(package-cleanup --orphans
https://github.com/biow0lf/prometheus-cli
$ ruby prometheus-cli.rb srpm openbox
Branch: Sisyphus
Name: openbox
Version: 3.5.0
Release: alt5
http://packages.altlinux.org/api_doc/
См. описание алгоритма установки с URL
строки в кавычках до rr (удаления репозитория) и добавления репозитория не доходят
dotty - через ссылки на реальные названия (epm req верхнего уровня) dotty - через ссылки на реальные названия (epm req верхнего уровня)
менеджер пакетов из NetBSD — pkgsrc (команды для поиска нужных пакетов – pkgin update; pkgin avail; pkgin search). менеджер пакетов из NetBSD — pkgsrc (команды для поиска нужных пакетов – pkgin update; pkgin avail; pkgin search).
Загрузку конфига Загрузку конфига
Установку пакета по URL
Использование | less теряет код возврата команды. Нужно сделать nobash решение, которое сохранит статус Использование | less теряет код возврата команды. Нужно сделать nobash решение, которое сохранит статус
Команда Команда
docmdmore docmdmore
...@@ -14,24 +32,21 @@ docmdmore ...@@ -14,24 +32,21 @@ docmdmore
Установка (для отсутствующих файлов пакетов) и удаление (в любом случае) должны производиться с укороченными именами (которые воспримет верхний уровень) Установка (для отсутствующих файлов пакетов) и удаление (в любом случае) должны производиться с укороченными именами (которые воспримет верхний уровень)
Чтобы было легко выстраивать цепочки, нужно ввод не с консоли (если есть) воспринимать как параметры. Дописать таблицу на вики на основании реализованных команд.
То же для EPM
2. Дописать таблицу на вики на основании реализованных команд. Было предложение вывернуть:
3. Доделать и проверить deplist|requires
https://wiki.archlinux.org/index.php/Pacman_Rosetta
Вывернуть:
Не case по каждой системе, а в каталоге по каждой системе разместить файлы, выполняющие нужные действия. Не case по каждой системе, а в каталоге по каждой системе разместить файлы, выполняющие нужные действия.
apt-rpm/install apt-rpm/install
apt-rpm/remove apt-rpm/remove
при упаковке лучше собирать в один файл. при упаковке лучше собирать в один файл.
<<<<<<< HEAD
Внесто общих функций тоже модули. Внесто общих функций тоже модули.
<<<<<<< HEAD <<<<<<< HEAD
======= =======
=======
>>>>>>> master
serv должен уметь показывать порядок загрузки? serv должен уметь показывать порядок загрузки?
>>>>>>> master >>>>>>> master
...@@ -79,6 +79,7 @@ skip_installed= ...@@ -79,6 +79,7 @@ skip_installed=
show_command_only= show_command_only=
epm_cmd= epm_cmd=
pkg_files= pkg_files=
pkg_dirs=
pkg_names= pkg_names=
pkg_urls= pkg_urls=
quoted_args= quoted_args=
...@@ -89,6 +90,9 @@ case $progname in ...@@ -89,6 +90,9 @@ case $progname in
epmi) epmi)
epm_cmd=install epm_cmd=install
;; ;;
epmI)
epm_cmd=Install
;;
epme) epme)
epm_cmd=remove epm_cmd=remove
;; ;;
...@@ -230,6 +234,9 @@ check_command() ...@@ -230,6 +234,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
;; ;;
...@@ -239,6 +246,9 @@ check_command() ...@@ -239,6 +246,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
;; ;;
...@@ -309,8 +319,10 @@ check_filenames() ...@@ -309,8 +319,10 @@ check_filenames()
# files can be with full path or have extension via . # files can be with full path or have extension via .
if [ -f "$opt" ] && echo "$opt" | grep -q "[/\.]" ; then if [ -f "$opt" ] && echo "$opt" | grep -q "[/\.]" ; then
pkg_files="$pkg_files $opt" pkg_files="$pkg_files $opt"
elif [ -d "$opt" ] ; then
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
...@@ -337,7 +349,9 @@ if ! inputisatty ; then ...@@ -337,7 +349,9 @@ if ! inputisatty ; then
fi fi
pkg_files=$(strip_spaces "$pkg_files") pkg_files=$(strip_spaces "$pkg_files")
pkg_names=$(strip_spaces "$pkg_names") pkg_dirs=$(strip_spaces "$pkg_dirs")
# 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_names") pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2013, 2014 Etersoft # Copyright (C) 2013, 2014, 2015 Etersoft
# Copyright (C) 2013, 2014 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2013, 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
...@@ -17,15 +17,27 @@ ...@@ -17,15 +17,27 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
load_helper epm-install
__check_command_in_path() __check_command_in_path()
{ {
PATH=$PATH:/sbin:/usr/sbin which "$1" 2>/dev/null PATH=$PATH:/sbin:/usr/sbin which "$1" 2>/dev/null
} }
# copied from strings
# CHECKME: the same like estrlist has ?
# Note: used egrep! write '[0-9]+(first|two)', not '[0-9]\+...'
rhas()
{
echo "$1" | egrep -q -- "$2"
}
# copied from strings
is_dirpath()
{
[ "$1" = "." ] && return $?
rhas "$1" "/"
}
# Do fast checking for command and install package if the command does not exist # Do fast checking for command and install package if the command does not exist
# $1 - command name # $1 - command name
...@@ -33,6 +45,23 @@ __check_command_in_path() ...@@ -33,6 +45,23 @@ __check_command_in_path()
__epm_assure() __epm_assure()
{ {
if is_dirpath "$1" ; then
if [ -r "$1" ] ; then
if [ -n "$verbose" ] ; then
info "File $1 is exists."
epm qf "$1"
fi
return 0
fi
[ -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"
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")"
...@@ -45,6 +74,10 @@ __epm_assure() ...@@ -45,6 +74,10 @@ __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 #epm install $2
......
#!/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/>.
#
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
}
...@@ -39,10 +39,11 @@ epm_autoremove() ...@@ -39,10 +39,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)
...@@ -61,17 +62,19 @@ case $PMTYPE in ...@@ -61,17 +62,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
......
...@@ -51,7 +51,7 @@ __epm_changelog_local_names() ...@@ -51,7 +51,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)
......
...@@ -58,6 +58,9 @@ epm_downgrade() ...@@ -58,6 +58,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
......
#!/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/>.
#
epm_download()
{
local CMD
case $PMTYPE in
dnf-rpm)
sudocmd dnf download $pkg_filename
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
...@@ -49,6 +49,11 @@ __epm_filelist_remote() ...@@ -49,6 +49,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"
;; ;;
...@@ -130,6 +135,7 @@ __epm_filelist_name() ...@@ -130,6 +135,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
} }
......
...@@ -190,6 +190,9 @@ epm_ni_install_names() ...@@ -190,6 +190,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 ;;
...@@ -407,12 +410,17 @@ epm_install() ...@@ -407,12 +410,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
......
...@@ -21,6 +21,7 @@ load_helper epm-query ...@@ -21,6 +21,7 @@ load_helper epm-query
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)"
...@@ -44,6 +45,7 @@ epm_provides_files() ...@@ -44,6 +45,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
...@@ -102,6 +104,6 @@ epm_provides() ...@@ -102,6 +104,6 @@ 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
} }
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
load_helper epm-search_file
# copied from etersoft-build-utils/bin/rpmqf # copied from etersoft-build-utils/bin/rpmqf
# use and modify TOFILE recursively # use and modify TOFILE recursively
...@@ -73,7 +71,7 @@ __do_query() ...@@ -73,7 +71,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)
...@@ -147,14 +145,17 @@ epm_query_file() ...@@ -147,14 +145,17 @@ epm_query_file()
# TODO: move to separate command? # TODO: move to separate command?
# FIXME: it is possible use query # FIXME: it is possible use query
if [ -n "$short" ] ; then if [ -n "$short" ] ; then
[ -n "$pkg_files" ] || fatal "Run query without file names (needed path to files)" [ -n "$pkg_files$pkg_dirs" ] || fatal "Run query without file names (needed path to files)"
__do_short_query $pkg_files __do_short_query $pkg_files $pkg_dirs
return return
fi fi
# file can exists or not # file can exists or not
[ -n "$pkg_filenames" ] || fatal "Run query without file names" [ -n "$pkg_filenames" ] || fatal "Run query without file names"
load_helper epm-search_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
......
...@@ -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 "$quoted_args"
;; ;;
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"
......
...@@ -21,6 +21,7 @@ load_helper epm-query ...@@ -21,6 +21,7 @@ load_helper epm-query
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)"
...@@ -42,6 +43,7 @@ epm_requires_files() ...@@ -42,6 +43,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
...@@ -101,6 +103,6 @@ docmd $CMD $pkg_names ...@@ -101,6 +103,6 @@ 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
} }
...@@ -96,6 +96,7 @@ esac ...@@ -96,6 +96,7 @@ esac
docmd $CMD $string docmd $CMD $string
} }
# TODO: use ^ as first word, use ~ for negate, for epmqp too
# produce grep sequence # produce grep sequence
__epm_search_make_grep() __epm_search_make_grep()
{ {
......
...@@ -49,7 +49,7 @@ check_tty() ...@@ -49,7 +49,7 @@ check_tty()
# egrep from busybox may not --color # egrep from busybox may not --color
# egrep from MacOS print help to stderr # egrep from MacOS print help to stderr
if egrep --help 2>&1 | grep -q -- "--color" ; then if egrep --help 2>&1 | grep -q -- "--color" ; then
EGREPCOLOR="--color" export EGREPCOLOR="--color"
fi fi
which tput >/dev/null 2>/dev/null || return which tput >/dev/null 2>/dev/null || return
...@@ -262,10 +262,18 @@ set_sudo() ...@@ -262,10 +262,18 @@ 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.'"
} }
# wait for n seconds (if possible) during executing command
# args: seconds command
withtimeout() withtimeout()
{ {
local TO=$(which timeout 2>/dev/null || which gtimeout 2>/dev/null) local TO=$(which timeout 2>/dev/null || which gtimeout 2>/dev/null)
[ -n "$TO" ] && $TO $@ || $@ if [ -x "$TO" ] ; then
$TO $@
return
fi
# fallback: drop time arg and run without timeout
shift
$@
} }
set_eatmydata() set_eatmydata()
...@@ -292,6 +300,7 @@ __get_package_for_command() ...@@ -292,6 +300,7 @@ __get_package_for_command()
esac esac
} }
# TODO: we we can't use epm directly?
assure_exists() assure_exists()
{ {
load_helper epm-assure load_helper epm-assure
...@@ -302,7 +311,7 @@ assure_exists() ...@@ -302,7 +311,7 @@ assure_exists()
eget() eget()
{ {
$PROGDIR/epm-eget "$@" $SHAREDIR/tools-eget "$@"
} }
# TODO: improve and drop! # TODO: improve and drop!
...@@ -400,7 +409,7 @@ case $DISTRNAME in ...@@ -400,7 +409,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"
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2014 Etersoft # Copyright (C) 2012-2015 Etersoft
# Copyright (C) 2012-2014 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-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
...@@ -38,6 +38,8 @@ __check_yum_result() ...@@ -38,6 +38,8 @@ __check_yum_result()
grep "^Complete!" $1 && return 0 grep "^Complete!" $1 && return 0
grep "^Exiting on user Command" $1 && return 0 grep "^Exiting on user Command" $1 && return 0
grep "^Exiting on user command" $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
} }
...@@ -78,6 +80,12 @@ EOF ...@@ -78,6 +80,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"
;; ;;
......
...@@ -40,7 +40,12 @@ case $PMTYPE in ...@@ -40,7 +40,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
......
epm
\ No newline at end of file
...@@ -161,7 +161,9 @@ check_command() ...@@ -161,7 +161,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
......
...@@ -28,9 +28,11 @@ serv_enable() ...@@ -28,9 +28,11 @@ serv_enable()
case $SERVICETYPE in case $SERVICETYPE in
service-chkconfig) service-chkconfig)
sudocmd chkconfig --add $1 sudocmd chkconfig --add $1 || return
sudocmd chkconfig $1 on
;; ;;
service-upstart) service-upstart)
sudocmd chkconfig --add $1 || return
sudocmd chkconfig $1 on sudocmd chkconfig $1 on
;; ;;
service-initd|service-update) service-initd|service-update)
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 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 serv-status
# Restart service (start if it was not running)
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
}
...@@ -41,10 +41,11 @@ is_service_autostart() ...@@ -41,10 +41,11 @@ is_service_autostart()
{ {
case $SERVICETYPE in case $SERVICETYPE in
service-chkconfig|service-upstart) service-chkconfig|service-upstart)
LANG=C $SUDO chkconfig $1 --list | grep -q "5:on" # FIXME: check for current runlevel
LANG=C $SUDO chkconfig $1 --list | grep -q "[35]:on"
;; ;;
service-initd|service-update) service-initd|service-update)
fatal "FIXME: don't know how detect current startup state" test -L $(echo /etc/rc5.d/S??$1)
;; ;;
systemd) systemd)
$SUDO systemctl is-enabled $1 $SUDO systemctl is-enabled $1
......
# 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.8 Version: 1.5.13
Release: alt0.M70P.1 Release: alt0.M70P.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
...@@ -67,9 +67,39 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}* ...@@ -67,9 +67,39 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv %_sysconfdir/bash_completion.d/cerv
%changelog %changelog
* Wed Dec 24 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.8-alt0.M70P.1 * Tue Jul 21 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.13-alt0.M70P.1
- backport to ALTLinux p7 (by rpmbph script) - backport to ALTLinux p7 (by rpmbph script)
* 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
- small fixes
* Fri Jul 10 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.12-alt1
- epm: initial download package support
- fix update and simulate for dnf
- allow changelog and query file for dnf
- install: allow return command for dnf
- use dnf only if /var/lib/dnf/yumdb is exists
* Thu Jul 09 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.11-alt1
- epm-filelist: add support file list for noninstalled packages on deb
- introduce autoorphans command
- epm-install: add workaround to fix urls works
- fix behaviour when has dir with the same name like package
- serv: implement native restart
- use dnf on Fedora if exists
* Wed Feb 25 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.10-alt1
- serv-status: realize detection scheduled status for Ubuntu
- epm-sh: fix withtimeout
* Sat Feb 21 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.9-alt1
- fix withtimeout (was incorrect workaround)
- remove epm-eget -> tools-eget for exclude from one pack file
- add epmI == epm Install
- serv-enable: use chkconfig --add and chkconfig SERVICE on
- query_file: fix for dirs
* Wed Dec 24 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.8-alt1 * Wed Dec 24 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.8-alt1
- add initial snappy support - add initial snappy support
- remove extra deps - remove extra deps
......
...@@ -65,7 +65,7 @@ check_tty() ...@@ -65,7 +65,7 @@ check_tty()
# egrep from busybox may not --color # egrep from busybox may not --color
# egrep from MacOS print help to stderr # egrep from MacOS print help to stderr
if egrep --help 2>&1 | grep -q -- "--color" ; then if egrep --help 2>&1 | grep -q -- "--color" ; then
EGREPCOLOR="--color" export EGREPCOLOR="--color"
fi fi
which tput >/dev/null 2>/dev/null || return which tput >/dev/null 2>/dev/null || return
...@@ -264,7 +264,13 @@ set_sudo() ...@@ -264,7 +264,13 @@ set_sudo()
withtimeout() withtimeout()
{ {
local TO=$(which timeout 2>/dev/null || which gtimeout 2>/dev/null) local TO=$(which timeout 2>/dev/null || which gtimeout 2>/dev/null)
[ -n "$TO" ] && $TO $@ || $@ if [ -x "$TO" ] ; then
$TO $@
return
fi
# fallback: drop time arg and run without timeout
shift
$@
} }
set_eatmydata() set_eatmydata()
...@@ -300,7 +306,7 @@ assure_exists() ...@@ -300,7 +306,7 @@ assure_exists()
eget() eget()
{ {
$PROGDIR/epm-eget "$@" $PROGDIR/tools-eget "$@"
} }
get_package_type() get_package_type()
...@@ -472,8 +478,6 @@ esac ...@@ -472,8 +478,6 @@ esac
# File bin/epm-assure: # File bin/epm-assure:
__check_command_in_path() __check_command_in_path()
{ {
PATH=$PATH:/sbin:/usr/sbin which "$1" 2>/dev/null PATH=$PATH:/sbin:/usr/sbin which "$1" 2>/dev/null
...@@ -496,6 +500,8 @@ __epm_assure() ...@@ -496,6 +500,8 @@ __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 #epm install $2
...@@ -1044,43 +1050,6 @@ epm_downgrade() ...@@ -1044,43 +1050,6 @@ epm_downgrade()
esac esac
} }
# File bin/epm-eget:
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
# File bin/epm-filelist: # File bin/epm-filelist:
...@@ -2206,7 +2175,6 @@ epm_query() ...@@ -2206,7 +2175,6 @@ epm_query()
# File bin/epm-query_file: # File bin/epm-query_file:
__do_query_real_file() __do_query_real_file()
{ {
local LINKTO1 LINKTO local LINKTO1 LINKTO
...@@ -2332,14 +2300,17 @@ epm_query_file() ...@@ -2332,14 +2300,17 @@ epm_query_file()
# TODO: move to separate command? # TODO: move to separate command?
# FIXME: it is possible use query # FIXME: it is possible use query
if [ -n "$short" ] ; then if [ -n "$short" ] ; then
[ -n "$pkg_files" ] || fatal "Run query without file names (needed path to files)" [ -n "$pkg_files$pkg_dirs" ] || fatal "Run query without file names (needed path to files)"
__do_short_query $pkg_files __do_short_query $pkg_files $pkg_dirs
return return
fi fi
# file can exists or not # file can exists or not
[ -n "$pkg_filenames" ] || fatal "Run query without file names" [ -n "$pkg_filenames" ] || fatal "Run query without file names"
load_helper epm-search_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
...@@ -2700,7 +2671,7 @@ epm_removerepo() ...@@ -2700,7 +2671,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 "$quoted_args"
;; ;;
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"
...@@ -3792,7 +3763,7 @@ $(get_help HELPOPT) ...@@ -3792,7 +3763,7 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "EPM package manager version 1.5.8" echo "EPM package manager version 1.5.10"
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-2014"
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."
...@@ -3815,6 +3786,7 @@ skip_installed= ...@@ -3815,6 +3786,7 @@ skip_installed=
show_command_only= show_command_only=
epm_cmd= epm_cmd=
pkg_files= pkg_files=
pkg_dirs=
pkg_names= pkg_names=
pkg_urls= pkg_urls=
quoted_args= quoted_args=
...@@ -3825,6 +3797,9 @@ case $progname in ...@@ -3825,6 +3797,9 @@ case $progname in
epmi) epmi)
epm_cmd=install epm_cmd=install
;; ;;
epmI)
epm_cmd=Install
;;
epme) epme)
epm_cmd=remove epm_cmd=remove
;; ;;
...@@ -4045,6 +4020,8 @@ check_filenames() ...@@ -4045,6 +4020,8 @@ check_filenames()
# files can be with full path or have extension via . # files can be with full path or have extension via .
if [ -f "$opt" ] && echo "$opt" | grep -q "[/\.]" ; then if [ -f "$opt" ] && echo "$opt" | grep -q "[/\.]" ; then
pkg_files="$pkg_files $opt" pkg_files="$pkg_files $opt"
elif [ -d "$opt" ] ; then
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_names $opt"
else else
...@@ -4073,10 +4050,11 @@ if ! inputisatty ; then ...@@ -4073,10 +4050,11 @@ if ! inputisatty ; then
fi fi
pkg_files=$(strip_spaces "$pkg_files") pkg_files=$(strip_spaces "$pkg_files")
pkg_dirs=$(strip_spaces "$pkg_dirs")
pkg_names=$(strip_spaces "$pkg_names") pkg_names=$(strip_spaces "$pkg_names")
pkg_urls=$(strip_spaces "$pkg_urls") pkg_urls=$(strip_spaces "$pkg_urls")
pkg_filenames=$(strip_spaces "$pkg_files $pkg_names") pkg_filenames=$(strip_spaces "$pkg_files $pkg_dirs $pkg_names")
# Just debug # Just debug
#echover "command: $epm_cmd" #echover "command: $epm_cmd"
......
...@@ -63,7 +63,7 @@ check_tty() ...@@ -63,7 +63,7 @@ check_tty()
# egrep from busybox may not --color # egrep from busybox may not --color
# egrep from MacOS print help to stderr # egrep from MacOS print help to stderr
if egrep --help 2>&1 | grep -q -- "--color" ; then if egrep --help 2>&1 | grep -q -- "--color" ; then
EGREPCOLOR="--color" export EGREPCOLOR="--color"
fi fi
which tput >/dev/null 2>/dev/null || return which tput >/dev/null 2>/dev/null || return
...@@ -262,7 +262,13 @@ set_sudo() ...@@ -262,7 +262,13 @@ set_sudo()
withtimeout() withtimeout()
{ {
local TO=$(which timeout 2>/dev/null || which gtimeout 2>/dev/null) local TO=$(which timeout 2>/dev/null || which gtimeout 2>/dev/null)
[ -n "$TO" ] && $TO $@ || $@ if [ -x "$TO" ] ; then
$TO $@
return
fi
# fallback: drop time arg and run without timeout
shift
$@
} }
set_eatmydata() set_eatmydata()
...@@ -298,7 +304,7 @@ assure_exists() ...@@ -298,7 +304,7 @@ assure_exists()
eget() eget()
{ {
$PROGDIR/epm-eget "$@" $PROGDIR/tools-eget "$@"
} }
get_package_type() get_package_type()
...@@ -487,9 +493,11 @@ serv_enable() ...@@ -487,9 +493,11 @@ serv_enable()
case $SERVICETYPE in case $SERVICETYPE in
service-chkconfig) service-chkconfig)
sudocmd chkconfig --add $1 sudocmd chkconfig --add $1 || return
sudocmd chkconfig $1 on
;; ;;
service-upstart) service-upstart)
sudocmd chkconfig --add $1 || return
sudocmd chkconfig $1 on sudocmd chkconfig $1 on
;; ;;
service-initd|service-update) service-initd|service-update)
...@@ -613,10 +621,11 @@ is_service_autostart() ...@@ -613,10 +621,11 @@ is_service_autostart()
{ {
case $SERVICETYPE in case $SERVICETYPE in
service-chkconfig|service-upstart) service-chkconfig|service-upstart)
LANG=C $SUDO chkconfig $1 --list | grep -q "5:on" # FIXME: check for current runlevel
LANG=C $SUDO chkconfig $1 --list | grep -q "[35]:on"
;; ;;
service-initd|service-update) service-initd|service-update)
fatal "FIXME: don't know how detect current startup state" test -L $(echo /etc/rc5.d/S??$1)
;; ;;
systemd) systemd)
$SUDO systemctl is-enabled $1 $SUDO systemctl is-enabled $1
...@@ -1138,7 +1147,7 @@ $(get_help HELPOPT) ...@@ -1138,7 +1147,7 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "Service manager version 1.5.8" echo "Service manager version 1.5.10"
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