home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / ircd_os2.zip / bsdinstall < prev    next >
Text File  |  1996-01-06  |  1KB  |  84 lines

  1. #! /bin/sh
  2. #
  3. #    @(#)install.sh    4.5    (Berkeley)    10/12/83
  4. #
  5. cmd=/bin/mv
  6. strip=""
  7. chmod="/bin/chmod 755"
  8. chown="chown -f root"
  9. chgrp="/bin/chgrp -f bin"
  10. while true ; do
  11.     case $1 in
  12.         -s )    strip="strip"
  13.             shift
  14.             ;;
  15.         -c )    cmd="/bin/cp"
  16.             shift
  17.             ;;
  18.         -m )    chmod="/bin/chmod $2"
  19.             shift
  20.             shift
  21.             ;;
  22.         -o )    chown="/etc/chown -f $2"
  23.             shift
  24.             shift
  25.             ;;
  26.         -g )    chgrp="/bin/chgrp -f $2"
  27.             shift
  28.             shift
  29.             ;;
  30.         -d )    cmd="/bin/mkdir"
  31.             shift
  32.             ;;
  33.         * )    break
  34.             ;;
  35.     esac
  36. done
  37.  
  38. if [ ! ${2-""} ]
  39. then    echo "install: no destination specified"
  40.     exit 1
  41. fi
  42. if [ ${3-""} ]
  43. then    echo "install: too many files specified -> $*"
  44.     exit 1
  45. fi
  46. if [ $1 = $2 -o $2 = . ]
  47. then    echo "install: can't move $1 onto itself"
  48.     exit 1
  49. fi
  50. case $cmd in
  51. /bin/mkdir )
  52.     file=$2/$1
  53.     ;;
  54. * )
  55.     if [ '!' -f $1 ]
  56.     then    echo "install: can't open $1"
  57.         exit 1
  58.     fi
  59.     if [ -d $2 ]
  60.     then    file=$2/$1
  61.     else    file=$2
  62.     fi
  63.     /bin/rm -f $file
  64.     ;;
  65. esac
  66.  
  67. case $cmd in
  68. /bin/mkdir )
  69.     if [ ! -d "$file" ]
  70.     then    $cmd $file
  71.     fi
  72.     ;;
  73. * )
  74.     $cmd $1 $file
  75.     if [ $strip ]
  76.     then    $strip $file
  77.     fi
  78.     ;;
  79. esac
  80.  
  81. $chown $file
  82. $chgrp $file
  83. $chmod $file
  84.