You are not logged in.

#1 2006-07-11 01:47:06

NeOnsKuLL
Member
From: Havana, Cuba
Registered: 2005-03-29
Posts: 117

[SCRIPT] Some usefull info about repos and system

Hi!
I've create a simple script that shows some usefull info about the number of packages in repos, in system, and two or tree features for now. I think to add more features, but for now, and for me, it's at least functional.

This is te code:

#!/bin/sh
# pacman-info
# /usr/bin/pacman-info
# GPL v2
# neonskull [at] gmail.com 

VERSION="0.1"
AUTHOR="Pável Varela Rodríguez [aka NeOnsKuLL]"

usage()
{
echo "pacman-info v$VERSION"
echo "usage: `basename $0` [OPTION]

OPTIONS:
  -cr|--configured-repos    List the names of configured repos in your
                pacman.conf

   -a|--all            Calculates the total number of available
                packages in your repos

  -br|--by-repo            Calculates the total number of available
                packages in each repo

   -i|--installed        Calculates the number of installed packages

   -f|--full            Generates a full Report

   -h|--help            Show this message

   -v|--version            Show version
"
}

[ "$#" -lt 1 ] && PARAM="-h";
[ "$#" -gt 1 ] && PARAM="*";
[ "$#" -eq 1 ] && PARAM="$1";

case $PARAM in
    "-a"|"--all")
        echo -e "Repositories information (total of packages in repos): `pacman -Sl|wc -l`" 
    ;;
    "-cr"|"--configured-repos")
        echo "Repositories information (name of configured repos):"
        pacman -Sl|awk '{print $1}'|cut -d"/" -f 2|uniq -c|awk '{print "* " $2}'
    ;;
    "-br"|"--by-repo")
        echo "Repositories information (number of packages by repo):"
        pacman -Sl|awk '{print $1}'|cut -d"/" -f 2|uniq -c|awk '{print ":: "$2 "t-> " $1 "tpkgs"}'
    ;;
    "-i"|"--installed")
        echo -e "System information (total of installed packages): `pacman -Q|wc -l`"
    ;;
    "-f"|"--full")
        echo -e "Full Report about Repositories and Packages for Archlinux"
        echo -e "Node name: `uname -n`n"
        $0 -cr
        echo
        $0 -a
        echo
        $0 -br
        echo
        $0 -i
        echo
        echo -e "Generated using `$0 -v` by $AUTHOR"
    ;;
    "-h"|"--help")
        usage
    ;;
    "-v"|"--version")
        echo "`basename $0` v$VERSION"
    ;;
    *)
        echo "Error! Unknown parameter."
        usage
    ;;
esac

See you, and I hope it be usefull for you too.

NeOnsKuLL

PD: I knew it's quite simple, but it's my litle contribution...for now!


Intel Core 2 Duo E8400 3.0 GHz | 2x1GB 667MHz | 250+750GB Seageate SATAII | Samsung 19" TFT 1440x900
Openbox + obmenugen + PyTyle | bmpanel2 | oblogout | conky | pyBgSetter (with Esetroot as backend)
Projects: obmenugen, pyBgSetter

Offline

Board footer

Powered by FluxBB