update ./scripts/bin/update-whatprovides-db

This commit is contained in:
Leonid Pliushch 2020-11-21 22:24:14 +00:00
parent 11810d0cc1
commit 45e4c49269

View File

@ -3,16 +3,19 @@
## Script that generates or updates a Whatprovides
## database for Termux.
##
## Copy of https://github.com/termux/whatprovides/blob/f93bad1cfc731d7fd6bba8460e2f1c48281a805f/update-whatprovides-db.sh
## Copy of https://github.com/termux/whatprovides/blob/78b19eef0180570f1d92b5eeb48a2a0aa1236c5d/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 "/data/data/com.termux/.*" | sed -E 's@(.*) ->..*@\1@g'
dpkg-deb -c "${1}" | grep -o "/data/data/com\.termux/files/.\+" \
| sed -E 's@(.*) ->..*@\1@g;s@/$@@g' \
| xargs -rd\\n realpath -sm --relative-base="$TERMUX_PREFIX" --
}
write_sql_script() {