$OpenBSD: patch-tools_utillib_sh,v 1.1.1.1 2007/11/21 18:48:40 ajacoutot Exp $ --- tools/utillib.sh.orig Thu Oct 25 09:40:41 2007 +++ tools/utillib.sh Mon Nov 12 11:13:26 2007 @@ -350,14 +350,25 @@ distro() { warning "no lsb_release no /etc/*-release no /etc/debian_version" } hb_ver() { + # for Linux .deb based systems which dpkg > /dev/null 2>&1 && { dpkg-query -f '${Version}' -W heartbeat 2>/dev/null || dpkg-query -f '${Version}' -W heartbeat-2 return } + # for Linux .rpm based systems which rpm > /dev/null 2>&1 && { rpm -q --qf '%{version}' heartbeat return + } + # for OpenBSD + which pkg_info > /dev/null 2>&1 && { + pkg_info | grep heartbeat | cut -d "-" -f 2- | cut -d " " -f 1 + return + } + # for Solaris + which pkginfo > /dev/null 2>&1 && { + pkginfo | awk '{print $3}' } # more packagers? }