head	1.3;
access;
symbols
	perseant-exfatfs-base-20250801:1.3
	perseant-exfatfs-base-20240630:1.3
	perseant-exfatfs:1.3.0.22
	perseant-exfatfs-base:1.3
	cjep_sun2x:1.3.0.20
	cjep_sun2x-base:1.3
	cjep_staticlib_x-base1:1.3
	cjep_staticlib_x:1.3.0.18
	cjep_staticlib_x-base:1.3
	phil-wifi-20200421:1.3
	phil-wifi-20200411:1.3
	phil-wifi-20200406:1.3
	pgoyette-compat-merge-20190127:1.3
	pgoyette-compat-20190127:1.3
	pgoyette-compat-20190118:1.3
	pgoyette-compat-1226:1.3
	pgoyette-compat-1126:1.3
	pgoyette-compat-1020:1.3
	pgoyette-compat-0930:1.3
	pgoyette-compat-0906:1.3
	pgoyette-compat-0728:1.3
	pgoyette-compat-0625:1.3
	pgoyette-compat-0521:1.3
	pgoyette-compat-0502:1.3
	pgoyette-compat-0422:1.3
	pgoyette-compat-0415:1.3
	pgoyette-compat-0407:1.3
	pgoyette-compat-0330:1.3
	pgoyette-compat-0322:1.3
	pgoyette-compat-0315:1.3
	pgoyette-compat:1.3.0.16
	pgoyette-compat-base:1.3
	perseant-stdc-iso10646:1.3.0.14
	perseant-stdc-iso10646-base:1.3
	prg-localcount2-base3:1.3
	prg-localcount2-base2:1.3
	prg-localcount2-base1:1.3
	prg-localcount2:1.3.0.12
	prg-localcount2-base:1.3
	pgoyette-localcount-20170426:1.3
	bouyer-socketcan-base1:1.3
	pgoyette-localcount-20170320:1.3
	bouyer-socketcan:1.3.0.10
	bouyer-socketcan-base:1.3
	pgoyette-localcount-20170107:1.3
	pgoyette-localcount-20161104:1.3
	localcount-20160914:1.3
	pgoyette-localcount-20160806:1.3
	pgoyette-localcount-20160726:1.3
	pgoyette-localcount:1.3.0.8
	pgoyette-localcount-base:1.3
	netbsd-5-2-3-RELEASE:1.2
	netbsd-5-1-5-RELEASE:1.2
	yamt-pagecache-base9:1.3
	yamt-pagecache-tag8:1.3
	tls-earlyentropy:1.3.0.4
	tls-earlyentropy-base:1.3
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.3
	riastradh-drm2-base3:1.3
	netbsd-5-2-2-RELEASE:1.2
	netbsd-5-1-4-RELEASE:1.2
	netbsd-5-2-1-RELEASE:1.2
	netbsd-5-1-3-RELEASE:1.2
	agc-symver:1.3.0.6
	agc-symver-base:1.3
	tls-maxphys-base:1.3
	yamt-pagecache-base8:1.3
	netbsd-5-2:1.2.0.6
	yamt-pagecache-base7:1.3
	netbsd-5-2-RELEASE:1.2
	netbsd-5-2-RC1:1.2
	yamt-pagecache-base6:1.3
	yamt-pagecache-base5:1.3
	yamt-pagecache-base4:1.3
	netbsd-5-1-2-RELEASE:1.2
	netbsd-5-1-1-RELEASE:1.2
	yamt-pagecache-base3:1.3
	yamt-pagecache-base2:1.3
	yamt-pagecache:1.3.0.2
	yamt-pagecache-base:1.3
	cherry-xenmp:1.2.0.22
	cherry-xenmp-base:1.2
	bouyer-quota2-nbase:1.2
	bouyer-quota2:1.2.0.20
	bouyer-quota2-base:1.2
	matt-mips64-premerge-20101231:1.2
	matt-nb5-mips64-premerge-20101231:1.2
	matt-nb5-pq3:1.2.0.18
	matt-nb5-pq3-base:1.2
	netbsd-5-1:1.2.0.16
	netbsd-5-1-RELEASE:1.2
	netbsd-5-1-RC4:1.2
	matt-nb5-mips64-k15:1.2
	netbsd-5-1-RC3:1.2
	netbsd-5-1-RC2:1.2
	netbsd-5-1-RC1:1.2
	netbsd-5-0-2-RELEASE:1.2
	matt-nb5-mips64-premerge-20091211:1.2
	matt-premerge-20091211:1.2
	matt-nb5-mips64-u2-k2-k4-k7-k8-k9:1.2
	matt-nb4-mips64-k7-u2a-k9b:1.2
	matt-nb5-mips64-u1-k1-k5:1.2
	matt-nb5-mips64:1.2.0.14
	netbsd-5-0-1-RELEASE:1.2
	jym-xensuspend-nbase:1.2
	netbsd-5-0:1.2.0.12
	netbsd-5-0-RELEASE:1.2
	netbsd-5-0-RC4:1.2
	netbsd-5-0-RC3:1.2
	netbsd-5-0-RC2:1.2
	jym-xensuspend:1.2.0.10
	jym-xensuspend-base:1.2
	netbsd-5-0-RC1:1.2
	netbsd-5:1.2.0.8
	netbsd-5-base:1.2
	matt-mips64-base2:1.2
	matt-mips64:1.1.1.4.0.24
	netbsd-4-0-1-RELEASE:1.1.1.4
	wrstuden-revivesa-base-3:1.2
	wrstuden-revivesa-base-2:1.2
	wrstuden-fixsa-newbase:1.1.1.4
	wrstuden-revivesa-base-1:1.2
	yamt-pf42-base4:1.2
	yamt-pf42-base3:1.2
	hpcarm-cleanup-nbase:1.2
	yamt-pf42-baseX:1.2
	yamt-pf42-base2:1.2
	wrstuden-revivesa:1.2.0.4
	wrstuden-revivesa-base:1.2
	yamt-pf42:1.2.0.2
	yamt-pf42-base:1.2
	keiichi-mipv6:1.1.1.4.0.22
	keiichi-mipv6-base:1.1.1.4
	matt-armv6-nbase:1.1.1.4
	matt-armv6-prevmlocking:1.1.1.4
	wrstuden-fixsa-base-1:1.1.1.4
	netbsd-4-0:1.1.1.4.0.20
	netbsd-4-0-RELEASE:1.1.1.4
	cube-autoconf:1.1.1.4.0.18
	cube-autoconf-base:1.1.1.4
	netbsd-4-0-RC5:1.1.1.4
	netbsd-4-0-RC4:1.1.1.4
	netbsd-4-0-RC3:1.1.1.4
	netbsd-4-0-RC2:1.1.1.4
	netbsd-4-0-RC1:1.1.1.4
	matt-armv6:1.1.1.4.0.16
	matt-armv6-base:1.1.1.4
	matt-mips64-base:1.1.1.4
	hpcarm-cleanup:1.1.1.4.0.14
	hpcarm-cleanup-base:1.1.1.4
	netbsd-3-1-1-RELEASE:1.1.1.4
	netbsd-3-0-3-RELEASE:1.1.1.4
	wrstuden-fixsa:1.1.1.4.0.12
	wrstuden-fixsa-base:1.1.1.4
	abandoned-netbsd-4-base:1.1.1.4
	abandoned-netbsd-4:1.1.1.4.0.6
	netbsd-3-1:1.1.1.4.0.8
	netbsd-3-1-RELEASE:1.1.1.4
	netbsd-3-0-2-RELEASE:1.1.1.4
	netbsd-3-1-RC4:1.1.1.4
	netbsd-3-1-RC3:1.1.1.4
	netbsd-3-1-RC2:1.1.1.4
	netbsd-3-1-RC1:1.1.1.4
	netbsd-4:1.1.1.4.0.10
	netbsd-4-base:1.1.1.4
	netbsd-3-0-1-RELEASE:1.1.1.4
	netbsd-3-0:1.1.1.4.0.4
	netbsd-3-0-RELEASE:1.1.1.4
	netbsd-3-0-RC6:1.1.1.4
	netbsd-3-0-RC5:1.1.1.4
	netbsd-3-0-RC4:1.1.1.4
	netbsd-3-0-RC3:1.1.1.4
	netbsd-3-0-RC2:1.1.1.4
	netbsd-3-0-RC1:1.1.1.4
	netbsd-2-0-3-RELEASE:1.1.1.2.2.2
	netbsd-2-1:1.1.1.2.2.2.0.4
	netbsd-2-1-RELEASE:1.1.1.2.2.2
	netbsd-2-1-RC6:1.1.1.2.2.2
	netbsd-2-1-RC5:1.1.1.2.2.2
	netbsd-2-1-RC4:1.1.1.2.2.2
	netbsd-2-1-RC3:1.1.1.2.2.2
	netbsd-2-1-RC2:1.1.1.2.2.2
	netbsd-2-1-RC1:1.1.1.2.2.2
	netbsd-2-0-2-RELEASE:1.1.1.2.2.2
	netbsd-3:1.1.1.4.0.2
	netbsd-3-base:1.1.1.4
	netbsd-2-0-1-RELEASE:1.1.1.2.2.2
	netbsd-2:1.1.1.2.2.2.0.2
	netbsd-2-base:1.1.1.2.2.2
	netbsd-2-0-RELEASE:1.1.1.2.2.2
	netbsd-2-0-RC5:1.1.1.2.2.2
	netbsd-2-0-RC4:1.1.1.2.2.2
	netbsd-2-0-RC3:1.1.1.2.2.2
	netbsd-2-0-RC2:1.1.1.2.2.2
	netbsd-2-0-RC1:1.1.1.2.2.2
	heimdal-1-6-3-merge-to-netbsd-2-0-top:1.1.1.4
	heimdal-0-6-3:1.1.1.4
	heimdal-0-6-2-merge-to-netbsd-2-0:1.1.1.3
	heimdal-0-6-2:1.1.1.3
	heimdal-1-6-1-merge-to-netbsd-2-0:1.1.1.3
	heimdal-0-6-1:1.1.1.3
	netbsd-2-0:1.1.1.2.0.2
	netbsd-2-0-base:1.1.1.2
	netbsd-1-6-PATCH002-RELEASE:1.1.1.1
	netbsd-1-6-PATCH002:1.1.1.1
	netbsd-1-6-PATCH002-RC4:1.1.1.1
	netbsd-1-6-PATCH002-RC3:1.1.1.1
	netbsd-1-6-PATCH002-RC2:1.1.1.1
	netbsd-1-6-PATCH002-RC1:1.1.1.1
	heimdal-0-6:1.1.1.2
	netbsd-1-6-PATCH001:1.1.1.1
	netbsd-1-6-PATCH001-RELEASE:1.1.1.1
	netbsd-1-6-PATCH001-RC3:1.1.1.1
	netbsd-1-6-PATCH001-RC2:1.1.1.1
	netbsd-1-6-PATCH001-RC1:1.1.1.1
	fvdl_fs64_base:1.1.1.2
	heimdal-0-5:1.1.1.2
	netbsd-1-6-RELEASE:1.1.1.1
	netbsd-1-6-RC3:1.1.1.1
	netbsd-1-6-RC2:1.1.1.1
	netbsd-1-6-RC1:1.1.1.1
	netbsd-1-6:1.1.1.1.0.6
	netbsd-1-6-base:1.1.1.1
	netbsd-1-5-PATCH003:1.1.1.1
	v0-4e:1.1.1.1
	netbsd-1-5-PATCH002:1.1.1.1
	v0-3f:1.1.1.1
	netbsd-1-5-PATCH001:1.1.1.1
	v0-3e:1.1.1.1
	netbsd-1-5-RELEASE:1.1.1.1
	netbsd-1-5-BETA2:1.1.1.1
	netbsd-1-5-BETA:1.1.1.1
	netbsd-1-5-ALPHA2:1.1.1.1
	v0-3a:1.1.1.1
	minoura-xpg4dl:1.1.1.1.0.4
	minoura-xpg4dl-base:1.1.1.1
	netbsd-1-5:1.1.1.1.0.2
	netbsd-1-5-base:1.1.1.1
	v0-2t-netbsd-cryptosrc-intl:1.1.1.1
	HEIMDAL:1.1.1;
