[go: up one dir, main page]

Menu

[r7]: / trunk / apk_info  Maximize  Restore  History

Download this file

57 lines (45 with data), 1.0 kB

#!/bin/sh

VERSION=0.0.9
. ${APKLIBS:="/lib/apk"}/apkfuncs.sh


usage() {
	
	echo "apk_info $VERSION" >&2
	echo "Usage: apk_info [ -a | -h ] | [-L | -c ] PACKAGE" >&2
	echo "  -a     List all installed packages" >&2
	echo "  -h     Display this help" >&2
	echo "  -L     List contents of PACKAGE" >&2
	echo "  -c     Check sha1 sums of package" >&2
	exit 1
}

# create $APKDB if id does not exist
mkdir -p ${APKDB}

vflag=off
set -- `getopt achL "$@"`
[ $# -lt 1 ] && usage	# getopt failed
while [ $# -gt 0 ] ; do
	case "$1" in
	-a)	all_installed_with_desc
		exit 0;;
	-L)	pkgcmd="list";;
	-c)	pkgcmd="check";;
	-h)	usage;;
	--)	shift; break;;
	-*)	usage;;
	*)	break;;	# terminate while loop
	esac
	shift
done

pkg=$1
if [ -z ${pkg} ]; then
	all_installed
	exit 0
fi

pkgv=`get_installed_pkgv ${pkg}`
if  [ -z $pkgv ] ; then
	echo "$pkg does not seem to be installed. Aborting."
	exit 1
fi

case "${pkgcmd}" in
	list) 		pkg_listfiles ${pkgv};;
	check)		pkg_check ${pkgv};;
	
	*) 		get_control ${pkgv}
esac