home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / lucid / lemacs-19.6 / install.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1992-06-29  |  1.9 KB  |  110 lines

  1. #!/bin/sh
  2.  
  3. #
  4. # install - install a program, script, or datafile
  5. # This comes from X11R5; it is not part of Emacs.
  6. #
  7. # $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
  8. #
  9. # This script is compatible with the BSD install script, but was written
  10. # from scratch.
  11. #
  12.  
  13.  
  14. # set DOITPROG to echo to test this script
  15.  
  16. doit="${DOITPROG:-}"
  17.  
  18.  
  19. # put in absolute paths if you don't have them in your path; or use env. vars.
  20.  
  21. mvprog="${MVPROG:-mv}"
  22. cpprog="${CPPROG:-cp}"
  23. chmodprog="${CHMODPROG:-chmod}"
  24. chownprog="${CHOWNPROG:-chown}"
  25. chgrpprog="${CHGRPPROG:-chgrp}"
  26. stripprog="${STRIPPROG:-strip}"
  27. rmprog="${RMPROG:-rm}"
  28.  
  29. instcmd="$mvprog"
  30. chmodcmd=""
  31. chowncmd=""
  32. chgrpcmd=""
  33. stripcmd=""
  34. rmcmd="$rmprog -f"
  35. src=""
  36. dst=""
  37.  
  38. while [ x"$1" != x ]; do
  39.     case $1 in
  40.     -c) instcmd="$cpprog"
  41.         shift
  42.         continue;;
  43.  
  44.     -m) chmodcmd="$chmodprog $2"
  45.         shift
  46.         shift
  47.         continue;;
  48.  
  49.     -o) chowncmd="$chownprog $2"
  50.         shift
  51.         shift
  52.         continue;;
  53.  
  54.     -g) chgrpcmd="$chgrpprog $2"
  55.         shift
  56.         shift
  57.         continue;;
  58.  
  59.     -s) stripcmd="$stripprog"
  60.         shift
  61.         continue;;
  62.  
  63.     *)  if [ x"$src" = x ]
  64.         then
  65.         src=$1
  66.         else
  67.         dst=$1
  68.         fi
  69.         shift
  70.         continue;;
  71.     esac
  72. done
  73.  
  74. if [ x"$src" = x ]
  75. then
  76.     echo "install:  no input file specified"
  77.     exit 1
  78. fi
  79.  
  80. if [ x"$dst" = x ]
  81. then
  82.     echo "install:  no destination specified"
  83.     exit 1
  84. fi
  85.  
  86.  
  87. # if destination is a directory, append the input filename; if your system
  88. # does not like double slashes in filenames, you may need to add some logic
  89.  
  90. if [ -d $dst ]
  91. then
  92.     dst="$dst"/`basename $src`
  93. fi
  94.  
  95.  
  96. # get rid of the old one and mode the new one in
  97.  
  98. $doit $rmcmd $dst
  99. $doit $instcmd $src $dst
  100.  
  101.  
  102. # and set any options; do chmod last to preserve setuid bits
  103.  
  104. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; fi
  105. if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; fi
  106. if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; fi
  107. if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; fi
  108.  
  109. exit 0
  110.