locks; strict;
comment	@# @;


1.3
date	2011.08.28.16.22.04;	author elric;	state dead;
branches;
next	1.2;

1.2
date	2008.03.22.08.36.49;	author mlelstv;	state Exp;
branches;
next	1.1;

1.1
date	2000.06.16.18.31.35;	author thorpej;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2000.06.16.18.31.35;	author thorpej;	state Exp;
branches
	1.1.1.1.4.1;
next	1.1.1.2;

1.1.1.2
date	2002.09.12.12.41.31;	author joda;	state Exp;
branches
	1.1.1.2.2.1;
next	1.1.1.3;

1.1.1.3
date	2004.04.02.14.47.01;	author lha;	state Exp;
branches;
next	1.1.1.4;

1.1.1.4
date	2004.09.14.07.45.54;	author lha;	state Exp;
branches;
next	;

1.1.1.1.4.1
date	2000.06.16.18.31.35;	author thorpej;	state dead;
branches;
next	1.1.1.1.4.2;

1.1.1.1.4.2
date	2000.06.16.18.31.36;	author thorpej;	state Exp;
branches;
next	;

1.1.1.2.2.1
date	2004.04.21.04.55.35;	author jmc;	state Exp;
branches;
next	1.1.1.2.2.2;

1.1.1.2.2.2
date	2004.09.17.04.34.28;	author jmc;	state Exp;
branches;
next	;


