update scripts/bin/update-whatprovides-db

This commit is contained in:
Leonid Pliushch 2020-11-22 01:15:26 +00:00
parent 8b719ae8ea
commit 1a635bc2aa

View File

@ -3,19 +3,18 @@
## Script that generates or updates a Whatprovides
## database for Termux.
##
## Copy of https://github.com/termux/whatprovides/blob/9afbbb72de1d89aae835d5581cef09741ff3fd10/update-whatprovides-db.sh
## Copy of https://github.com/termux/whatprovides/blob/96a9fd100a84af1bf2fd3fbeedbaab082381f5e8/update-whatprovides-db.sh
## but edited for special use in termux-packages.
##
set -e -u
: "${TERMUX_PREFIX:="/data/data/com.termux/files/usr"}"
DEBS_DIR_PATH=$(realpath "$(dirname "$0")/../../debs")
list_files() {
dpkg-deb -c "${1}" | grep -o "${TERMUX_PREFIX//./\\.}/.\+" \
| sed -E 's@(.*) ->..*@\1@g;s@/$@@g' \
| xargs -rd\\n realpath -sm --relative-base="$TERMUX_PREFIX" --
dpkg-deb --fsys-tarfile "${1}" | tar -t | cut -b2- \
| xargs -rd\\n realpath -sm --relative-base="/data/data/com.termux/files/usr" -- \
| grep -vEx '[./]|/data(/data(/com\.termux(/files)?)?)?'
}
write_sql_script() {