Commit 46e5b729 authored by Vitaly Lipatov's avatar Vitaly Lipatov

get repo info for first time

parent cc791090
#!/bin/sh
#
# Copyright (C) 2014 Etersoft
# Copyright (C) 2014 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/>.
#
__is_repo_info_download()
{
case $PMTYPE in
apt-*)
test -r /var/cache/apt/pkgcache.bin || return
;;
*)
;;
esac
return 0
}
update_repo_if_needed()
{
if ! __is_repo_info_download ; then
load_helper epm-update
epm_update
return
fi
# TODO: if repo info is very obsoleted (a few days?), we need run update
}
......@@ -18,6 +18,7 @@
#
load_helper epm-query
load_helper epm-check_updated_repo
# TODO: use when run install with epm --skip-installed install
filter_out_installed_packages()
......@@ -375,6 +376,9 @@ epm_install()
[ -z "$files$names" ] && echo "Skip empty install list" && return 22
# it is useful for first time running
update_repo_if_needed
epm_install_names $names || return
epm_install_files $files
}
......@@ -17,6 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-check_updated_repo
__epm_search_output()
{
local CMD
......@@ -148,6 +150,9 @@ epm_search()
{
[ -n "$pkg_filenames" ] || fatal "Please, use search with some argument"
# it is useful for first time running
update_repo_if_needed
# FIXME: do it better
local MGS
MGS=$(eval __epm_search_make_grep $quoted_args)
......
......@@ -17,9 +17,15 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-check_updated_repo
epm_upgrade()
{
local CMD
# it is useful for first time running
update_repo_if_needed
echo "Run command for upgrade packages"
case $PMTYPE in
......
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