Magellan Linux

Diff of /branches/mage-next/src/magequery.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1290 by niro, Thu May 12 22:20:59 2011 UTC revision 1546 by niro, Tue Dec 27 09:11:32 2011 UTC
# Line 12  print_usage() Line 12  print_usage()
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
# Line 25  print_usage() Line 26  print_usage()
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} != - ]]
# Line 42  do Line 44  do
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 ;;
# Line 50  do Line 53  do
53  done  done
54    
55  source /etc/mage.rc.global  source /etc/mage.rc.global
56  source /etc/mage.rc  source ${MAGERC}
57  RETVAL=1  RETVAL=1
58    
59  if [[ ${SEARCH_ONLY_PATH} = true ]]  if [[ ${SEARCH_ONLY_PATH} = true ]]
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     # fix ++, which gets interpreted as a regex
66     SEARCH_PATH="${SEARCH_PATH//+/\\+}"
67     # fix [, which gets interpreted as a regex
68     SEARCH_PATH="${SEARCH_PATH//[/\\[}"
69     S_CANDIDATES=$(egrep -rl "^${SEARCH_PATH}§" ${INSTALLDB})
70     else
71     S_CANDIDATES=$(fgrep -rl "${SEARCH_PATH}" ${INSTALLDB})
72     fi
73     for i in ${S_CANDIDATES}
74   do   do
75   # ignore magefiles!   # ignore magefiles!
76   case ${i} in   case ${i} in

Legend:
Removed from v.1290  
changed lines
  Added in v.1546