pkgxtra
August 2nd, 2005 Stephen Lau
a while ago i wrote a stupid little shell script called pkgxtra that lets me easily list files owned by a package (either by .pkg filename, or package name (like SUNWcsl)). it also provides a shortcut to see which package owns a given pathname/filename.
here it is, in all its glory:
#!/bin/bash
show_help() {
echo "usage: $0 [-lfp] ";
echo " -l lists files belonging to package";
echo " -f lists files contained in .pkg file";
echo " -p show package owner of ";
}
while getopts "lpfh" flag
do
if [ "$flag" == "l" ]; then
MODE=0;
fi
if [ "$flag" == "p" ]; then
MODE=1;
fi
if [ "$flag" == "f" ]; then
MODE=2;
fi
if [ "$flag" == "h" ]; then
show_help
exit 1;
fi
done
shift $(($OPTIND - 1))
if [ "$#" -eq "0" ]; then
show_help
exit 1;
fi
case "$MODE" in
0) pkgchk -l $1|awk '/^Pathname/ {print $2}';;
1) pkgchk -l -p $1;;
2) pkgchk -l -d $1|awk '/^Pathname/ {print $2}';;
esac
[tags: Code, OpenSolaris]
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>









