3
# Copyright (C) 2012, 2016, 2017, 2019 Etersoft
4
# Copyright (C) 2012, 2016, 2017, 2019 Vitaly Lipatov <lav@etersoft.ru>
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU Affero General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU Affero General Public License for more details.
16
# You should have received a copy of the GNU Affero General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
# TODO: see epm-search (colorify for all distro)
22
# args: index_lists word grep_string
23
__alt_search_file_output()
25
# grep only on left part (filename), then revert order and grep with color
26
ercat $quiet $1 | grep -h -- ".*$2.*[[:space:]]" | sed -e "s|\(.*\)\t\(.*\)|\2: \1|g" $3
29
__alt_local_content_search()
31
load_helper epm-sh-altlinux
32
load_helper epm-sh-altlinux-contents-index
33
load_helper epm-search
35
check_alt_contents_index || init_alt_contents_index
38
if [ ! -s "$ALT_CONTENTS_INDEX_LIST" ] ; then
39
fatal "Have no local contents index. Check epm repo --help."
42
local CI="$(cat $ALT_CONTENTS_INDEX_LIST)"
44
info "Searching for $1 ... "
48
MGS=$(eval __epm_search_make_grep $quoted_args)
49
showcmd "$ cat contents_index $MGS"
50
eval "__alt_search_file_output \"$CI\" \"$(eval get_firstarg $quoted_args)\" $MGS"
56
[ -n "$pkg_filenames" ] || fatal "Search file: file name is missed"
60
__alt_local_content_search $pkg_filenames
65
apt-dpkg|aptitude-dpkg)
66
if ! is_command apt-file ; then
67
assure_exists apt-file
68
sudocmd apt-file update
70
load_helper epm-check_updated_repo
73
docmd apt-file search $pkg_filenames
76
CMD="pkcon search file"
80
info "Search by full packages list is not implemented yet"
85
info "Search by full packages list is not implemented yet"
92
CMD="zypper search --file-list"
98
CMD="/usr/sbin/slackpkg file-search"
104
CMD="eopkg search-file"
110
docmd apt-cyg searchall $(echo " $pkg_filenames" | sed -e "s| /| |g")
114
fatal "Have no suitable search file command for $PMTYPE"
118
docmd $CMD $pkg_filenames