Debian Codegraph @

debian/get-libssl-abi

raw
1 #!/bin/sh
2
3 # read SONAME version from /usr/lib/<triplet>/libssl.so
4
5 DEB_HOST_GNU_TYPE=${DEB_HOST_GNU_TYPE:-$(dpkg-architecture -qDEB_HOST_GNU_TYPE)}
6 DEB_HOST_MULTIARCH=${DEB_HOST_MULTIARCH:-$(dpkg-architecture -qDEB_HOST_MULTIARCH)}
7
8 SOFILE=/usr/lib/${DEB_HOST_MULTIARCH}/libssl.so
9 OBJDUMP=${DEB_HOST_GNU_TYPE}-objdump
10
11 if [ ! -r "$SOFILE" ]; then
12 echo "Can't read '$SOFILE', aborting" 1>&2
13 exit 1
14 fi
15
16 if ! which "$OBJDUMP" >/dev/null 2>&1; then
17 echo "Can't run '$OBJDUMP', aborting" 1>&2
18 exit 1
19 fi
20
21 SONAME=$("$OBJDUMP" -p "$SOFILE" | perl -ne '/SONAME\s+libssl\.so\.(.+)/ and print $1')
22
23 if [ ! -n "$SONAME" ]; then
24 echo "Could not parse SONAME from the output of '$OBJDUMP' '$SOFILE', aborting" 1>&2
25 exit 2
26 fi
27
28 echo "$SONAME"