home *** CD-ROM | disk | FTP | other *** search
/ Practical Algorithms for Image Analysis / Practical Algorithms for Image Analysis.iso / TARFILE.GZ / tarfile / libtiff / port / install.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1999-09-11  |  6.6 KB  |  247 lines

  1. #! /bin/sh
  2. #    $Header: /usr/people/sam/tiff/port/RCS/install.sh.in,v 1.19 1996/01/10 19:36:09 sam Rel $
  3. #
  4. # Warning, this file was automatically created by the TIFF configure script
  5. #
  6. # HylaFAX Facsimile Software
  7. #
  8. # Copyright (c) 1990-1996 Sam Leffler
  9. # Copyright (c) 1991-1996 Silicon Graphics, Inc.
  10. # HylaFAX is a trademark of Silicon Graphics
  11. # Permission to use, copy, modify, distribute, and sell this software and 
  12. # its documentation for any purpose is hereby granted without fee, provided
  13. # that (i) the above copyright notices and this permission notice appear in
  14. # all copies of the software and related documentation, and (ii) the names of
  15. # Sam Leffler and Silicon Graphics may not be used in any advertising or
  16. # publicity relating to the software without the specific, prior written
  17. # permission of Sam Leffler and Silicon Graphics.
  18. # THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  19. # EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  20. # WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  21. # IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  22. # ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  23. # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  24. # WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  25. # LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  26. # OF THIS SOFTWARE.
  27. #
  28.  
  29. #
  30. # Warning, this file was automatically created by the HylaFAX configure script
  31. #
  32. # VERSION:    v3.4033
  33. # DATE:        Tue Mar  3 21:47:18 EST 1998
  34. # TARGET:    i586-unknown-linux
  35. #
  36.  
  37. #
  38. # Shell script to emulate Silicon Graphics install program.
  39. # We emulate the non-standard interface used by install so
  40. # that we can build SGI inst packages on SGI systems.  Note
  41. # that we cannot emulate everything because we don't maintain
  42. # a history of installed software; thus we cannot tell when
  43. # configuration files have been modified and save old copies.
  44. #
  45. # NB: we don't do chown/chmod/chgrp by default; it must be
  46. #     explicitly set on the command line.
  47. #
  48.  
  49. #
  50. # install [options] files ...
  51. # Options are:
  52. #
  53. # -o        save existing target foo as OLDfoo
  54. # -O        remove existing target foo, if it fails save as OLDfoo
  55. # -m mode    set mode of installed target
  56. # -u uid    set uid of installed target
  57. # -g gid    set gid of installed target
  58. # -root path    set ROOT directory for target pathnames
  59. # -dir        create directories
  60. # -fifo        create FIFO special files
  61. # -ln path    create hard link
  62. # -lns path    create symbolic link
  63. # -src path    source pathname different from target
  64. # -f dir    install files in the target directory ROOT/dir
  65. # -F dir    like -f, but create directories that do not exist
  66. # -v        echo actions
  67. # -idb stuff    specify package and, optionally, do special work
  68. #
  69. preopts=
  70. postopts=
  71. SaveFirst=no
  72. HasSource=yes
  73. RemoveFirst=no
  74. NoUpdate=no
  75. Suggested=no
  76. Updated=no
  77.  
  78. CMD=cp
  79. SRC=
  80. FILES=
  81. DESTDIR=
  82. CHMOD=":"
  83. CHOWN=":"
  84. CHGRP=":"
  85. RM="rm -f"
  86. MV="mv -f"
  87. ECHO=echo
  88. VERBOSE=":"
  89. STRIP="/usr/bin/strip"
  90. CMP=cmp
  91.  
  92. TARGETS=
  93. while [ x"$1" != x ]
  94. do
  95.     arg=$1
  96.     case $arg in
  97.     -m)        shift; CHMOD="/bin/chmod $1";;
  98.     -u)        shift; CHOWN="@CHOWN@ $1";;
  99.     -g)        shift; CHGRP="@CHGRP@ $1";;
  100.     -o)        SaveFirst=yes;;
  101.     -O)        RemoveFirst=yes; SaveFirst=yes;;
  102.     -root)    shift; ROOT=$1;;
  103.     -dir)    CMD=mkdir; HasSource=no;
  104.         RM=":"; STRIP=":"
  105.         ;;
  106.     -fifo)    CMD=@MKFIFO@; HasSource=no;
  107.         x=`echo $CMD | /bin/sed 's;.*/;;'`;
  108.         test $x = mknod && postopts="p";
  109.         STRIP=":"
  110.         ;;
  111.     -ln)    shift; CMD=/bin/ln; SRC="$1"
  112.         STRIP=":"
  113.         ;;
  114.     -lns)    shift; CMD=/bin/ln; preopts="-s"; SRC="$1"
  115.         STRIP=":"
  116.         ;;
  117.     -src)    shift; SRC="$1";;
  118.     -[fF])    shift; DESTDIR="$1";;
  119.     -idb)    shift; opt="$1"
  120.         case "$opt" in
  121.         *config\(update\)*)    Updated=yes;;
  122.         *config\(suggest\)*)    Suggested=yes;;
  123.         *config\(noupdate\)*)    NoUpdate=yes;;
  124.         *nostrip*)        STRIP=":";;
  125.         esac
  126.         ;;
  127.     # these are skipped/not handled
  128.     -new|-rawidb|-blk|-chr) shift;;
  129.     -v)        VERBOSE=$ECHO;;
  130.     -*)     ;;
  131.     *)        TARGETS="$TARGETS $arg";;
  132.     esac
  133.     shift
  134. done
  135.  
  136. #
  137. # Install the specified target.
  138. #
  139. install()
  140. {
  141.     src=$1 target=$2
  142.     if [ $RemoveFirst = yes -a -f $target ]; then
  143.     $VERBOSE "$RM $target"
  144.     $RM $target
  145.     fi
  146.     if [ $SaveFirst = yes -a -f $target ]; then
  147.     bf=`echo $src | /bin/sed 's;.*/;;'`
  148.     $VERBOSE "$MV $target $ROOT/$DESTDIR/OLD$bf"
  149.     $MV $target $ROOT/$DESTDIR/OLD$bf
  150.     fi
  151.     if [ -z "$SRC" -a $HasSource = yes ]; then
  152.     $VERBOSE "$CMD $preopts $src $target $postopts"
  153.     $CMD $preopts $f $target $postopts
  154.     else
  155.     $VERBOSE "$CMD $preopts $SRC $target $postopts"
  156.     $CMD $preopts $SRC $target $postopts
  157.     fi
  158.     if [ $? -eq 0 ]; then
  159.     $VERBOSE "$CHOWN $target"
  160.     $CHOWN $target
  161.     $VERBOSE "$CHGRP $target"
  162.     $CHGRP $target
  163.     $VERBOSE "$CHMOD $target"
  164.     $CHMOD $target
  165.     if [ $STRIP != ":" -a -x $ROOT/$DESTDIR/$f ]; then
  166.         $STRIP $target >/dev/null 2>&1 || true
  167.         $VERBOSE "$STRIP $target"
  168.     fi
  169.     fi
  170. }
  171.  
  172. if [ $Suggested = yes ]; then
  173.     #
  174.     # A suggested file.  If an existing target does
  175.     # not exist, then install it.  Otherwise, install
  176.     # it as target.N if it's different from the current
  177.     # installed target.
  178.     #
  179.     # NB: cannot be used with a special file 'cuz we
  180.     #     use test -f to see if the file exists.
  181.     #
  182.     for f in $TARGETS; do
  183.     t=$ROOT/$DESTDIR/$f
  184.     if [ -f $t ]; then
  185.         if [ -z "$SRC" -a $HasSource = yes ]; then
  186.         $CMP -s $f $t || {
  187.             $ECHO "*** Warning, target has local changes, installing $f as $t.N"
  188.             install $f $t.N;
  189.         }
  190.         else
  191.         $CMP -s $SRC $t || {
  192.             $ECHO "*** Warning, target has local changes, installing $f as $t.N"
  193.             install $f $t.N
  194.         }
  195.         fi
  196.     else
  197.         install $f $t
  198.     fi
  199.     done
  200. elif [ $Updated = yes ]; then
  201.     #
  202.     # A file to be updated.  If an existing target does
  203.     # not exist, then install it.  Otherwise, install
  204.     # it as target and save the old version as target.O
  205.     # if the old version is different from the current
  206.     # installed target.
  207.     #
  208.     # NB: cannot be used with a special file 'cuz we
  209.     #     use test -f to see if the file exists.
  210.     #
  211.     for f in $TARGETS; do
  212.     t=$ROOT/$DESTDIR/$f
  213.     if [ -f $t ]; then
  214.         if [ -z "$SRC" -a $HasSource = yes ]; then
  215.         $CMP -s $f $t || $MV $t $t.O
  216.         else
  217.         $CMP -s $SRC $t || $MV $t $t.O
  218.         fi
  219.     fi
  220.     install $f $t
  221.     done
  222. elif [ $NoUpdate = yes ]; then
  223.     #
  224.     # A file that is never to be updated; the target
  225.     # is created only if it does not exist.
  226.     #
  227.     # NB: cannot be used with a special file 'cuz we
  228.     #     use test -f to see if the file exists.
  229.     #
  230.     for f in $TARGETS; do
  231.     t=$ROOT/$DESTDIR/$f
  232.     test -f $t || install $f $t
  233.     done
  234. else
  235.     #
  236.     # Normal case, a target that should be installed
  237.     # with the existing copy, optionally, saved first.
  238.     #
  239.     for f in $TARGETS; do
  240.     install $f $ROOT/$DESTDIR/$f
  241.     done
  242. fi
  243.