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 верхнего уровня)
менеджер пакетов из NetBSD — pkgsrc (команды для поиска нужных пакетов – pkgin update; pkgin avail; pkgin search).
Загрузку конфига
Установку пакета по URL
Использование | less теряет код возврата команды. Нужно сделать nobash решение, которое сохранит статус
Команда
docmdmore
......@@ -14,24 +32,21 @@ docmdmore
Установка (для отсутствующих файлов пакетов) и удаление (в любом случае) должны производиться с укороченными именами (которые воспримет верхний уровень)
Чтобы было легко выстраивать цепочки, нужно ввод не с консоли (если есть) воспринимать как параметры.
То же для EPM
Дописать таблицу на вики на основании реализованных команд.
2. Дописать таблицу на вики на основании реализованных команд.
3. Доделать и проверить deplist|requires
https://wiki.archlinux.org/index.php/Pacman_Rosetta
Вывернуть:
Было предложение вывернуть:
Не case по каждой системе, а в каталоге по каждой системе разместить файлы, выполняющие нужные действия.
apt-rpm/install
apt-rpm/remove
при упаковке лучше собирать в один файл.
<<<<<<< HEAD
Внесто общих функций тоже модули.
<<<<<<< HEAD
=======
=======
>>>>>>> master
serv должен уметь показывать порядок загрузки?
>>>>>>> master
......@@ -79,6 +79,7 @@ skip_installed=
show_command_only=
epm_cmd=
pkg_files=
pkg_dirs=
pkg_names=
pkg_urls=
quoted_args=
......@@ -89,6 +90,9 @@ case $progname in
epmi)
epm_cmd=install
;;
epmI)
epm_cmd=Install
;;
epme)
epm_cmd=remove
;;
......@@ -230,6 +234,9 @@ check_command()
autoremove) # HELPCMD: auto remove unneeded package(s)
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
epm_cmd=upgrade
;;
......@@ -239,6 +246,9 @@ check_command()
downgrade) # HELPCMD: downgrade [all] packages to the repo state
epm_cmd=downgrade
;;
download) # HELPCMD: download package(s) file to the current dir
epm_cmd=download
;;
simulate) # HELPCMD: simulate install with check requires
epm_cmd=simulate
;;
......@@ -309,8 +319,10 @@ check_filenames()
# files can be with full path or have extension via .
if [ -f "$opt" ] && echo "$opt" | grep -q "[/\.]" ; then
pkg_files="$pkg_files $opt"
elif [ -d "$opt" ] ; then
pkg_dirs="$pkg_dirs $opt"
elif echo "$opt" | grep -q "://" ; then
pkg_urls="$pkg_names $opt"
pkg_urls="$pkg_urls $opt"
else
pkg_names="$pkg_names $opt"
fi
......@@ -337,7 +349,9 @@ if ! inputisatty ; then
fi
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_filenames=$(strip_spaces "$pkg_files $pkg_names")
......
#!/bin/sh
#
# Copyright (C) 2013, 2014 Etersoft
# Copyright (C) 2013, 2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2013, 2014, 2015 Etersoft
# Copyright (C) 2013, 2014, 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
......@@ -17,15 +17,27 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-install
__check_command_in_path()
{
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
# $1 - command name
......@@ -33,6 +45,23 @@ __check_command_in_path()
__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 [ -n "$verbose" ] ; then
local compath="$(__check_command_in_path "$1")"
......@@ -45,6 +74,10 @@ __epm_assure()
# TODO: use package name normalization
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"
[ -n "$PACKAGE" ] || PACKAGE="$1"
#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()
{
case $PMTYPE in
apt-rpm)
assure_exists remove-old-kernels
# ALT Linux only
__epm_autoremove_altrpm
# ALT Linux only
assure_exists remove-old-kernels
sudocmd remove-old-kernels
;;
apt-dpkg|aptitude-dpkg)
......@@ -61,17 +62,19 @@ case $PMTYPE in
sudocmd yum remove $PKGLIST
done
;;
urpm-rpm)
sudocmd urpme --auto-orphans
;;
# see autoorhans
#urpm-rpm)
# sudocmd urpme --auto-orphans
# ;;
emerge)
sudocmd emerge --depclean
assure_exists revdep-rebuild
sudocmd revdep-rebuild
;;
pacman)
sudocmd pacman -Qdtq | sudocmd pacman -Rs -
;;
# see autoorhans
#pacman)
# sudocmd pacman -Qdtq | sudocmd pacman -Rs -
# ;;
slackpkg)
# clean-system removes non official packages
#sudocmd slackpkg clean-system
......
......@@ -51,7 +51,7 @@ __epm_changelog_local_names()
[ -z "$*" ] && return
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
;;
apt-dpkg|aptitude-dpkg)
......
......@@ -58,6 +58,9 @@ epm_downgrade()
# can do update repobase automagically
sudocmd yum downgrade $pkg_filename
;;
dnf-rpm)
sudocmd dnf downgrade $pkg_filename
;;
urpm-rpm)
assure_exists urpm-reposync urpm-tools
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()
# TODO: use RESTful interface to prometeus? See ALT bug #29496
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"
;;
......@@ -130,6 +135,7 @@ __epm_filelist_name()
# TODO: add less
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
}
......
......@@ -190,6 +190,9 @@ epm_ni_install_names()
yum-rpm)
sudocmd yum -y $YUMOPTIONS install $@
return ;;
dnf-rpm)
sudocmd dnf -y $YUMOPTIONS install $@
return ;;
urpm-rpm)
sudocmd urpmi --auto $URPMOPTIONS $@
return ;;
......@@ -407,12 +410,17 @@ epm_install()
# 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"
#[ -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 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
......
......@@ -21,6 +21,7 @@ load_helper epm-query
epm_provides_files()
{
local pkg_files="$@"
[ -n "$pkg_files" ] || return
local PKGTYPE="$(get_package_type $pkg_files)"
......@@ -44,6 +45,7 @@ epm_provides_files()
epm_provides_names()
{
local pkg_names="$@"
local CMD
[ -n "$pkg_names" ] || return
......@@ -102,6 +104,6 @@ epm_provides()
{
[ -n "$pkg_filenames" ] || fatal "Provides: missing package(s) name"
epm_provides_files
epm_provides_names
epm_provides_files $pkg_files
epm_provides_names $pkg_names
}
......@@ -17,8 +17,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-search_file
# copied from etersoft-build-utils/bin/rpmqf
# use and modify TOFILE recursively
......@@ -73,7 +71,7 @@ __do_query()
showcmd dpkg -S $1
dpkg_print_name_version $(dpkg -S $1 | grep -v "^diversion by" | sed -e "s|:.*||")
return ;;
yum-rpm|urpm-rpm)
yum-rpm|dnf-rpm|urpm-rpm)
CMD="rpm -qf"
;;
zypper-rpm)
......@@ -147,14 +145,17 @@ epm_query_file()
# TODO: move to separate command?
# FIXME: it is possible use query
if [ -n "$short" ] ; then
[ -n "$pkg_files" ] || fatal "Run query without file names (needed path to files)"
__do_short_query $pkg_files
[ -n "$pkg_files$pkg_dirs" ] || fatal "Run query without file names (needed path to files)"
__do_short_query $pkg_files $pkg_dirs
return
fi
# file can exists or not
[ -n "$pkg_filenames" ] || fatal "Run query without file names"
load_helper epm-search_file
for pkg in $pkg_filenames ; do
__do_query_real_file "$pkg"
__do_query $FULLFILEPATH || pkg_filenames=$FULLFILEPATH epm_search_file
......
......@@ -22,7 +22,7 @@ epm_removerepo()
case $PMTYPE in
apt-rpm)
assure_exists apt-repo
sudocmd apt-repo rm "$pkg_filenames"
sudocmd apt-repo rm "$quoted_args"
;;
apt-dpkg|aptitude-dpkg)
info "You need remove repo from /etc/apt/sources.list"
......
......@@ -21,6 +21,7 @@ load_helper epm-query
epm_requires_files()
{
local pkg_files="$@"
[ -n "$pkg_files" ] || return
local PKGTYPE="$(get_package_type $pkg_files)"
......@@ -42,6 +43,7 @@ epm_requires_files()
epm_requires_names()
{
local pkg_names="$@"
local CMD
[ -n "$pkg_names" ] || return
......@@ -101,6 +103,6 @@ docmd $CMD $pkg_names
epm_requires()
{
[ -n "$pkg_filenames" ] || fatal "Requires: missing package(s) name"
epm_requires_files
epm_requires_names
epm_requires_files $pkg_files
epm_requires_names $pkg_names
}
......@@ -96,6 +96,7 @@ esac
docmd $CMD $string
}
# TODO: use ^ as first word, use ~ for negate, for epmqp too
# produce grep sequence
__epm_search_make_grep()
{
......
......@@ -49,7 +49,7 @@ check_tty()
# egrep from busybox may not --color
# egrep from MacOS print help to stderr
if egrep --help 2>&1 | grep -q -- "--color" ; then
EGREPCOLOR="--color"
export EGREPCOLOR="--color"
fi
which tput >/dev/null 2>/dev/null || return
......@@ -262,10 +262,18 @@ set_sudo()
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()
{
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()
......@@ -292,6 +300,7 @@ __get_package_for_command()
esac
}
# TODO: we we can't use epm directly?
assure_exists()
{
load_helper epm-assure
......@@ -302,7 +311,7 @@ assure_exists()
eget()
{
$PROGDIR/epm-eget "$@"
$SHAREDIR/tools-eget "$@"
}
# TODO: improve and drop!
......@@ -400,7 +409,7 @@ case $DISTRNAME in
;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
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)
CMD="slackpkg"
......
#!/bin/sh
#
# Copyright (C) 2012-2014 Etersoft
# Copyright (C) 2012-2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2015 Etersoft
# Copyright (C) 2012-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
......@@ -38,6 +38,8 @@ __check_yum_result()
grep "^Complete!" $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 $2
}
......@@ -78,6 +80,12 @@ EOF
RES=$?
clean_store_output
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)
CMD="urpmi --test --auto"
;;
......
......@@ -40,7 +40,12 @@ case $PMTYPE in
sudocmd aptitude update || exit
;;
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)
sudocmd urpmi.update -a
......
epm
\ No newline at end of file
......@@ -161,7 +161,9 @@ check_command()
serv_cmd=usage
withoutservicename=1
;;
#restart) # HELPCMD: restart service
restart) # HELPCMD: restart service
serv_cmd=restart
;;
#reload) # HELPCMD: reload service
start) # HELPCMD: start service
serv_cmd=start
......
......@@ -28,9 +28,11 @@ serv_enable()
case $SERVICETYPE in
service-chkconfig)
sudocmd chkconfig --add $1
sudocmd chkconfig --add $1 || return
sudocmd chkconfig $1 on
;;
service-upstart)
sudocmd chkconfig --add $1 || return
sudocmd chkconfig $1 on
;;
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()
{
case $SERVICETYPE in
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)
fatal "FIXME: don't know how detect current startup state"
test -L $(echo /etc/rc5.d/S??$1)
;;
systemd)
$SUDO systemctl is-enabled $1
......
# This spec is backported to ALTLinux p7 automatically by rpmbph script. Do not edit it.
#
Name: eepm
Version: 1.5.8
Version: 1.5.13
Release: alt0.M70P.1
Summary: Etersoft EPM package manager
......@@ -67,9 +67,39 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv
%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)
* 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
- add initial snappy support
- remove extra deps
......
......@@ -65,7 +65,7 @@ check_tty()
# egrep from busybox may not --color
# egrep from MacOS print help to stderr
if egrep --help 2>&1 | grep -q -- "--color" ; then
EGREPCOLOR="--color"
export EGREPCOLOR="--color"
fi
which tput >/dev/null 2>/dev/null || return
......@@ -264,7 +264,13 @@ set_sudo()
withtimeout()
{
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()
......@@ -300,7 +306,7 @@ assure_exists()
eget()
{
$PROGDIR/epm-eget "$@"
$PROGDIR/tools-eget "$@"
}
get_package_type()
......@@ -472,8 +478,6 @@ esac
# File bin/epm-assure:
__check_command_in_path()
{
PATH=$PATH:/sbin:/usr/sbin which "$1" 2>/dev/null
......@@ -496,6 +500,8 @@ __epm_assure()
# TODO: use package name normalization
info "Installing appropriate package for $1 command..."
load_helper epm-install
local PACKAGE="$2"
[ -n "$PACKAGE" ] || PACKAGE="$1"
#epm install $2
......@@ -1044,43 +1050,6 @@ epm_downgrade()
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:
......@@ -2206,7 +2175,6 @@ epm_query()
# File bin/epm-query_file:
__do_query_real_file()
{
local LINKTO1 LINKTO
......@@ -2332,14 +2300,17 @@ epm_query_file()
# TODO: move to separate command?
# FIXME: it is possible use query
if [ -n "$short" ] ; then
[ -n "$pkg_files" ] || fatal "Run query without file names (needed path to files)"
__do_short_query $pkg_files
[ -n "$pkg_files$pkg_dirs" ] || fatal "Run query without file names (needed path to files)"
__do_short_query $pkg_files $pkg_dirs
return
fi
# file can exists or not
[ -n "$pkg_filenames" ] || fatal "Run query without file names"
load_helper epm-search_file
for pkg in $pkg_filenames ; do
__do_query_real_file "$pkg"
__do_query $FULLFILEPATH || pkg_filenames=$FULLFILEPATH epm_search_file
......@@ -2700,7 +2671,7 @@ epm_removerepo()
case $PMTYPE in
apt-rpm)
assure_exists apt-repo
sudocmd apt-repo rm "$pkg_filenames"
sudocmd apt-repo rm "$quoted_args"
;;
apt-dpkg|aptitude-dpkg)
info "You need remove repo from /etc/apt/sources.list"
......@@ -3792,7 +3763,7 @@ $(get_help HELPOPT)
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 "Copyright (c) Etersoft 2012-2014"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
......@@ -3815,6 +3786,7 @@ skip_installed=
show_command_only=
epm_cmd=
pkg_files=
pkg_dirs=
pkg_names=
pkg_urls=
quoted_args=
......@@ -3825,6 +3797,9 @@ case $progname in
epmi)
epm_cmd=install
;;
epmI)
epm_cmd=Install
;;
epme)
epm_cmd=remove
;;
......@@ -4045,6 +4020,8 @@ check_filenames()
# files can be with full path or have extension via .
if [ -f "$opt" ] && echo "$opt" | grep -q "[/\.]" ; then
pkg_files="$pkg_files $opt"
elif [ -d "$opt" ] ; then
pkg_dirs="$pkg_dirs $opt"
elif echo "$opt" | grep -q "://" ; then
pkg_urls="$pkg_names $opt"
else
......@@ -4073,10 +4050,11 @@ if ! inputisatty ; then
fi
pkg_files=$(strip_spaces "$pkg_files")
pkg_dirs=$(strip_spaces "$pkg_dirs")
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_dirs $pkg_names")
# Just debug
#echover "command: $epm_cmd"
......
......@@ -63,7 +63,7 @@ check_tty()
# egrep from busybox may not --color
# egrep from MacOS print help to stderr
if egrep --help 2>&1 | grep -q -- "--color" ; then
EGREPCOLOR="--color"
export EGREPCOLOR="--color"
fi
which tput >/dev/null 2>/dev/null || return
......@@ -262,7 +262,13 @@ set_sudo()
withtimeout()
{
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()
......@@ -298,7 +304,7 @@ assure_exists()
eget()
{
$PROGDIR/epm-eget "$@"
$PROGDIR/tools-eget "$@"
}
get_package_type()
......@@ -487,9 +493,11 @@ serv_enable()
case $SERVICETYPE in
service-chkconfig)
sudocmd chkconfig --add $1
sudocmd chkconfig --add $1 || return
sudocmd chkconfig $1 on
;;
service-upstart)
sudocmd chkconfig --add $1 || return
sudocmd chkconfig $1 on
;;
service-initd|service-update)
......@@ -613,10 +621,11 @@ is_service_autostart()
{
case $SERVICETYPE in
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)
fatal "FIXME: don't know how detect current startup state"
test -L $(echo /etc/rc5.d/S??$1)
;;
systemd)
$SUDO systemctl is-enabled $1
......@@ -1138,7 +1147,7 @@ $(get_help HELPOPT)
print_version()
{
echo "Service manager version 1.5.8"
echo "Service manager version 1.5.10"
echo "Running on $($DISTRVENDOR)"
echo "Copyright (c) Etersoft 2012, 2013"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment