Skip to content

Commit 4a8b202

Browse files
authored
make identify position independent (#31)
* make identify position independent * readlink before chdir
1 parent d69f04c commit 4a8b202

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

identify

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/bash
22
set -o pipefail
3-
cd "$(dirname "$0")"
43
help() {
54
echo >&2 "Usage: $0 path/to/libc.so"
65
echo >&2 " OR $0 bid=<BUILD_ID>"
@@ -16,8 +15,13 @@ fi
1615

1716
arg="$1"
1817

19-
if [[ -f "$arg" ]]; then
20-
libc=$arg
18+
if [ -f "$arg" ]; then
19+
libc="$(readlink -f "$arg")"
20+
fi
21+
22+
cd "$(dirname "$0")"
23+
24+
if [[ -f "$libc" ]]; then
2125
arg="sha1=$(sha1sum "$libc" | awk '{print $1}')"
2226
fi
2327

0 commit comments

Comments
 (0)