desc
@@


1.3
log
@Remove crypto/dist/heimdal and its associated build infrastructure as
it has been replaced by crypto/external/bsd/heimdal.
@
text
@#!/bin/sh
# install - install a program, script, or datafile

scriptversion=2006-10-14.15

# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.

nl='
'
IFS=" ""	$nl"

# set DOITPROG to echo to test this script

# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
if test -z "$doit"; then
  doit_exec=exec
else
  doit_exec=$doit
fi

# Put in absolute file names if you don't have them in your path;
# or use environment vars.

mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"

posix_glob=
posix_mkdir=

# Desired mode of installed file.
mode=0755

chmodcmd=$chmodprog
chowncmd=
chgrpcmd=
stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=
dst=
dir_arg=
dstarg=
no_target_directory=

usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
   or: $0 [OPTION]... SRCFILES... DIRECTORY
   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
   or: $0 [OPTION]... -d DIRECTORIES...

In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.

Options:
-c         (ignored)
-d         create directories instead of installing files.
-g GROUP   $chgrpprog installed files to GROUP.
-m MODE    $chmodprog installed files to MODE.
-o USER    $chownprog installed files to USER.
-s         $stripprog installed files.
-t DIRECTORY  install into DIRECTORY.
-T         report an error if DSTFILE is a directory.
--help     display this help and exit.
--version  display version info and exit.

Environment variables override the default commands:
  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"

while test $# -ne 0; do
  case $1 in
    -c) shift
        continue;;

    -d) dir_arg=true
        shift
        continue;;

    -g) chgrpcmd="$chgrpprog $2"
        shift
        shift
        continue;;

    --help) echo "$usage"; exit $?;;

    -m) mode=$2
        shift
        shift
	case $mode in
	  *' '* | *'	'* | *'
'*	  | *'*'* | *'?'* | *'['*)
	    echo "$0: invalid mode: $mode" >&2
	    exit 1;;
	esac
        continue;;

    -o) chowncmd="$chownprog $2"
        shift
        shift
        continue;;

    -s) stripcmd=$stripprog
        shift
        continue;;

    -t) dstarg=$2
	shift
	shift
	continue;;

    -T) no_target_directory=true
	shift
	continue;;

    --version) echo "$0 $scriptversion"; exit $?;;

    --)	shift
	break;;

    -*)	echo "$0: invalid option: $1" >&2
	exit 1;;

    *)  break;;
  esac
done

if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
  # When -d is used, all remaining arguments are directories to create.
  # When -t is used, the destination is already specified.
  # Otherwise, the last argument is the destination.  Remove it from $@@.
  for arg
  do
    if test -n "$dstarg"; then
      # $@@ is not empty: it contains at least $arg.
      set fnord "$@@" "$dstarg"
      shift # fnord
    fi
    shift # arg
    dstarg=$arg
  done
fi

if test $# -eq 0; then
  if test -z "$dir_arg"; then
    echo "$0: no input file specified." >&2
    exit 1
  fi
  # It's OK to call `install-sh -d' without argument.
  # This can happen when creating conditional directories.
  exit 0
fi

if test -z "$dir_arg"; then
  trap '(exit $?); exit' 1 2 13 15

  # Set umask so as not to create temps with too-generous modes.
  # However, 'strip' requires both read and write access to temps.
  case $mode in
    # Optimize common cases.
    *644) cp_umask=133;;
    *755) cp_umask=22;;

    *[0-7])
      if test -z "$stripcmd"; then
	u_plus_rw=
      else
	u_plus_rw='% 200'
      fi
      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
    *)
      if test -z "$stripcmd"; then
	u_plus_rw=
      else
	u_plus_rw=,u+rw
      fi
      cp_umask=$mode$u_plus_rw;;
  esac
fi

