3cdd4c
#!/bin/bash -
3cdd4c
3cdd4c
# Generate RPM provides automatically for nbdkit packages and filters.
3cdd4c
# Copyright (C) 2009-2022 Red Hat Inc.
3cdd4c
3cdd4c
# To test:
3cdd4c
# find /usr/lib64/nbdkit/plugins | ./nbdkit-find-provides VER REL
3cdd4c
# find /usr/lib64/nbdkit/filters | ./nbdkit-find-provides VER REL
3cdd4c
3cdd4c
ver="$1"
3cdd4c
rel="$2"
3cdd4c
3cdd4c
function process_file
3cdd4c
{
3cdd4c
    if [[ $1 =~ /plugins/nbdkit-.*-plugin ]] ||
3cdd4c
       [[ $1 =~ /filters/nbdkit-.*-filter ]]; then
3cdd4c
        echo "Provides:" "$(basename $1 .so)" "=" "$ver-$rel"
3cdd4c
    fi
3cdd4c
}
3cdd4c
3cdd4c
while read line; do
3cdd4c
    process_file "$line"
3cdd4c
done