Import of pkgsrc-2013Q2

This commit is contained in:
2013-09-26 17:14:40 +02:00
commit 785076ae39
74991 changed files with 4380255 additions and 0 deletions

3
net/fetch/DESCR Normal file
View File

@@ -0,0 +1,3 @@
fetch is a command line for transferring files with URL syntax.
Supported schemas are FTP, HTTP, HTTPS and FILE. It includes Advanced
features like proxy connections and restarting of interrupted transfers.

31
net/fetch/Makefile Normal file
View File

@@ -0,0 +1,31 @@
# $NetBSD: Makefile,v 1.16 2013/02/06 23:23:13 jperkin Exp $
#
DISTNAME= fetch-1.8
PKGREVISION= 1
CATEGORIES= net
MASTER_SITES= # empty
DISTFILES= # empty
MAINTAINER= joerg@NetBSD.org
HOMEPAGE= http://www.FreeBSD.org/
COMMENT= Client to fetch URLs
LICENSE= modified-bsd
USE_FEATURES= nbcompat
GNU_CONFIGURE= yes
USE_BSD_MAKEFILE= yes
.include "../../mk/bsd.prefs.mk"
.if !empty(FETCH_USING:Mfetch)
CHECK_PERMS= no
.endif
INSTALLATION_DIRS= bin ${PKGMANDIR}/cat1 ${PKGMANDIR}/man1
do-extract:
${CP} -r ${FILESDIR} ${WRKSRC}
.include "../../net/libfetch/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

4
net/fetch/PLIST Normal file
View File

@@ -0,0 +1,4 @@
@comment $NetBSD: PLIST,v 1.1.1.1 2008/10/08 15:28:30 joerg Exp $
bin/fetch
man/cat1/fetch.0
man/man1/fetch.1

View File

@@ -0,0 +1,9 @@
# $FreeBSD$
.include <bsd.own.mk>
PROG= fetch
LDADD+= -lfetch @LIBS@
CPPFLAGS+= -DHAVE_CONFIG_H
.include <bsd.prog.mk>

