Commit b266ad97 authored by Vitaly Lipatov's avatar Vitaly Lipatov

add support for ALT girar task number to install/remove, improve addrepo/removerepo

parent c197323d
epm install таск
epm remove таск (и reporepo)
packages list таск
аналог epm purge: запоминаем список файлов, удаляем пакеты и по возможности всё, от чего зависит (рекурсивно).
--interactive
......
......@@ -17,6 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-sh-altlinux
epm_addrepo()
{
local repo="$(eval echo "$quoted_args")"
......@@ -25,7 +27,7 @@ case $DISTRNAME in
ALTLinux)
case "$repo" in
etersoft)
info "add etersoft repo"
info "add Etersoft's addon repo"
load_helper epm-query
epm install --skip-installed apt-conf-etersoft-common apt-conf-etersoft-hold || fatal
local branch="$DISTRVERSION/branch"
......@@ -34,6 +36,7 @@ case $DISTRNAME in
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
local arch=$(uname -m)
[ "$arch" = "i686" ] && arch="i586"
# TODO: use apt-repo add ?
echo "" | sudocmd tee -a /etc/apt/sources.list
echo "# added with eepm addrepo etersoft" | sudocmd tee -a /etc/apt/sources.list
echo "rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/$branch/$arch addon" | sudocmd tee -a /etc/apt/sources.list
......@@ -50,13 +53,18 @@ case $DISTRNAME in
esac
assure_exists apt-repo
if tasknumber "$repo" >/dev/null ; then
sudocmd apt-repo add $(tasknumber "$repo")
return
fi
if [ -z "$repo" ] ; then
info "Add branch repo. TODO?"
docmd apt-repo add branch
echo "etersoft"
return
fi
# note: drop #
sudocmd apt-repo add "${repo/\#/}"
return
;;
esac
......
#!/bin/sh
#
# Copyright (C) 2012-2016 Etersoft
# Copyright (C) 2012-2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2017 Etersoft
# Copyright (C) 2012-2017 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,6 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-sh-altlinux
load_helper epm-query
load_helper epm-assure
load_helper epm-check_updated_repo
......@@ -565,6 +566,12 @@ epm_print_install_names_command()
epm_install()
{
if tasknumber "$pkg_names" >/dev/null ; then
assure_exists apt-repo
sudocmd apt-repo test $(tasknumber "$pkg_names")
return
fi
if [ -n "$show_command_only" ] ; then
epm_print_install_command $pkg_files
epm_print_install_names_command $pkg_names
......
#!/bin/sh
#
# Copyright (C) 2012-2014, 2016 Etersoft
# Copyright (C) 2012-2014, 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2014, 2016, 2017 Etersoft
# Copyright (C) 2012-2014, 2016, 2017 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,6 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-sh-altlinux
load_helper epm-query
load_helper epm-print
......@@ -230,6 +231,14 @@ epm_remove()
return
fi
local tn=$(tasknumber "$pkg_names")
if [ -n "$tn" ] ; then
assure_exists apt-repo
pkg_names=$(showcmd apt-repo list $tn)
#docmd epm remove $dryrun
return
fi
# get full package name(s) from the package file(s)
[ -n "$pkg_files" ] && pkg_names="$pkg_names $(epm query $pkg_files)"
......
......@@ -17,6 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-sh-altlinux
epm_removerepo()
{
local repo="$(eval echo $quoted_args)"
......@@ -31,8 +33,8 @@ case $DISTRNAME in
;;
esac
if ! echo "$repo" | grep -q -v "[0-9]*" ; then
repo="$(epm repolist | grep "repo/$repo" | line)"
if tasknumber "$repo" >/dev/null ; then
repo="$(epm repolist | grep "repo/$(tasknumber $repo)" | line)"
fi
assure_exists apt-repo
......
......@@ -115,3 +115,9 @@ get_local_alt_contents_index()
done
}
tasknumber()
{
local num="${*/\#/}"
isnumber "$num" && echo "$num"
}
......@@ -174,6 +174,12 @@ get_lastarg()
echon "$lastarg"
}
# TODO: see etersoft-build-utils/tests/test_isnumber.sh
isnumber()
{
echo "$*" | filter_strip_spaces | grep -q "^[0-9]\+$"
}
filter_strip_spaces()
{
# possible use just
......
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