Skip to content

Instantly share code, notes, and snippets.

@jonasbn
Created January 23, 2017 13:47
Show Gist options
  • Save jonasbn/0a76381c54463e4fff110545fc5777e6 to your computer and use it in GitHub Desktop.
Save jonasbn/0a76381c54463e4fff110545fc5777e6 to your computer and use it in GitHub Desktop.
#!/bin/sh
# script to change the dynamic lib paths and ids for oracle instant client
# exes and libs
# REF: http://www.nntp.perl.org/group/perl.dbi.users/2013/04/msg36561.html
# proces all the executable files in this directory
for exe in sqlplus adrci genezi uidrvci
do
echo "adjusting executable $exe"
baseexe=`basename $exe`
otool -L $exe | awk '/oracle/ {print $1}' | while read lib
do
echo "adjusting lib $lib"
baselib=`basename $lib`
if [ "$baseexe" = "$baselib" ]
then
echo "changing id to $baselib for $exe"
install_name_tool -id $baselib $exe
else
echo "changing path id for $lib in $exe"
install_name_tool -change $lib @executable_path/$baselib $exe
fi
done
done
for exe in *dylib*
do
echo "adjusting executable $exe"
baseexe=`basename $exe`
otool -L $exe | awk '/oracle/ {print $1}' | while read lib
do
echo "adjusting lib $lib"
baselib=`basename $lib`
if [ "$baseexe" = "$baselib" ]
then
echo "changing id to $baselib for $exe"
install_name_tool -id $baselib $exe
else
echo "changing path id for $lib in $exe"
install_name_tool -change $lib @loader_path/$baselib $exe
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment