| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #!/bin/bash
- # command_dev_detect_ldd.sh function
- # Author: Daniel Gibbs
- # Website: https://linuxgsm.com
- # Description: Automatically detects required deps using ldd.
- # Can check a file or directory recursively.
- local commandname="DETECT-LDD"
- local commandaction="Detect-LDD"
- local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
- echo "================================="
- echo "Shared Object dependencies Checker"
- echo "================================="
- if [ -z "${serverfiles}" ]; then
- dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
- fi
- if [ -d "${serverfiles}" ]; then
- echo "Checking directory: "
- echo "${serverfiles}"
- elif [ -f "${serverfiles}" ]; then
- echo "Checking file: "
- echo "${serverfiles}"
- fi
- echo ""
- files=$(find "${serverfiles}" | wc -l)
- find "${serverfiles}" -type f -print0 |
- while IFS= read -r -d $'\0' line; do
- if ldd "${line}" 2>/dev/null | grep -v "not a dynamic executable"
- then
- echo "${line}" >> "${tmpdir}/detect_ldd.tmp"
- ldd "${line}" 2>/dev/null | grep -v "not a dynamic executable" >> "${tmpdir}/detect_ldd.tmp"
- if ldd "${line}" 2>/dev/null | grep -v "not a dynamic executable" | grep "not found"
- then
- echo "${line}" >> "${tmpdir}/detect_ldd_not_found.tmp"
- ldd "${line}" 2>/dev/null | grep -v "not a dynamic executable" | grep "not found" >> "${tmpdir}/detect_ldd_not_found.tmp"
- fi
- fi
- echo -n "$i / $files" $'\r'
- ((i++))
- done
- echo ""
- echo ""
- echo "All"
- echo "================================="
- cat "${tmpdir}/detect_ldd.tmp"
- echo ""
- echo "Not Found"
- echo "================================="
- cat "${tmpdir}/detect_ldd_not_found.tmp"
- rm "${tmpdir}/detect_ldd.tmp"
- rm "${tmpdir}/detect_ldd_not_found.tmp"
- core_exit.sh
|