Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Bash script to create symbolic links to shared libraries

By: a guest on Feb 26th, 2012  |  syntax: None  |  size: 1.06 KB  |  views: 34  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. libmythings.so -> libmythings.so.1 -> libmythings.so.1.1
  2. libotherthings.so -> libotherthings.so.5 -> libotherthings.so.5.11
  3.        
  4. for baselib in "$@"
  5. do
  6.      shortlib=$baselib
  7.      while extn=$(echo $shortlib | sed 's/.[0-9][0-9]*$//')
  8.            [ -n "$extn" ]
  9.      do
  10.          shortlib=$(basename $shortlib $extn)
  11.          ln -s $baselib $shortlib
  12.      done
  13. done
  14.        
  15. for baselib in "$@"
  16. do
  17.      shortlib=$baselib
  18.      while extn=$(echo $shortlib | sed 's/.[0-9][0-9]*$//')
  19.            [ -n "$extn" ]
  20.      do
  21.          shorterlib=$(basename $shortlib $extn)
  22.          ln -s $shortlib $shorterlib
  23.          shortlib=$shorterlib
  24.      done
  25. done
  26.        
  27. set -- libname.so.5.1.1
  28.  
  29. for baselib in "$@"
  30. do
  31.     shortlib=$baselib
  32.     while extn=$(echo $shortlib | sed -n '/.[0-9][0-9]*$/s/.*(.[0-9][0-9]*)$/1/p')
  33.           [ -n "$extn" ]
  34.     do
  35.         shortlib=$(basename $shortlib $extn)
  36.         echo ln -s $baselib $shortlib
  37.     done
  38. done
  39.        
  40. ln -s libname.so.5.1.1 libname.so.5.1
  41. ln -s libname.so.5.1.1 libname.so.5
  42. ln -s libname.so.5.1.1 libname.so
  43.        
  44. ldconfig -v
  45.        
  46. ldconfig /path/to/dir
clone this paste RAW Paste Data