#!/bin/sh # # Copyright (C) 2012 Etersoft # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # epm_packages() { local CMD case $PMTYPE in apt-rpm) CMD="rpm -qa $pkg_filenames" [ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames" ;; apt-dpkg) CMD="dpkg -l $pkg_filenames" [ -n "$short" ] && CMD="dpkg-query -W --showformat=\${Package}\n $pkg_filenames" ;; yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm) CMD="rpm -qa $pkg_filenames" [ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames" ;; # Note: dnf has dnf list command emerge) CMD="qlist -I" ;; pkgsrc) CMD="pkg_info" ;; pacman) CMD="pacman -Qs $pkg_filenames" if [ -n "$short" ] ; then docmd $CMD | sed -e "s| .*||g" -e "s|.*/||g" | grep -v "^$" return fi ;; npackd) CMD="npackdcl list --status=installed" # TODO: use search if pkg_filenames is not empty ;; # chocolatey) # CMD="chocolatey list" # ;; slackpkg) CMD="ls -1 /var/log/packages/" if [ -n "$short" ] ; then docmd ls -1 /var/log/packages/ | sed -e "s|-[0-9].*||g" return fi ;; homebrew) CMD="brew $pkg_filenames" ;; ipkg) CMD="ipkg list" ;; *) fatal "Have no suitable query command for $PMTYPE" ;; esac docmd $CMD }