12 |
echo " -b BUILD searches for build number BUILD, needs -n -v" |
echo " -b BUILD searches for build number BUILD, needs -n -v" |
13 |
echo " -c CAT shows all packages of given categorie" |
echo " -c CAT shows all packages of given categorie" |
14 |
echo " -i shows an inventory of all installed packages" |
echo " -i shows an inventory of all installed packages" |
15 |
echo " -f PATH searches package names in given path" |
echo " -f PATH searches packages which own given file" |
16 |
|
echo " -e PATH searches the package which owns the exact given filename" |
17 |
echo |
echo |
18 |
echo " Examples:" |
echo " Examples:" |
19 |
echo |
echo |
26 |
GET_INVENTORY=false |
GET_INVENTORY=false |
27 |
SEARCH_ONLY_PATH=false |
SEARCH_ONLY_PATH=false |
28 |
SEARCH_ONLY_CAT=false |
SEARCH_ONLY_CAT=false |
29 |
|
SEARCH_EXACT_FILENAME=false |
30 |
|
|
31 |
# no params given, or is only an arg not ar param, exit |
# no params given, or is only an arg not ar param, exit |
32 |
if [[ $# -lt 1 ]] || [[ ${1:0:1} != - ]] |
if [[ $# -lt 1 ]] || [[ ${1:0:1} != - ]] |
44 |
-b) shift; S_PBUILD="$1" ;; |
-b) shift; S_PBUILD="$1" ;; |
45 |
-i) GET_INVENTORY="true" ;; |
-i) GET_INVENTORY="true" ;; |
46 |
-f) SEARCH_ONLY_PATH="true"; shift; SEARCH_PATH="$1" ;; |
-f) SEARCH_ONLY_PATH="true"; shift; SEARCH_PATH="$1" ;; |
47 |
|
-e) SEARCH_ONLY_PATH="true"; SEARCH_EXACT_FILENAME="true"; shift; SEARCH_PATH="$1" ;; |
48 |
-c) SEARCH_ONLY_CAT="true"; shift; SEARCH_CAT="$1" ;; |
-c) SEARCH_ONLY_CAT="true"; shift; SEARCH_CAT="$1" ;; |
49 |
-h) print_usage; exit 0 ;; |
-h) print_usage; exit 0 ;; |
50 |
-*) print_usage; exit 1 ;; |
-*) print_usage; exit 1 ;; |
60 |
then |
then |
61 |
unset S_PACKAGES |
unset S_PACKAGES |
62 |
unset i pkg |
unset i pkg |
63 |
for i in $(fgrep -rl "${SEARCH_PATH}" ${INSTALLDB}) |
if [[ ${SEARCH_EXACT_FILENAME} = true ]] |
64 |
|
then |
65 |
|
S_CANDIDATES=$(egrep -rl "${SEARCH_PATH}ยง" ${INSTALLDB}) |
66 |
|
else |
67 |
|
S_CANDIDATES=$(fgrep -rl "${SEARCH_PATH}" ${INSTALLDB}) |
68 |
|
fi |
69 |
|
for i in ${S_CANDIDATES} |
70 |
do |
do |
71 |
# ignore magefiles! |
# ignore magefiles! |
72 |
case ${i} in |
case ${i} in |