From 106e0ada802c16b04db606747effc3596e117566 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 15 Nov 2021 17:28:12 +0100 Subject: [PATCH] Added more MacOS tools --- macos/get_library_path.sh | 14 ++++++++++++++ macos/search_rpath.sh | 14 ++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 macos/get_library_path.sh create mode 100644 macos/search_rpath.sh diff --git a/macos/get_library_path.sh b/macos/get_library_path.sh new file mode 100644 index 00000000..85131608 --- /dev/null +++ b/macos/get_library_path.sh @@ -0,0 +1,14 @@ +#!/bin/sh +set -e + +# Options +WANTED_LIB=$1 +EXEC=$2 + +# Function to extract the first element of a space seperated list +get_first_arg() { + echo $1 +} + +# Get current path +echo $(get_first_arg $(otool -L $EXEC | grep $WANTED_LIB)) \ No newline at end of file diff --git a/macos/search_rpath.sh b/macos/search_rpath.sh new file mode 100644 index 00000000..8acdd4fe --- /dev/null +++ b/macos/search_rpath.sh @@ -0,0 +1,14 @@ +#!/bin/sh +set -e + +# Options +RPATH_NAME=$1 +EXEC=$2 + +# Function to keep only the second arg +get_second_arg() { + echo $2 +} + +# Get current rpath +echo $(get_second_arg $(otool -l $EXEC | grep $RPATH_NAME | grep path)) \ No newline at end of file