-
Notifications
You must be signed in to change notification settings - Fork 1
/
Find-Pkg
executable file
·34 lines (28 loc) · 1.06 KB
/
Find-Pkg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# T2 SDE: misc/archive/Find.sh
# Copyright (C) 2004 - 2005 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- T2-COPYRIGHT-NOTE-END ---
matched=0
echo "Searching for matching package names ..."
pkg="`echo "$1" | tr A-Z a-z`"
x="`cd package/ ; ls -d */*$pkg* 2>/dev/null`"
if [ -n "$x" ] ; then
echo -e "$x\n"
matched=1
fi
echo "Searching in package descriptions (may take some time) ..."
# grep --color does not work with -i (at least not in GNU sed 2.5.1),
# so colorize via sed
grep -i "[(\I\|T\)].* $1" package/*/*/*.desc | sed "/$1/I s//\o033[31;1m&\o033[0m/g"
[ $? -eq 0 ] && matched=1
[ $matched = 0 ] && echo "No match found ..."