enabling case insensitive package searches
[feisty_meow.git] / scripts / system / list_packages.sh
1 #!/bin/bash
2
3 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
4
5 if [ -z "$*" ]; then
6   # no parameters, so we do a wildcard style of listing packages.
7   SEEK_PIECE=' cat '
8 else
9   # we know the parameters are not empty, so we don't go with our
10   # wildcard approach for listing the package names.
11   SEEK_PIECE=' grep -i $* '
12 fi
13
14 if debian_like; then
15   dpkg -la | eval $SEEK_PIECE
16   exit $?
17 fi
18
19 rpm_available="$(whichable rpm)"
20 if [ ! -z "$rpm_available" ]; then
21 #is that the right phrase for rpm?  somewhat forgotten.
22   rpm -qa | eval $SEEK_PIECE
23   exit $?
24 fi
25
26 yum_available="$(whichable yum)"
27 if [ ! -z "$yum_available" ]; then
28   yum list | eval $SEEK_PIECE
29   exit $?
30 fi
31
32 echo "Could not deduce what type of OS this is; missing package listing commands."
33 exit 1