public
Authored by avatar PotatoGim

[Bash] Find duplicated RPM packages

This script is to find duplicated RPM packages with their meta info.

find_dup_rpms.sh 324 bytes
#!/bin/bash

DIR=$1

for i in `ls -1 $DIR`;
do
    FNAME=`rpm -q --qf '%{NAME}' -p $i 2>/dev/null`
    
    for j in `ls -1 $DIR | grep -v $i`
    do
        SNAME=`rpm -q --qf '%{NAME}' -p $j 2>/dev/null`
        
        if [ "$FNAME" == "$SNAME" ]; then
            echo "$i - $j"
        fi
    done
done
Supports Markdown
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