Commit bf8d03ef authored by Vitaly Lipatov's avatar Vitaly Lipatov

rpmqf: add deb support

parent e2431896
#!/bin/sh #!/bin/sh
# 2003-2006, 2009 (c) Etersoft www.etersoft.ru # 2003-2006, 2009, 2011 (c) Etersoft www.etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru> # Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain # Public domain
# #
...@@ -8,6 +8,12 @@ ...@@ -8,6 +8,12 @@
# - название файл # - название файл
# TODO not -i only, we need any key # TODO not -i only, we need any key
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
load_mod spec rpm
if [ "$1" = "-h" ]; then if [ "$1" = "-h" ]; then
echo "rpmqf - the same as rpm -qf, but use which for search command place" echo "rpmqf - the same as rpm -qf, but use which for search command place"
exit 0 exit 0
...@@ -18,6 +24,8 @@ if [ "$1" = "-i" ]; then ...@@ -18,6 +24,8 @@ if [ "$1" = "-i" ]; then
shift shift
fi fi
[ -n "$1" ] || fatal "Run with command name. See $0 -h also."
# use and modify TOFILE recursively # use and modify TOFILE recursively
real_file() real_file()
{ {
...@@ -45,4 +53,18 @@ real_file() ...@@ -45,4 +53,18 @@ real_file()
real_file "$1" real_file "$1"
rpmquery -f $ARG "$FULLFILEPATH" case "$($DISTRVENDOR -p)" in
"rpm")
rpmquery -f $ARG "$FULLFILEPATH"
;;
"deb")
DPKG=dpkg
PACKAGE=$($DPKG -S "$FULLFILEPATH" 2>/dev/null | head -n1 | sed -e "s|:.*||")
[ -n "$PACKAGE" ] || fatal "Can't find package for $FULLFILEPATH"
VERSION=$($DPKG -s "$PACKAGE" 2>/dev/null | grep "Version:" | sed -e "s|Version: ||g")
[ -n "$VERSION" ] && echo "$PACKAGE-$VERSION" || fatal "Can't extract version for $PACKAGE package"
;;
*)
fatal "Unsupported package system"
;;
esac
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment