Skip to content

Instantly share code, notes, and snippets.

@dgibbs64
Created August 9, 2016 20:27
Show Gist options
  • Save dgibbs64/c8703d3c1509e09433134d1cadccbf0d to your computer and use it in GitHub Desktop.
Save dgibbs64/c8703d3c1509e09433134d1cadccbf0d to your computer and use it in GitHub Desktop.
check_glibc_requirement.sh
#!/bin/bash
# check_glibc_requirements.sh function
# Author: Daniel Gibbs
# Website: https://danielgibbs.co.uk
# Description: Automatically detects the version of GLIBC that is required.
# Can check a file or directory recursively
# Usage check_glibc_requirements.sh [dir]
echo "================================="
echo "GLIBC Requirements Checker"
echo "================================="
dir="$1"
if [ -z "${dir}" ]; then
dir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
fi
if [ -d "${dir}" ]; then
echo "Checking directory: "
echo "${dir}"
elif [ -f "${dir}" ]; then
echo "Checking file: "
echo "${dir}"
fi
echo ""
find ${dir} -type f -print0 |
while IFS= read -r -d $'\0' line; do
objdump -T $line 2>/dev/null|grep -oP "GLIBC[^ ]+" >>/tmp/glibcdump
done
cat /tmp/glibcdump|sort|uniq|sort -r --version-sort
rm /tmp/glibcdump
@dgibbs64
Copy link
Author

dgibbs64 commented Aug 9, 2016

Rough script but works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment