这个脚本的思路是这样的
具体结果
function change_rpath()
{
RPATH01=.
RPATH07=\$ORIGIN
RPATH12=\$ORIGIN:/lib
RPATH30=\$ORIGIN:/lib/aarch64-linux-gnu
RPATH35=\$ORIGIN:/lib:/lib/aarch64-linux-gnu
RPATH_INFO=`chrpath ${1}`
#libHpws.Generic.so: RPATH=:/libs
echo ${RPATH_INFO}
RPATH=`echo ${RPATH_INFO#*RPATH=}`
if [[ ${RPATH_INFO} == ${RPATH} ]]; then
RPATH=`echo ${RPATH_INFO#*RUNPATH=}`
fi
#:/libs
echo ${RPATH}
length=${#RPATH}
#6
echo ${length}
if [[ ${length} -ge 35 ]]; then
RPATH=${RPATH35}
elif [[ ${length} -ge 30 ]]; then
RPATH=${RPATH30}
elif [[ ${length} -ge 12 ]]; then
RPATH=${RPATH12}
elif [[ ${length} -ge 7 ]]; then
RPATH=${RPATH07}
else
RPATH=${RPATH01}
fi
result=`chrpath -r ${RPATH} ${1}`
# chrpath ${1}
}