#!/bin/bash # # Revision: Additional human-friendly version tools for RPM # # Copyright (C) 1999 Building Number Three Ltd # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # ---------------- # # Requirements: # # A system that supports rpm and locate (eg Red Hat). This will not # work on Debian until someone submits the Debian equivalent. This # took about an hour.. the clock is ticking. # # Instructions: # # Stick this file somewhere - lets say /usr/local/lib/revision.sh # Add "source /usr/local/lib/revision.sh" to the .bashrc in your # home directory. # # You can now do # whatis [name] eg "whatis ls" # # To get the information about the package that relates to a file. # The program will attempt to guess file names from a command name # or other clues. # # revision [name] eg "revision ls cat" # # This does the same guessing as whatis but outputs just the package # and version of package. # # gnome-versions # # List the version of all gnome related packages you have # # Bugs: # # None (yet). Report any bugs/suggestions to # number6@the-village.bc.nu # Send any flames to postmaster@localhost # revision() { for i in $* do echo -n "$i" if [ -x "$i" ]; then X="$i" F=1 else X=$(which "$i") F=0 fi if [ "x$X" = "x" ]; then echo " is not on your path." echo -n "$i: Searching... " X=$(locate "$i" | grep -v /home |head -1) if [ "x$X" = "x" ]; then F=2 else echo "guessing it is related to $X" F=1 echo -n "$i" fi fi if [ "$F" = "0" ]; then echo -n " ($X)" fi if [ "$F" = "2" ]; then echo "not found." else echo -n " : " Y=$(rpm -qf "$X" 2>/dev/null ) if [ "x$Y" = "x" ]; then echo "has no owner" else echo "$Y" fi fi done } whatis() { for i in $* do echo -n "$i" if [ -x "$i" ]; then X="$i" F=1 else X=$(which "$i") F=0 fi if [ "x$X" = "x" ]; then echo " is not on your path." echo -n "$i: Searching... " X=$(locate "$i" | grep -v /home |head -1) if [ "x$X" = "x" ]; then F=2 else echo "guessing it is related to $X" F=1 echo -n "$i" fi fi if [ "$F" = "0" ]; then echo -n " ($X)" fi if [ "$F" = "2" ]; then echo "not found." else echo -n " : " Y=$(rpm -qf "$X" 2>/dev/null ) if [ "x$Y" = "x" ]; then echo "has no owner" else echo "$Y" rpm -qi "$Y" 2>&1 fi fi done } gnomescan() { for i in $*; do printf "%-30s %s\n" "$i : " "$(rpm -q --queryformat %{VERSION} $i)" done } gnome-version() { gnomescan ee esound esound-devel glib glib-devel gnome-admin gnome-audio gnome-audio-extra gnome-core gnome-core-devel gnome-games gnome-libs gnome-libs-devel gnome-linuxconf gnome-media gnome-network gnome-objc gnome-pim gnome-users-guide gnome-utils gtk+ gtk+-devel gtk-engines switchdesk-gnome xchat } .