Root/scripts/gen-dependencies.sh

1#!/usr/bin/env bash
2#
3# Copyright (C) 2012 OpenWrt.org
4#
5# This is free software, licensed under the GNU General Public License v2.
6# See /LICENSE for more information.
7#
8SELF=${0##*/}
9
10READELF="${READELF:-readelf}"
11TARGETS=$*
12XARGS="${XARGS:-xargs -r}"
13
14[ -z "$TARGETS" ] && {
15  echo "$SELF: no directories / files specified"
16  echo "usage: $SELF [PATH...]"
17  exit 1
18}
19
20find $TARGETS -type f -a -exec file {} \; | \
21  sed -n -e 's/^\(.*\):.*ELF.*\(executable\|shared object\).*,.* stripped/\1/p' | \
22  $XARGS -n1 readelf -d | \
23  awk '$2 ~ /NEEDED/ && $NF !~ /interpreter/ && $NF ~ /^\[?lib.*\.so/ { gsub(/[\[\]]/, "", $NF); print $NF }' | \
24  sort -u
25

Archive Download this file



interactive