Zypper: How to list installed packages that are not in a repo

It is a bit about messing around with zypper inquiries.

1) Find installed packages, which come from non-opensuse-distribution-repositories:

zypper search -s | grep "i |" | grep -vi "| patch" | grep -vi "| opensuse" > list1.txt

2) Find packages, which are available from opensuse repositories (no matter whether they are installed or not):

zypper search -s | grep "v |" | grep -vi "| patch" | grep -i "| opensuse" > list2.txt

3) Identify packages from list1, which are not represented in list2:

cat list1.txt | cut -d " " -f3 | cut -d " " -f1 | while read line
do
    if [ "$(cat list2.txt | grep -i $line)" = "" ]; then
        echo "$line"
    fi
done

This should kind of solve the case (tested on openSUSE 11.3).


The option pa is probably more appropriate:

zypper pa -i

lists all the installed packages and their available versions and repositories. You can choose to list only the packages belonging to a certain repository with the -r flag:

zypper pa -i -r openSUSE-12.1

from there on you can use the strategies proposed by @ernestopheles to find the ones matching your needs.

Tags:

Zypper