1561
net/fetch/files/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,98 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <err.h> header file. */
#undef HAVE_ERR_H
/* Define to 1 if you have the `getpass' function. */
#undef HAVE_GETPASS
/* Define to 1 if you have the `getpassphrase' function. */
#undef HAVE_GETPASSPHRASE
/* Define to 1 if the system has the type `intmax_t'. */
#undef HAVE_INTMAX_T
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `nsl' library (-lnsl). */
#undef HAVE_LIBNSL
/* Define to 1 if you have the `socket' library (-lsocket). */
#undef HAVE_LIBSOCKET
/* Define to 1 if the system has the type `long long int'. */
#undef HAVE_LONG_LONG_INT
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `setproctitle' function. */
#undef HAVE_SETPROCTITLE
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sysexists.h> header file. */
#undef HAVE_SYSEXISTS_H
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* getpass supports long passwords */
#undef PREFER_GETPASS
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to the widest signed integer type if <stdint.h> and <inttypes.h> do
not define. */
#undef intmax_t

1686
net/fetch/files/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

5054
net/fetch/files/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
dnl $NetBSD: configure.ac,v 1.5 2011/12/05 22:54:22 joerg Exp $
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.52)
AC_INIT([fetch], [1.6], [joerg@NetBSD.org])
AC_CONFIG_HEADER(config.h)
AC_CANONICAL_HOST
AC_CHECK_HEADERS([sys/param.h sys/ioctl.h sys/socket.h sys/stat.h sys/time.h])
AC_CHECK_HEADERS([err.h stdint.h termios.h sysexists.h])
AC_TYPE_INTMAX_T
AC_CHECK_FUNCS([getpass getpassphrase setproctitle])
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(crypto, X509_get_issuer_name)
AC_CHECK_LIB(ssl, SSL_read)
AC_CHECK_LIB(fetch, fetchGet)
case "$host_os" in
netbsd)
AC_DEFINE([PREFER_GETPASS], [], [getpass supports long passwords])
;;
esac
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

265
net/fetch/files/fetch.1 Normal file
View File

@@ -0,0 +1,265 @@
.\" $NetBSD: fetch.1,v 1.4 2009/02/07 15:25:51 wiz Exp $
.\"-
.\" Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav
.\" All rights reserved.
.\" Portions Copyright (c) 1999 Massachusetts Institute of Technology; used
.\" by permission.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer
.\" in this position and unchanged.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd February 5, 2009
.Dt FETCH 1
.Os
.Sh NAME
.Nm fetch
.Nd retrieve a file by Uniform Resource Locator
.Sh SYNOPSIS
.Nm
.Op Fl 146AFMRUadilmnqrsv
.Op Fl B Ar bytes
.Op Fl N Ar file
.Op Fl o Ar file
.Op Fl S Ar bytes
.Op Fl T Ar seconds
.Op Fl w Ar seconds
.Op Ar URL ...
.Sh DESCRIPTION
The
.Nm
utility provides a command-line interface to the
.Xr fetch 3
library.
Its purpose is to retrieve the file(s) pointed to by the URL(s) on the
command line.
.Pp
The following options are available:
.Bl -tag -width Fl
.It Fl 1
Stop and return exit code 0 at the first successfully retrieved file.
.It Fl 4
Forces
.Nm
to use IPv4 addresses only.
.It Fl 6
Forces
.Nm
to use IPv6 addresses only.
.It Fl A
Do not automatically follow
.Dq temporary
(302) redirects.
Some broken Web sites will return a redirect instead of a not-found
error when the requested object does not exist.
.It Fl a
Automatically retry the transfer upon soft failures.
.It Fl B Ar bytes
Specify the read buffer size in bytes.
The default is 4096 bytes.
Attempts to set a buffer size lower than this will be silently
ignored.
The number of reads actually performed is reported at verbosity level
two or higher (see the
.Fl v
flag).
.It Fl d
Use a direct connection even if a proxy is configured.
.It Fl F
In combination with the
.Fl r
flag, forces a restart even if the local and remote files have
different modification times.
Implies
.Fl R .
.It Fl i
Only fetch if it the output file is older than the referenced URL.
This option is overriden by
.Fl o Ar - .
.It Fl l
If the target is a file-scheme URL, make a symbolic link to the target
rather than trying to copy it.
.It Fl M
.It Fl m
Mirror mode: if the file already exists locally and has the same size
and modification time as the remote file, it will not be fetched.
Note that the
.Fl m
and
.Fl r
flags are mutually exclusive.
.It Fl N Ar file
Use
.Ar file
instead of
.Pa ~/.netrc
to look up login names and passwords for FTP sites.
See
.Xr ftp 1
for a description of the file format.
This feature is experimental.
.It Fl n
Do not preserve the modification time of the transferred file.
.It Fl o Ar file
Set the output file name to
.Ar file .
By default, a
.Dq pathname
is extracted from the specified URI, and
its basename is used as the name of the output file.
A
.Ar file
argument of
.Sq Li \&-
indicates that results are to be directed to the standard output.
If the
.Ar file
argument is a directory, fetched file(s) will be placed within the
directory, with name(s) selected as in the default behaviour.
.It Fl q
Quiet mode.
.It Fl R
The output files are precious, and should not be deleted under any
circumstances, even if the transfer failed or was incomplete.
.It Fl r
Restart a previously interrupted transfer.
Note that the
.Fl m
and
.Fl r
flags are mutually exclusive.
.It Fl S Ar bytes
Require the file size reported by the server to match the specified
value.
If it does not, a message is printed and the file is not fetched.
If the server does not support reporting file sizes, this option is
ignored and the file is fetched unconditionally.
.It Fl s
Print the size in bytes of each requested file, without fetching it.
.It Fl T Ar seconds
Set timeout value to
.Ar seconds .
Overrides the environment variables
.Ev FTP_TIMEOUT
for FTP transfers or
.Ev HTTP_TIMEOUT
for HTTP transfers if set.
.It Fl U
When using passive FTP, allocate the port for the data connection from
the low (default) port range.
See
.Xr ip 4
for details on how to specify which port range this corresponds to.
.It Fl v
Increase verbosity level.
.It Fl w Ar seconds
When the
.Fl a
flag is specified, wait this many seconds between successive retries.
.El
.Pp
If
.Nm
receives a
.Dv SIGINFO
signal (see the
.Cm status
argument for
.Xr stty 1 ) ,
the current transfer rate statistics will be written to the
standard error output, in the same format as the standard completion
message.
.Sh EXIT STATUS
The
.Nm
command returns zero on success, or one on failure.
If multiple URLs are listed on the command line,
.Nm
will attempt to retrieve each one of them in turn, and will return
zero only if they were all successfully retrieved.
.Sh ENVIRONMENT
.Bl -tag -width HTTP_TIMEOUT
.It Ev FTP_TIMEOUT
Maximum time, in seconds, to wait before aborting an FTP connection.
.It Ev HTTP_TIMEOUT
Maximum time, in seconds, to wait before aborting an HTTP connection.
.El
.Pp
See
.Xr fetch 3
for a description of additional environment variables, including
.Ev FETCH_BIND_ADDRESS ,
.Ev FTP_LOGIN ,
.Ev FTP_PASSIVE_MODE ,
.Ev FTP_PASSWORD ,
.Ev FTP_PROXY ,
.Ev ftp_proxy ,
.Ev HTTP_AUTH ,
.Ev HTTP_PROXY ,
.Ev http_proxy ,
.Ev HTTP_PROXY_AUTH ,
.Ev HTTP_REFERER ,
.Ev HTTP_USER_AGENT ,
.Ev NETRC ,
.Ev NO_PROXY
and
.Ev no_proxy .
.Sh SEE ALSO
.Xr fetch 3
.Sh HISTORY
The
.Nm
command appeared in
.Fx 2.1.5 .
This implementation first appeared in
.Fx 4.1 .
.Sh AUTHORS
.An -nosplit
The original implementation of
.Nm
was done by
.An Jean-Marc Zucconi Aq jmz@FreeBSD.org .
It was extensively re-worked for
.Fx 2.2
by
.An Garrett Wollman Aq wollman@FreeBSD.org ,
and later completely rewritten to use the
.Xr fetch 3
library by
.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
.Sh NOTES
The
.Fl b
and
.Fl t
options are no longer supported and will generate warnings.
They were workarounds for bugs in other OSes which this implementation
does not trigger.
.Pp
One cannot both use the
.Fl h ,
.Fl c ,
and
.Fl f
options and specify URLs on the command line.

1077
net/fetch/files/fetch.c Normal file

File diff suppressed because it is too large Load Diff

144
net/fetch/files/fetch.cat1 Normal file
View File

@@ -0,0 +1,144 @@
FETCH(1) NetBSD General Commands Manual FETCH(1)
NNAAMMEE
ffeettcchh -- retrieve a file by Uniform Resource Locator
SSYYNNOOPPSSIISS
ffeettcchh [--114466AAFFMMRRUUaaddiillmmnnqqrrssvv] [--BB _b_y_t_e_s] [--NN _f_i_l_e] [--oo _f_i_l_e] [--SS _b_y_t_e_s]
[--TT _s_e_c_o_n_d_s] [--ww _s_e_c_o_n_d_s] [_U_R_L _._._.]
DDEESSCCRRIIPPTTIIOONN
The ffeettcchh utility provides a command-line interface to the fetch(3)
library. Its purpose is to retrieve the file(s) pointed to by the URL(s)
on the command line.
The following options are available:
--11 Stop and return exit code 0 at the first successfully
retrieved file.
--44 Forces ffeettcchh to use IPv4 addresses only.
--66 Forces ffeettcchh to use IPv6 addresses only.
--AA Do not automatically follow ``temporary'' (302) redirects.
Some broken Web sites will return a redirect instead of a
not-found error when the requested object does not exist.
--aa Automatically retry the transfer upon soft failures.
--BB _b_y_t_e_s Specify the read buffer size in bytes. The default is 4096
bytes. Attempts to set a buffer size lower than this will be
silently ignored. The number of reads actually performed is
reported at verbosity level two or higher (see the --vv flag).
--dd Use a direct connection even if a proxy is configured.
--FF In combination with the --rr flag, forces a restart even if the
local and remote files have different modification times.
Implies --RR.
--ii Only fetch if it the output file is older than the referenced
URL. This option is overriden by --oo _-.
--ll If the target is a file-scheme URL, make a symbolic link to
the target rather than trying to copy it.
--MM
--mm Mirror mode: if the file already exists locally and has the
same size and modification time as the remote file, it will
not be fetched. Note that the --mm and --rr flags are mutually
exclusive.
--NN _f_i_l_e Use _f_i_l_e instead of _~_/_._n_e_t_r_c to look up login names and pass-
words for FTP sites. See ftp(1) for a description of the
file format. This feature is experimental.
--nn Do not preserve the modification time of the transferred
file.
--oo _f_i_l_e Set the output file name to _f_i_l_e. By default, a ``pathname''
is extracted from the specified URI, and its basename is used
as the name of the output file. A _f_i_l_e argument of `-' indi-
cates that results are to be directed to the standard output.
If the _f_i_l_e argument is a directory, fetched file(s) will be
placed within the directory, with name(s) selected as in the
default behaviour.
--qq Quiet mode.
--RR The output files are precious, and should not be deleted
under any circumstances, even if the transfer failed or was
incomplete.
--rr Restart a previously interrupted transfer. Note that the --mm
and --rr flags are mutually exclusive.
--SS _b_y_t_e_s Require the file size reported by the server to match the
specified value. If it does not, a message is printed and
the file is not fetched. If the server does not support
reporting file sizes, this option is ignored and the file is
fetched unconditionally.
--ss Print the size in bytes of each requested file, without
fetching it.
--TT _s_e_c_o_n_d_s Set timeout value to _s_e_c_o_n_d_s. Overrides the environment
variables FTP_TIMEOUT for FTP transfers or HTTP_TIMEOUT for
HTTP transfers if set.
--UU When using passive FTP, allocate the port for the data con-
nection from the low (default) port range. See ip(4) for
details on how to specify which port range this corresponds
to.
--vv Increase verbosity level.
--ww _s_e_c_o_n_d_s When the --aa flag is specified, wait this many seconds between
successive retries.
If ffeettcchh receives a SIGINFO signal (see the ssttaattuuss argument for stty(1)),
the current transfer rate statistics will be written to the standard
error output, in the same format as the standard completion message.
EEXXIITT SSTTAATTUUSS
The ffeettcchh command returns zero on success, or one on failure. If multi-
ple URLs are listed on the command line, ffeettcchh will attempt to retrieve
each one of them in turn, and will return zero only if they were all suc-
cessfully retrieved.
EENNVVIIRROONNMMEENNTT
FTP_TIMEOUT Maximum time, in seconds, to wait before aborting an FTP
connection.
HTTP_TIMEOUT Maximum time, in seconds, to wait before aborting an HTTP
connection.
See fetch(3) for a description of additional environment variables,
including FETCH_BIND_ADDRESS, FTP_LOGIN, FTP_PASSIVE_MODE, FTP_PASSWORD,
FTP_PROXY, ftp_proxy, HTTP_AUTH, HTTP_PROXY, http_proxy, HTTP_PROXY_AUTH,
HTTP_REFERER, HTTP_USER_AGENT, NETRC, NO_PROXY and no_proxy.
SSEEEE AALLSSOO
fetch(3)
HHIISSTTOORRYY
The ffeettcchh command appeared in FreeBSD 2.1.5. This implementation first
appeared in FreeBSD 4.1.
AAUUTTHHOORRSS
The original implementation of ffeettcchh was done by Jean-Marc Zucconi
<jmz@FreeBSD.org>. It was extensively re-worked for FreeBSD 2.2 by
Garrett Wollman <wollman@FreeBSD.org>, and later completely rewritten to
use the fetch(3) library by Dag-Erling Sm/orgrav <des@FreeBSD.org>.
NNOOTTEESS
The --bb and --tt options are no longer supported and will generate warnings.
They were workarounds for bugs in other OSes which this implementation
does not trigger.
One cannot both use the --hh, --cc, and --ff options and specify URLs on the
command line.
NetBSD 5.0 February 5, 2009 NetBSD 5.0

