updated on Thu Jan 12 04:00:44 UTC 2012
[aur-mirror.git] / pactools / pt-pacman-info
blobc2c82f2194de751253c25d00ebffaebbcfc1740f
1 #!/bin/sh
2 # pacman-info
3 # /usr/bin/pacman-info
4 # GPL v2
5 # neonskull [at] gmail.com
7 VERSION="0.1"
8 AUTHOR="Pável Varela Rodríguez [aka NeOnsKuLL]"
10 usage()
12 echo "pacman-info v$VERSION"
13 echo "usage: `basename $0` [OPTION]
15 OPTIONS:
16 -cr|--configured-repos List the names of configured repos in your
17 pacman.conf
19 -a|--all Calculates the total number of available
20 packages in your repos
22 -br|--by-repo Calculates the total number of available
23 packages in each repo
25 -i|--installed Calculates the number of installed packages
27 -f|--full Generates a full Report
29 -h|--help Show this message
31 -v|--version Show version
35 [ "$#" -lt 1 ] && PARAM="-h";
36 [ "$#" -gt 1 ] && PARAM="*";
37 [ "$#" -eq 1 ] && PARAM="$1";
39 case $PARAM in
40 "-a"|"--all")
41 echo -e "Repositories information (total of packages in repos): `pacman -Sl|wc -l`"
43 "-cr"|"--configured-repos")
44 echo "Repositories information (name of configured repos):"
45 pacman -Sl|awk '{print $1}'|cut -d"/" -f 2|uniq -c|awk '{print "* " $2}'
47 "-br"|"--by-repo")
48 echo "Repositories information (number of packages by repo):"
49 pacman -Sl|awk '{print $1}'|cut -d"/" -f 2|uniq -c|awk '{print ":: "$2 "\t-> " $1 "\tpkgs"}'
51 "-i"|"--installed")
52 echo -e "System information (total of installed packages): `pacman -Q|wc -l`"
54 "-f"|"--full")
55 echo -e "Full Report about Repositories and Packages for Archlinux"
56 echo -e "Node name: `uname -n`\n"
57 $0 -cr
58 echo
59 $0 -a
60 echo
61 $0 -br
62 echo
63 $0 -i
64 echo
65 echo -e "Generated using `$0 -v` by $AUTHOR"
67 "-h"|"--help")
68 usage
70 "-v"|"--version")
71 echo "`basename $0` v$VERSION"
74 echo "Error! Unknown parameter."
75 usage
77 esac