#!/bin/bash -e
# Executes opkg search <file|regexp>, e.g., ni-opkg-search /home/lvuser/natinst/bin/startup.rtexe
# Returns 0 if a package that provides the file is found.
# Returns 1 if no package is found.
if [[ -z $1 ]]; then
    echo "opkg search command requires an argument: <file|regexp>"
    exit 5
fi
if [ ! -z "$(grep -r $1 /var/lib/opkg)" ]; then
    # echo "Found a package providing $1"
    exit 0
else
    # echo "No package found for $1"
    exit 1
fi