23 lines
577 B
Bash
23 lines
577 B
Bash
|
#!/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
|