syminst.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #!/bin/sh
  2. # $XConsortium: syminst.sh /main/2 1995/07/19 18:05:57 drk $
  3. #
  4. # syminst - install with a symbolic link back to the build tree
  5. #
  6. # set DOITPROG to echo to test this script
  7. doit="${DOITPROG-}"
  8. # put in absolute paths if you don't have them in your path; or use env. vars.
  9. lnprog="${LNPROG-ln -s}"
  10. rmprog="${RMPROG-rm}"
  11. instcmd="$lnprog"
  12. rmcmd="$rmprog -f"
  13. srcdir=`pwd`/
  14. src=""
  15. dst=""
  16. while [ x"$1" != x ]; do
  17. case $1 in
  18. -c) shift
  19. continue;;
  20. -m) shift
  21. shift
  22. continue;;
  23. -o) shift
  24. shift
  25. continue;;
  26. -g) shift
  27. shift
  28. continue;;
  29. -s) shift
  30. continue;;
  31. -DIR) srcdir=`echo $2 | sed 's;/\./;/;g'`/
  32. shift
  33. shift
  34. continue;;
  35. *) if [ x"$src" = x ]
  36. then
  37. src=$1
  38. else
  39. dst=$1
  40. fi
  41. shift
  42. continue;;
  43. esac
  44. done
  45. if [ x"$src" = x ]
  46. then
  47. echo "syminst: no input file specified"
  48. exit 1
  49. fi
  50. if [ x"$dst" = x ]
  51. then
  52. echo "syminst: no destination specified"
  53. exit 1
  54. fi
  55. # if destination is a directory, append the input filename; if your system
  56. # does not like double slashes in filenames, you may need to add some logic
  57. if [ -d $dst ]
  58. then
  59. dst="$dst"/`basename $src`
  60. fi
  61. case $src in
  62. /*) srcdir=""
  63. instcmd=cp;;
  64. esac
  65. # get rid of the old one and mode the new one in
  66. $doit $rmcmd $dst
  67. $doit $instcmd $srcdir$src $dst
  68. exit 0