for src
do
  # Protect names starting with `-'.
  case $src in
    -*) src=./$src ;;
  esac

  if test -n "$dir_arg"; then
    dst=$src
    dstdir=$dst
    test -d "$dstdir"
    dstdir_status=$?
  else

    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
    # might cause directories to be created, which would be especially bad
    # if $src (and thus $dsttmp) contains '*'.
    if test ! -f "$src" && test ! -d "$src"; then
      echo "$0: $src does not exist." >&2
      exit 1
    fi

    if test -z "$dstarg"; then
      echo "$0: no destination specified." >&2
      exit 1
    fi

    dst=$dstarg
    # Protect names starting with `-'.
    case $dst in
      -*) dst=./$dst ;;
    esac

    # If destination is a directory, append the input filename; won't work
    # if double slashes aren't ignored.
    if test -d "$dst"; then
      if test -n "$no_target_directory"; then
	echo "$0: $dstarg: Is a directory" >&2
	exit 1
      fi
      dstdir=$dst
      dst=$dstdir/`basename "$src"`
      dstdir_status=0
    else
      # Prefer dirname, but fall back on a substitute if dirname fails.
      dstdir=`
	(dirname "$dst") 2>/dev/null ||
	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
	     X"$dst" : 'X\(//\)[^/]' \| \
	     X"$dst" : 'X\(//\)$' \| \
	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
	echo X"$dst" |
	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
		   s//\1/
		   q
		 }
		 /^X\(\/\/\)[^/].*/{
		   s//\1/
		   q
		 }
		 /^X\(\/\/\)$/{
		   s//\1/
		   q
		 }
		 /^X\(\/\).*/{
		   s//\1/
		   q
		 }
		 s/.*/./; q'
      `

      test -d "$dstdir"
      dstdir_status=$?
    fi
  fi

  obsolete_mkdir_used=false

  if test $dstdir_status != 0; then
    case $posix_mkdir in
      '')
	# Create intermediate dirs using mode 755 as modified by the umask.
	# This is like FreeBSD 'install' as of 1997-10-28.
	umask=`umask`
	case $stripcmd.$umask in
	  # Optimize common cases.
	  *[2367][2367]) mkdir_umask=$umask;;
	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;

	  *[0-7])
	    mkdir_umask=`expr $umask + 22 \
	      - $umask % 100 % 40 + $umask % 20 \
	      - $umask % 10 % 4 + $umask % 2
	    `;;
	  *) mkdir_umask=$umask,go-w;;
	esac

	# With -d, create the new directory with the user-specified mode.
	# Otherwise, rely on $mkdir_umask.
	if test -n "$dir_arg"; then
	  mkdir_mode=-m$mode
	else
	  mkdir_mode=
	fi

	posix_mkdir=false
	case $umask in
	  *[123567][0-7][0-7])
	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
	    ;;
	  *)
	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0

	    if (umask $mkdir_umask &&
		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
	    then
	      if test -z "$dir_arg" || {
		   # Check for POSIX incompatibilities with -m.
		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
		   # other-writeable bit of parent directory when it shouldn't.
		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
		   case $ls_ld_tmpdir in
		     d????-?r-*) different_mode=700;;
		     d????-?--*) different_mode=755;;
		     *) false;;
		   esac &&
		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
		   }
		 }
	      then posix_mkdir=:
	      fi
	      rmdir "$tmpdir/d" "$tmpdir"
	    else
	      # Remove any dirs left behind by ancient mkdir implementations.
	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
	    fi
	    trap '' 0;;
	esac;;
    esac

    if
      $posix_mkdir && (
	umask $mkdir_umask &&
	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
      )
    then :
    else

      # The umask is ridiculous, or mkdir does not conform to POSIX,
      # or it failed possibly due to a race condition.  Create the
      # directory the slow way, step by step, checking for races as we go.

      case $dstdir in
	/*) prefix=/ ;;
	-*) prefix=./ ;;
	*)  prefix= ;;
      esac

      case $posix_glob in
        '')
	  if (set -f) 2>/dev/null; then
	    posix_glob=true
	  else
	    posix_glob=false
	  fi ;;
      esac

      oIFS=$IFS
      IFS=/
      $posix_glob && set -f
      set fnord $dstdir
      shift
      $posix_glob && set +f
      IFS=$oIFS

      prefixes=

      for d
      do
	test -z "$d" && continue

	prefix=$prefix$d
	if test -d "$prefix"; then
	  prefixes=
	else
	  if $posix_mkdir; then
	    (umask=$mkdir_umask &&
	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
	    # Don't fail if two instances are running concurrently.
	    test -d "$prefix" || exit 1
	  else
	    case $prefix in
	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
	      *) qprefix=$prefix;;
	    esac
	    prefixes="$prefixes '$qprefix'"
	  fi
	fi
	prefix=$prefix/
      done

      if test -n "$prefixes"; then
	# Don't fail if two instances are running concurrently.
	(umask $mkdir_umask &&
	 eval "\$doit_exec \$mkdirprog $prefixes") ||
	  test -d "$dstdir" || exit 1
	obsolete_mkdir_used=true
      fi
    fi
  fi

  if test -n "$dir_arg"; then
    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
  else

    # Make a couple of temp file names in the proper directory.
    dsttmp=$dstdir/_inst.$$_
    rmtmp=$dstdir/_rm.$$_

    # Trap to clean up those temp files at exit.
    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0

    # Copy the file name to the temp name.
    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&

    # and set any options; do chmod last to preserve setuid bits.
    #
    # If any of these fail, we abort the whole thing.  If we want to
    # ignore errors from any of these, just make sure not to ignore
    # errors from the above "$doit $cpprog $src $dsttmp" command.
    #
    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
      && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&

    # Now rename the file to the real destination.
    { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
      || {
	   # The rename failed, perhaps because mv can't rename something else
	   # to itself, or perhaps because mv is so ancient that it does not
	   # support -f.

	   # Now remove or move aside any old file at destination location.
	   # We try this two ways since rm can't unlink itself on some
	   # systems and the destination file might be busy for other
	   # reasons.  In this case, the final cleanup might fail but the new
	   # file should still install successfully.
	   {
	     if test -f "$dst"; then
	       $doit $rmcmd -f "$dst" 2>/dev/null \
	       || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
		     && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
	       || {
		 echo "$0: cannot unlink or rename $dst" >&2
		 (exit 1); exit 1
	       }
	     else
	       :
	     fi
	   } &&

	   # Now rename the file to the real destination.
	   $doit $mvcmd "$dsttmp" "$dst"
	 }
    } || exit 1

    trap '' 0
  fi
done

# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:
@


1.2
log
@Import Heimdal-1.1
@
text
@@


1.1
log
@Initial revision
@
text
@d1 33
a33 1
#! /bin/sh
d35 1
a35 2
# install - install a program, script, or datafile
# This comes from X11R5.
a42 1
#
d44 3
d52 5
d58 2
a59 2

# put in absolute paths if you don't have them in your path; or use env. vars.
d70 10
a79 7
tranformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
d82 66
a147 40
src=""
dst=""
dir_arg=""

while [ x"$1" != x ]; do
    case $1 in
	-c) instcmd="$cpprog"
	    shift
	    continue;;

	-d) dir_arg=true
	    shift
	    continue;;

	-m) chmodcmd="$chmodprog $2"
	    shift
	    shift
	    continue;;

	-o) chowncmd="$chownprog $2"
	    shift
	    shift
	    continue;;

	-g) chgrpcmd="$chgrpprog $2"
	    shift
	    shift
	    continue;;

	-s) stripcmd="$stripprog"
	    shift
	    continue;;

	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
	    shift
	    continue;;

	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
	    shift
	    continue;;
d149 8
a156 12
	*)  if [ x"$src" = x ]
	    then
		src=$1
	    else
		# this colon is to work around a 386BSD /bin/sh bug
		:
		dst=$1
	    fi
	    shift
	    continue;;
    esac
done
d158 1
a158 7
if [ x"$src" = x ]
then
	echo "install:	no input file specified"
	exit 1
else
	true
fi
d160 2
a161 10
if [ x"$dir_arg" != x ]; then
	dst=$src
	src=""
	
	if [ -d $dst ]; then
		instcmd=:
	else
		instcmd=mkdir
	fi
else
d163 2
a164 19
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad 
# if $src (and thus $dsttmp) contains '*'.

	if [ -f $src -o -d $src ]
	then
		true
	else
		echo "install:  $src does not exist"
		exit 1
	fi
	
	if [ x"$dst" = x ]
	then
		echo "install:	no destination specified"
		exit 1
	else
		true
	fi
d166 3
a168 2
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
d170 14
a183 6
	if [ -d $dst ]
	then
		dst="$dst"/`basename $src`
	else
		true
	fi
d186 9
a194 2
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
d196 2
a197 2
# Make sure that the destination directory exists.
#  this part is taken from Noah Friedman's mkinstalldirs script
d199 23
a221 5
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='	
'
IFS="${IFS-${defaultIFS}}"
d223 32
a254 5
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@@/@@%@@g' -e 's@@^%@@/@@'`
IFS="${oIFS}"
d256 68
a323 9
pathcomp=''

while [ $# -ne 0 ] ; do
	pathcomp="${pathcomp}${1}"
	shift

	if [ ! -d "${pathcomp}" ] ;
        then
		$mkdirprog "${pathcomp}"
d325 1
a325 1
		true
d328 9
a336 3
	pathcomp="${pathcomp}/"
done
fi
d338 29
a366 11
if [ x"$dir_arg" != x ]
then
	$doit $instcmd $dst &&

	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else

# If we're going to rename the final executable, determine the name now.
d368 44
a411 3
	if [ x"$transformarg" = x ] 
	then
		dstfile=`basename $dst`
d413 12
a424 2
		dstfile=`basename $dst $transformbasename | 
			sed $transformarg`$transformbasename
d426 2
d429 68
a496 36
# don't allow the sed command to completely eliminate the filename

	if [ x"$dstfile" = x ] 
	then
		dstfile=`basename $dst`
	else
		true
	fi

# Make a temp file name in the proper directory.

	dsttmp=$dstdir/#inst.$$#

# Move or copy the file name to the temp name

	$doit $instcmd $src $dsttmp &&

	trap "rm -f ${dsttmp}" 0 &&

# and set any options; do chmod last to preserve setuid bits

# If any of these fail, we abort the whole thing.  If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.

	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&

# Now rename the file to the real destination.

	$doit $rmcmd -f $dstdir/$dstfile &&
	$doit $mvcmd $dsttmp $dstdir/$dstfile 

fi &&
d498 3
d502 6
a507 1
exit 0
@


1.1.1.1
log
@Import Heimdal Kerberos 5 from cryptosrc-intl.
@
text
@@


1.1.1.1.4.1
log
@file install-sh was added on branch minoura-xpg4dl on 2000-06-16 18:31:36 +0000
@
text
@d1 238
@


1.1.1.1.4.2
log
@Import Heimdal Kerberos 5 from cryptosrc-intl.
@
text
@a0 238
#! /bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
#


# set DOITPROG to echo to test this script

# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"


# put in absolute paths if you don't have them in your path; or use env. vars.

mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"

tranformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""

while [ x"$1" != x ]; do
    case $1 in
	-c) instcmd="$cpprog"
	    shift
	    continue;;

	-d) dir_arg=true
	    shift
	    continue;;

	-m) chmodcmd="$chmodprog $2"
	    shift
	    shift
	    continue;;

	-o) chowncmd="$chownprog $2"
	    shift
	    shift
	    continue;;

	-g) chgrpcmd="$chgrpprog $2"
	    shift
	    shift
	    continue;;

	-s) stripcmd="$stripprog"
	    shift
	    continue;;

	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
	    shift
	    continue;;

	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
	    shift
	    continue;;

	*)  if [ x"$src" = x ]
	    then
		src=$1
	    else
		# this colon is to work around a 386BSD /bin/sh bug
		:
		dst=$1
	    fi
	    shift
	    continue;;
    esac
done

if [ x"$src" = x ]
then
	echo "install:	no input file specified"
	exit 1
else
	true
fi

if [ x"$dir_arg" != x ]; then
	dst=$src
	src=""
	
	if [ -d $dst ]; then
		instcmd=:
	else
		instcmd=mkdir
	fi
else

# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad 
# if $src (and thus $dsttmp) contains '*'.

	if [ -f $src -o -d $src ]
	then
		true
	else
		echo "install:  $src does not exist"
		exit 1
	fi
	
	if [ x"$dst" = x ]
	then
		echo "install:	no destination specified"
		exit 1
	else
		true
	fi

# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic

	if [ -d $dst ]
	then
		dst="$dst"/`basename $src`
	else
		true
	fi
fi

## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`

# Make sure that the destination directory exists.
#  this part is taken from Noah Friedman's mkinstalldirs script

# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='	
'
IFS="${IFS-${defaultIFS}}"

oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@@/@@%@@g' -e 's@@^%@@/@@'`
IFS="${oIFS}"

pathcomp=''

while [ $# -ne 0 ] ; do
	pathcomp="${pathcomp}${1}"
	shift

	if [ ! -d "${pathcomp}" ] ;
        then
		$mkdirprog "${pathcomp}"
	else
		true
	fi

	pathcomp="${pathcomp}/"
done
fi

if [ x"$dir_arg" != x ]
then
	$doit $instcmd $dst &&

	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else

# If we're going to rename the final executable, determine the name now.

	if [ x"$transformarg" = x ] 
	then
		dstfile=`basename $dst`
	else
		dstfile=`basename $dst $transformbasename | 
			sed $transformarg`$transformbasename
	fi

# don't allow the sed command to completely eliminate the filename

	if [ x"$dstfile" = x ] 
	then
		dstfile=`basename $dst`
	else
		true
	fi

# Make a temp file name in the proper directory.

	dsttmp=$dstdir/#inst.$$#

# Move or copy the file name to the temp name

	$doit $instcmd $src $dsttmp &&

	trap "rm -f ${dsttmp}" 0 &&

# and set any options; do chmod last to preserve setuid bits

# If any of these fail, we abort the whole thing.  If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.

	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&

# Now rename the file to the real destination.

	$doit $rmcmd -f $dstdir/$dstfile &&
	$doit $mvcmd $dsttmp $dstdir/$dstfile 

fi &&


exit 0
@


1.1.1.2
log
@import heimdal 0.5
@
text
@d1 1
a1 1
#!/bin/sh
d4 1
a4 13
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission.  M.I.T. makes no representations about the
# suitability of this software for any purpose.  It is provided "as is"
# without express or implied warranty.
d11 2
a12 2
# from scratch.  It can only install one file at a time, a restriction
# shared with many OS's install programs.
d32 1
a32 1
transformbasename=""
d100 1
a100 1
	:
a108 1
		chmodcmd=""
d110 1
a110 1
		instcmd=$mkdirprog
d120 1
a120 1
		:
d131 1
a131 1
		:
d141 1
a141 1
		:
d153 2
a154 2
defaultIFS='
	'
d173 1
a173 1
		:
d184 4
a187 4
	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
d206 1
a206 1
		:
d225 4
a228 4
	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
@


1.1.1.2.2.1
log
@Pullup rev netbsd-2-0-base---heimdal-1-6-1-merge-to-netbsd-2-0 (requested by lha in ticket #157)

heimdal 0.6 to 0.6.1
@
text
@d4 1
d6 1
a6 3
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
d8 9
a16 26
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
d59 1
a59 1
	-c) instcmd=$cpprog
d82 1
a82 1
	-s) stripcmd=$stripprog
d109 1
a109 1
	echo "$0: no input file specified" >&2
d118 2
a119 2

	if [ -d "$dst" ]; then
d128 1
a128 1
# might cause directories to be created, which would be especially bad
d131 1
a131 1
	if [ -f "$src" ] || [ -d "$src" ]
d135 1
a135 1
		echo "$0: $src does not exist" >&2
d138 1
a138 1

d141 1
a141 1
		echo "$0: no destination specified" >&2
d150 1
a150 1
	if [ -d "$dst" ]
d152 1
a152 1
		dst=$dst/`basename "$src"`
d159 1
a159 1
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
d168 1
a168 1
IFS="${IFS-$defaultIFS}"
d170 1
a170 1
oIFS=$IFS
d173 2
a174 2
set - `echo "$dstdir" | sed -e 's@@/@@%@@g' -e 's@@^%@@/@@'`
IFS=$oIFS
d179 1
a179 1
	pathcomp=$pathcomp$1
d182 1
a182 1
	if [ ! -d "$pathcomp" ] ;
d184 1
a184 1
		$mkdirprog "$pathcomp"
d189 1
a189 1
	pathcomp=$pathcomp/
d195 1
a195 1
	$doit $instcmd "$dst" &&
d197 4
a200 4
	if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
	if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
d205 1
a205 1
	if [ x"$transformarg" = x ]
d207 1
a207 1
		dstfile=`basename "$dst"`
d209 1
a209 1
		dstfile=`basename "$dst" $transformbasename |
d215 1
a215 1
	if [ x"$dstfile" = x ]
d217 1
a217 1
		dstfile=`basename "$dst"`
d222 1
a222 1
# Make a couple of temp file names in the proper directory.
d224 1
a224 2
	dsttmp=$dstdir/_inst.$$_
	rmtmp=$dstdir/_rm.$$_
d226 1
a226 4
# Trap to clean up temp files at exit.

	trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
	trap '(exit $?); exit' 1 2 13 15
d228 1
a228 1
# Move or copy the file name to the temp name
d230 1
a230 1
	$doit $instcmd "$src" "$dsttmp" &&
d238 4
a241 23
	if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
	if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&

# Now remove or move aside any old file at destination location.  We try this
# two ways since rm can't unlink itself on some systems and the destination
# file might be busy for other reasons.  In this case, the final cleanup
# might fail but the new file should still install successfully.

{
	if [ -f "$dstdir/$dstfile" ]
	then
		$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
		$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
		{
		  echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
		  (exit 1); exit
		}
	else
		:
	fi
} &&
d245 2
a246 1
	$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
a249 1
# The final little trick to "correctly" pass the exit status to the exit trap.
d251 1
a251 3
{
	(exit 0); exit
}
@


1.1.1.2.2.2
log
@Pullup patch (requested by lha in ticket #849)

Bring up 0.6.3 - security fixes
@
text
@d2 1
d4 1
a4 3

scriptversion=2004-02-15.20

d44 1
d50 1
d62 2
a63 2
transformbasename=
transform_arg=
d66 3
a68 3
chowncmd=
chgrpcmd=
stripcmd=
d71 52
a122 83
src=
dst=
dir_arg=

usage="Usage: $0 [OPTION]... SRCFILE DSTFILE
   or: $0 [OPTION]... SRCFILES... DIRECTORY
   or: $0 -d DIRECTORIES...

In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default.
In the second, create the directory path DIR.

Options:
-b=TRANSFORMBASENAME
-c         copy source (using $cpprog) instead of moving (using $mvprog).
-d         create directories instead of installing files.
-g GROUP   $chgrp installed files to GROUP.
-m MODE    $chmod installed files to MODE.
-o USER    $chown installed files to USER.
-s         strip installed files (using $stripprog).
-t=TRANSFORM
--help     display this help and exit.
--version  display version info and exit.

Environment variables override the default commands:
  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"

while test -n "$1"; do
  case $1 in
    -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
        shift
        continue;;

    -c) instcmd=$cpprog
        shift
        continue;;

    -d) dir_arg=true
        shift
        continue;;

    -g) chgrpcmd="$chgrpprog $2"
        shift
        shift
        continue;;

    --help) echo "$usage"; exit 0;;

    -m) chmodcmd="$chmodprog $2"
        shift
        shift
        continue;;

    -o) chowncmd="$chownprog $2"
        shift
        shift
        continue;;

    -s) stripcmd=$stripprog
        shift
        continue;;

    -t=*) transformarg=`echo $1 | sed 's/-t=//'`
        shift
        continue;;

    --version) echo "$0 $scriptversion"; exit 0;;

    *)  # When -d is used, all remaining arguments are directories to create.
	test -n "$dir_arg" && break
        # Otherwise, the last argument is the destination.  Remove it from $@@.
	for arg
	do
          if test -n "$dstarg"; then
	    # $@@ is not empty: it contains at least $arg.
	    set fnord "$@@" "$dstarg"
	    shift # fnord
	  fi
	  shift # arg
	  dstarg=$arg
	done
	break;;
  esac
d125 49
a173 8
if test -z "$1"; then
  if test -z "$dir_arg"; then
    echo "$0: no input file specified." >&2
    exit 1
  fi
  # It's OK to call `install-sh -d' without argument.
  # This can happen when creating conditional directories.
  exit 0
d176 30
a205 36
for src
do
  # Protect names starting with `-'.
  case $src in
    -*) src=./$src ;;
  esac

  if test -n "$dir_arg"; then
    dst=$src
    src=

    if test -d "$dst"; then
      instcmd=:
      chmodcmd=
    else
      instcmd=$mkdirprog
    fi
  else
    # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
    # might cause directories to be created, which would be especially bad
    # if $src (and thus $dsttmp) contains '*'.
    if test ! -f "$src" && test ! -d "$src"; then
      echo "$0: $src does not exist." >&2
      exit 1
    fi

    if test -z "$dstarg"; then
      echo "$0: no destination specified." >&2
      exit 1
    fi

    dst=$dstarg
    # Protect names starting with `-'.
    case $dst in
      -*) dst=./$dst ;;
    esac
d207 1
a207 102
    # If destination is a directory, append the input filename; won't work
    # if double slashes aren't ignored.
    if test -d "$dst"; then
      dst=$dst/`basename "$src"`
    fi
  fi

  # This sed command emulates the dirname command.
  dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`

  # Make sure that the destination directory exists.

  # Skip lots of stat calls in the usual case.
  if test ! -d "$dstdir"; then
    defaultIFS='
	 '
    IFS="${IFS-$defaultIFS}"

    oIFS=$IFS
    # Some sh's can't handle IFS=/ for some reason.
    IFS='%'
    set - `echo "$dstdir" | sed -e 's@@/@@%@@g' -e 's@@^%@@/@@'`
    IFS=$oIFS

    pathcomp=

    while test $# -ne 0 ; do
      pathcomp=$pathcomp$1
      shift
      if test ! -d "$pathcomp"; then
        $mkdirprog "$pathcomp" || lasterr=$?
	# mkdir can fail with a `File exist' error in case several
	# install-sh are creating the directory concurrently.  This
	# is OK.
	test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; }
      fi
      pathcomp=$pathcomp/
    done
  fi

  if test -n "$dir_arg"; then
    $doit $instcmd "$dst" \
      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }

  else
    # If we're going to rename the final executable, determine the name now.
    if test -z "$transformarg"; then
      dstfile=`basename "$dst"`
    else
      dstfile=`basename "$dst" $transformbasename \
               | sed $transformarg`$transformbasename
    fi

    # don't allow the sed command to completely eliminate the filename.
    test -z "$dstfile" && dstfile=`basename "$dst"`

    # Make a couple of temp file names in the proper directory.
    dsttmp=$dstdir/_inst.$$_
    rmtmp=$dstdir/_rm.$$_

    # Trap to clean up those temp files at exit.
    trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
    trap '(exit $?); exit' 1 2 13 15

    # Move or copy the file name to the temp name
    $doit $instcmd "$src" "$dsttmp" &&

    # and set any options; do chmod last to preserve setuid bits.
    #
    # If any of these fail, we abort the whole thing.  If we want to
    # ignore errors from any of these, just make sure not to ignore
    # errors from the above "$doit $instcmd $src $dsttmp" command.
    #
    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&

    # Now remove or move aside any old file at destination location.  We
    # try this two ways since rm can't unlink itself on some systems and
    # the destination file might be busy for other reasons.  In this case,
    # the final cleanup might fail but the new file should still install
    # successfully.
    {
      if test -f "$dstdir/$dstfile"; then
        $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
        || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
        || {
	  echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
	  (exit 1); exit
        }
      else
        :
      fi
    } &&

    # Now rename the file to the real destination.
    $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
  fi || { (exit 1); exit; }
d209 80
d291 1
d293 1
a293 1
  (exit 0); exit
a294 7

# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:
@


1.1.1.3
log
@Import heimdal-0.6.1

Changes in release 0.6.1
 * Fixed ARCFOUR suppport
 * Cross realm vulnerability
 * kdc: fix denial of service attack
 * kdc: stop clients from renewing kerberos 4 tickets into the future
 * bug fixes
@
text
@d4 1
d6 1
a6 3
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
d8 9
a16 26
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
d59 1
a59 1
	-c) instcmd=$cpprog
d82 1
a82 1
	-s) stripcmd=$stripprog
d109 1
a109 1
	echo "$0: no input file specified" >&2
d118 2
a119 2

	if [ -d "$dst" ]; then
d128 1
a128 1
# might cause directories to be created, which would be especially bad
d131 1
a131 1
	if [ -f "$src" ] || [ -d "$src" ]
d135 1
a135 1
		echo "$0: $src does not exist" >&2
d138 1
a138 1

d141 1
a141 1
		echo "$0: no destination specified" >&2
d150 1
a150 1
	if [ -d "$dst" ]
d152 1
a152 1
		dst=$dst/`basename "$src"`
d159 1
a159 1
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
d168 1
a168 1
IFS="${IFS-$defaultIFS}"
d170 1
a170 1
oIFS=$IFS
d173 2
a174 2
set - `echo "$dstdir" | sed -e 's@@/@@%@@g' -e 's@@^%@@/@@'`
IFS=$oIFS
d179 1
a179 1
	pathcomp=$pathcomp$1
d182 1
a182 1
	if [ ! -d "$pathcomp" ] ;
d184 1
a184 1
		$mkdirprog "$pathcomp"
d189 1
a189 1
	pathcomp=$pathcomp/
d195 1
a195 1
	$doit $instcmd "$dst" &&
d197 4
a200 4
	if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
	if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
d205 1
a205 1
	if [ x"$transformarg" = x ]
d207 1
a207 1
		dstfile=`basename "$dst"`
d209 1
a209 1
		dstfile=`basename "$dst" $transformbasename |
d215 1
a215 1
	if [ x"$dstfile" = x ]
d217 1
a217 1
		dstfile=`basename "$dst"`
d222 1
a222 1
# Make a couple of temp file names in the proper directory.
d224 1
a224 2
	dsttmp=$dstdir/_inst.$$_
	rmtmp=$dstdir/_rm.$$_
d226 1
a226 4
# Trap to clean up temp files at exit.

	trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
	trap '(exit $?); exit' 1 2 13 15
d228 1
a228 1
# Move or copy the file name to the temp name
d230 1
a230 1
	$doit $instcmd "$src" "$dsttmp" &&
d238 4
a241 23
	if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
	if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&

# Now remove or move aside any old file at destination location.  We try this
# two ways since rm can't unlink itself on some systems and the destination
# file might be busy for other reasons.  In this case, the final cleanup
# might fail but the new file should still install successfully.

{
	if [ -f "$dstdir/$dstfile" ]
	then
		$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
		$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
		{
		  echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
		  (exit 1); exit
		}
	else
		:
	fi
} &&
d245 2
a246 1
	$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
a249 1
# The final little trick to "correctly" pass the exit status to the exit trap.
d251 1
a251 3
{
	(exit 0); exit
}
@


1.1.1.4
log
@Import heimdal 0.6.3

Changes in release 0.6.3

 * fix vulnerabilities in ftpd
 * support for linux AFS /proc "syscalls"
 * support for RFC3244 (Windows 2000 Kerberos Change/Set Password) in
   kpasswdd
 * fix possible KDC denial of service
 * bug fixes
@
text
@d2 1
d4 1
a4 3

scriptversion=2004-02-15.20

d44 1
d50 1
d62 2
a63 2
transformbasename=
transform_arg=
d66 3
a68 3
chowncmd=
chgrpcmd=
stripcmd=
d71 52
a122 83
src=
dst=
dir_arg=

usage="Usage: $0 [OPTION]... SRCFILE DSTFILE
   or: $0 [OPTION]... SRCFILES... DIRECTORY
   or: $0 -d DIRECTORIES...

In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default.
In the second, create the directory path DIR.

Options:
-b=TRANSFORMBASENAME
-c         copy source (using $cpprog) instead of moving (using $mvprog).
-d         create directories instead of installing files.
-g GROUP   $chgrp installed files to GROUP.
-m MODE    $chmod installed files to MODE.
-o USER    $chown installed files to USER.
-s         strip installed files (using $stripprog).
-t=TRANSFORM
--help     display this help and exit.
--version  display version info and exit.

Environment variables override the default commands:
  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"

while test -n "$1"; do
  case $1 in
    -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
        shift
        continue;;

    -c) instcmd=$cpprog
        shift
        continue;;

    -d) dir_arg=true
        shift
        continue;;

    -g) chgrpcmd="$chgrpprog $2"
        shift
        shift
        continue;;

    --help) echo "$usage"; exit 0;;

    -m) chmodcmd="$chmodprog $2"
        shift
        shift
        continue;;

    -o) chowncmd="$chownprog $2"
        shift
        shift
        continue;;

    -s) stripcmd=$stripprog
        shift
        continue;;

    -t=*) transformarg=`echo $1 | sed 's/-t=//'`
        shift
        continue;;

    --version) echo "$0 $scriptversion"; exit 0;;

    *)  # When -d is used, all remaining arguments are directories to create.
	test -n "$dir_arg" && break
        # Otherwise, the last argument is the destination.  Remove it from $@@.
	for arg
	do
          if test -n "$dstarg"; then
	    # $@@ is not empty: it contains at least $arg.
	    set fnord "$@@" "$dstarg"
	    shift # fnord
	  fi
	  shift # arg
	  dstarg=$arg
	done
	break;;
  esac
d125 49
a173 8
if test -z "$1"; then
  if test -z "$dir_arg"; then
    echo "$0: no input file specified." >&2
    exit 1
  fi
  # It's OK to call `install-sh -d' without argument.
  # This can happen when creating conditional directories.
  exit 0
d176 30
a205 36
for src
do
  # Protect names starting with `-'.
  case $src in
    -*) src=./$src ;;
  esac

  if test -n "$dir_arg"; then
    dst=$src
    src=

    if test -d "$dst"; then
      instcmd=:
      chmodcmd=
    else
      instcmd=$mkdirprog
    fi
  else
    # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
    # might cause directories to be created, which would be especially bad
    # if $src (and thus $dsttmp) contains '*'.
    if test ! -f "$src" && test ! -d "$src"; then
      echo "$0: $src does not exist." >&2
      exit 1
    fi

    if test -z "$dstarg"; then
      echo "$0: no destination specified." >&2
      exit 1
    fi

    dst=$dstarg
    # Protect names starting with `-'.
    case $dst in
      -*) dst=./$dst ;;
    esac
d207 1
a207 102
    # If destination is a directory, append the input filename; won't work
    # if double slashes aren't ignored.
    if test -d "$dst"; then
      dst=$dst/`basename "$src"`
    fi
  fi

  # This sed command emulates the dirname command.
  dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`

  # Make sure that the destination directory exists.

  # Skip lots of stat calls in the usual case.
  if test ! -d "$dstdir"; then
    defaultIFS='
	 '
    IFS="${IFS-$defaultIFS}"

    oIFS=$IFS
    # Some sh's can't handle IFS=/ for some reason.
    IFS='%'
    set - `echo "$dstdir" | sed -e 's@@/@@%@@g' -e 's@@^%@@/@@'`
    IFS=$oIFS

    pathcomp=

    while test $# -ne 0 ; do
      pathcomp=$pathcomp$1
      shift
      if test ! -d "$pathcomp"; then
        $mkdirprog "$pathcomp" || lasterr=$?
	# mkdir can fail with a `File exist' error in case several
	# install-sh are creating the directory concurrently.  This
	# is OK.
	test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; }
      fi
      pathcomp=$pathcomp/
    done
  fi

  if test -n "$dir_arg"; then
    $doit $instcmd "$dst" \
      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }

  else
    # If we're going to rename the final executable, determine the name now.
    if test -z "$transformarg"; then
      dstfile=`basename "$dst"`
    else
      dstfile=`basename "$dst" $transformbasename \
               | sed $transformarg`$transformbasename
    fi

    # don't allow the sed command to completely eliminate the filename.
    test -z "$dstfile" && dstfile=`basename "$dst"`

    # Make a couple of temp file names in the proper directory.
    dsttmp=$dstdir/_inst.$$_
    rmtmp=$dstdir/_rm.$$_

    # Trap to clean up those temp files at exit.
    trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
    trap '(exit $?); exit' 1 2 13 15

    # Move or copy the file name to the temp name
    $doit $instcmd "$src" "$dsttmp" &&

    # and set any options; do chmod last to preserve setuid bits.
    #
    # If any of these fail, we abort the whole thing.  If we want to
    # ignore errors from any of these, just make sure not to ignore
    # errors from the above "$doit $instcmd $src $dsttmp" command.
    #
    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&

    # Now remove or move aside any old file at destination location.  We
    # try this two ways since rm can't unlink itself on some systems and
    # the destination file might be busy for other reasons.  In this case,
    # the final cleanup might fail but the new file should still install
    # successfully.
    {
      if test -f "$dstdir/$dstfile"; then
        $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
        || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
        || {
	  echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
	  (exit 1); exit
        }
      else
        :
      fi
    } &&

    # Now rename the file to the real destination.
    $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
  fi || { (exit 1); exit; }
d209 80
d291 1
d293 1
a293 1
  (exit 0); exit
a294 7

# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:
@
