#!/bin/sh

# debs_of_so_deps.sh
# 2025-10-19
# by Gernot Walzl

# Lists all debian packages that contain used shared objects of an executable.

BIN=$1

OBJS=$(ldd "$BIN" | sed -n 's/.* => \(.*\) (.*/\1/p')
for OBJ in $OBJS; do
  dpkg -S "*${OBJ}" | sed -n 's/^\(.*\):.*: .*/\1/p'
done