291
net/fetch/files/install-sh Executable file
View File

@@ -0,0 +1,291 @@
#!/bin/sh
#
# $NetBSD: install-sh,v 1.1 2009/11/13 20:52:05 joerg Exp $
# This script now also installs multiple files, but might choke on installing
# multiple files with spaces in the file names.
#
# install - install a program, script, or datafile
# 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.
#
# 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.
awkprog="${AWKPROG-awk}"
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
instcmd="$mvprog"
pathcompchmodcmd="$chmodprog 755"
chmodcmd="$chmodprog 755"
chowncmd=""
chgrpcmd=""
stripcmd=""
stripflags=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
msrc=""
dst=""
dir_arg=""
suffix=""
suffixfmt=""
while [ x"$1" != x ]; do
case $1 in
-b) suffix=".old"
shift
continue;;
-B) suffixfmt="$2"
shift
shift
continue;;
-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;;
-S) stripcmd="$stripprog"
stripflags="-S $2 $stripflags"
shift
shift
continue;;
*) if [ x"$msrc" = x ]
then
msrc="$dst"
else
msrc="$msrc $dst"
fi
src="$dst"
dst="$1"
shift
continue;;
esac
done
if [ x"$dir_arg" = x ]
then
dstisfile=""
if [ ! -d "$dst" ]
then
if [ x"$msrc" = x"$src" ]
then
dstisfile=true
else
echo "install: destination is not a directory"
exit 1
fi
fi
else
msrc="$msrc $dst"
fi
if [ x"$msrc" = x ]
then
echo "install: no destination specified"
exit 1
fi
for srcarg in $msrc; do
if [ x"$dir_arg" != x ]; then
dstarg="$srcarg"
else
dstarg="$dst"
# Waiting for this to be detected by the "$instcmd $srcarg $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f "$srcarg" ]
then
doinst="$instcmd"
elif [ -d "$srcarg" ]
then
echo "install: $srcarg: not a regular file"
exit 1
elif [ "$srcarg" = "/dev/null" ]
then
doinst="$cpprog"
else
echo "install: $srcarg does not exist"
exit 1
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 "$dstarg" ]
then
dstarg="$dstarg"/`basename "$srcarg"`
fi
fi
## this sed command emulates the dirname command
dstdir=`echo "$dstarg" | 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
$doit $mkdirprog "${pathcomp}"
if [ x"$chowncmd" != x ]; then $doit $chowncmd "${pathcomp}"; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "${pathcomp}"; else true ; fi &&
if [ x"$pathcompchmodcmd" != x ]; then $doit $pathcompchmodcmd "${pathcomp}"; else true ; fi
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
if [ -d "$dstarg" ]; then
true
else
$doit $mkdirprog "$dstarg" &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dstarg"; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dstarg"; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dstarg"; else true ; fi
fi
else
if [ x"$dstisfile" = x ]
then
file=$srcarg
else
file=$dst
fi
dstfile=`basename "$file"`
dstfinal="$dstdir/$dstfile"
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Make a backup file name in the proper directory.
case x$suffixfmt in
*%*) suffix=`echo x |
$awkprog -v bname="$dstfinal" -v fmt="$suffixfmt" '
{ cnt = 0;
do {
sfx = sprintf(fmt, cnt++);
name = bname sfx;
} while (system("test -f " name) == 0);
print sfx; }' -`;;
x) ;;
*) suffix="$suffixfmt";;
esac
dstbackup="$dstfinal$suffix"
# Move or copy the file name to the temp name
$doit $doinst $srcarg "$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 $stripflags "$dsttmp"; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else true;fi &&
# Now rename the file to the real destination.
if [ x"$suffix" != x ] && [ -f "$dstfinal" ]
then
$doit $mvcmd "$dstfinal" "$dstbackup"
else
$doit $rmcmd -f "$dstfinal"
fi &&
$doit $mvcmd "$dsttmp" "$dstfinal"
fi
done &&
exit 0