fix script

This commit is contained in:
Leonid Pliushch 2020-11-20 02:47:56 +02:00
parent 1556d489f1
commit fb6a7e0e3b
No known key found for this signature in database
GPG Key ID: 45F2964132545795
1 changed files with 7 additions and 3 deletions

View File

@ -41,7 +41,11 @@ update_database() {
while getopts :hp:u option; do
case "$option" in
p) cat "${DB_PATH}/${OPTARG}"; exit 0;;
p)
echo "SELECT owned_file FROM 'whatprovides' WHERE package_name == '${OPTARG}' ORDER BY owned_file;" | \
sqlite3 "${DB_PATH}" | awk "{ print \"${OPTARG}: \"\$0 }"
exit 0
;;
u) update_database; exit 0;;
h) show_usage; exit 0;;
*) show_usage; exit 1;;
@ -49,8 +53,8 @@ while getopts :hp:u option; do
done
if [ $# -ge 1 ]; then
echo "SELECT owned_file FROM 'whatprovides' WHERE package_name == '${1}' ORDER BY owned_file;" | \
sqlite3 "${DB_PATH}" | awk "{ print \"${1}: \"\$0 }"
echo "SELECT package_name FROM 'whatprovides' WHERE owned_file == '${1}' ORDER BY package_name;" | \
sqlite3 "${DB_PATH}" | awk "{ print \$0\": ${1}\" }"
else
show_usage
exit 1