This repository has been archived on 2020-02-16. You can view files and clone it, but cannot push or open issues/pull-requests.
waifu2x-converter-cpp/freeze.sh

23 lines
577 B
Bash
Executable File

#!/bin/bash
function get_libraries() {
ldd $(which $1) | cut -d' ' -f1 | tr -d '\t'
}
function get_library_path() {
/sbin/ldconfig -p | grep $1 | cut -d'>' -f2 | tr -d ' '
}
function get_library_package() {
# does not find many packages despite being installed‽
#dpkg -S $1 | cut -d: -f 3 | tr -d ' '
# slow, but at least it works
apt-file find $1 | head -n 1 | cut -d: -f1
}
echo "Freezing libraries…"
for library in $(get_libraries $1); do
echo "$library "
get_library_package $(get_library_path $library) >> /tmp/frozen_packages
done