view lispintro/install-sh @ 49612:407d6516031a

2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de> Version 2.0.29 released. * net/tramp.el (tramp-send-region): Protect against tramp-chunksize being nil. 2003-02-04 Michael Albinus <Michael.Albinus@alcatel.de> * net/tramp.el (tramp-handle-directory-file-name): Handle the case PATH is "". (tramp-completion-handle-file-name-all-completions): Define `tramp-current-user' locally. See `tramp-parse-passwd'. (tramp-parse-passwd): For su-alike methods it would be desirable to return "root@localhost" as default. Unfortunately, we have no information whether any user name has been typed already. So we (mis-)use tramp-current-user as indication, assuming it is set in `tramp-completion-handle-file-name-all-completions'. (tramp-send-region): Handle the case `tramp-chunksize' is equal 0. I did it accidently. Infinite loop ... * net/tramp-ftp.el (top-level): eval-after-load "ange-ftp" '(tramp-disable-ange-ftp). Suggested by Kai. (tramp-ftp-file-name-handler): `tramp-disable-ange-ftp' not needed any longer. * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Apply `tramp-handle-directory-file-name' in order to profit from Kai's yesterday changes. 2003-02-03 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de> * net/tramp.el (tramp-chunksize): Set default to 500 as workaround for some ssh connections. (tramp-handle-directory-file-name): New implementation. Not sure if it works. 2003-01-28 Michael Albinus <Michael.Albinus@alcatel.de> * net/tramp.el (tramp-get-device): `tramp-make-tramp-file-name' must not be called with NIL path. It fails in case of multi-method. 2003-01-27 Michael Albinus <Michael.Albinus@alcatel.de> * net/tramp.el (tramp-file-name-for-operation): Apply `expand-file-name' for relative file names only. Otherwise there might be problems if the default directory is another Tramp directory as the directory the file is based on. (tramp-find-foreign-file-name-handler): Check whether FILENAME is a Tramp file name. It isn't if it comes from an expanded file name (like "/xx:yy//zz"). 2003-01-25 Michael Albinus <Michael.Albinus@alcatel.de> * net/tramp.el (tramp-devices): New variable. Keeps virtual device numbers. Devices must distinguish physical file systems. The device numbers provided by "lstat" aren't unique, because we operate on different hosts. So we use virtual device numbers, generated by `tramp-get-device'. Both Ange-FTP and EFS use device number -1. In order to be different, we use device number (-1 x), whereby "x" is unique for a given (multi-method method user host). Suggested by Kai. (tramp-perl-file-attributes): Always return device number -1. There will be a virtual device number set in `tramp-handle-file-attributes', which replaces this one. (tramp-handle-file-attributes): Set virtual device number. (tramp-get-device): New function. Returns the virtual device number. If it doesn't exist, generate a new one. (tramp-handle-file-regular-p): Use Emacs file name primitives instead of calling tramp-handle-* equivalents directly. Needed for tramp-smb. * net/tramp-smb.el (tramp-smb-devices, tramp-smb-get-device): Removed. Functionality moved to tramp.el. (tramp-smb-handle-file-attributes): Apply `tramp-get-device'. ATIME and CTIME are (0 0) now (= "don't know"), which is more honest. (tramp-smb-handle-make-directory): Use Emacs file name primitives instead of calling tramp-smb-handle-* equivalents directly. (tramp-smb-read-file-entry): Return size as a number but a string. 2003-01-24 Michael Albinus <Michael.Albinus@alcatel.de> * net/tramp.el (tramp-completion-function-alist-ssh): Add parsing of "/etc/ssh_config" and "~/.ssh/config". Suggested by Kai. (tramp-completion-function-alist, tramp-set-completion-function): Doc string update. (tramp-parse-sconfig, tramp-parse-sconfig-group): New functions. Provide parsing of "~/.ssh/config" style files. 2003-01-21 Michael Albinus <Michael.Albinus@alcatel.de> * net/tramp.el (tramp-completion-handle-expand-file-name): Apply `tramp-drop-volume-letter'. Otherwise, there are problems on W32 systems. 2003-01-21 Michael Albinus <Michael.Albinus@alcatel.de> * net/tramp-smb.el (tramp-smb-get-device, tramp-smb-get-inode): New functions. Device number and inode number don't exist for SMB files. Therefore we must generate virtual ones. (tramp-smb-devices, tramp-smb-inodes): New variables. Keep generated virtual device numbers and inodes numbers for SMB files. (tramp-smb-handle-file-attributes): Apply them. 2003-01-14 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de> * net/tramp.el (tramp-md5-function): Require md5 before checking function md5. If using md5-encode, put wrapper around it that converts vector of bytes to ascii text. 2003-01-13 Michael Albinus <Michael.Albinus@alcatel.de> * net/tramp.el (tramp-completion-mode): Perform check (integerp last-input-event) before (event-modifiers last-input-event) - there might be problems if `last-input-event' is a mouse event. 2003-01-12 Michael Albinus <Michael.Albinus@alcatel.de> * net/tramp.el (tramp-parse-rhosts, tramp-parse-shosts) (tramp-parse-hosts, tramp-parse-passwd, tramp-parse-netrc): Use `file-readable-p' instead of `file-exists-p'. Otherwise these functions might block. Reported by <kin@neoscale.com>. 2003-01-02 Michael Albinus <Michael.Albinus@alcatel.de> * net/tramp-ftp.el (top-level): Defaults for `tramp-default-method-alist' must be a list. * net/tramp-smb.el (top-level): Defaults for `tramp-default-method-alist' must be a list. 2003-01-02 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de> * net/tramp.el (top-level): Avoid byte-compiler warnings of unused variables if the byte-compiler supports this. This is for the with-parsed-tramp-file-name macro which is wont to produce such stuff.
author Kai Großjohann <kgrossjo@eu.uu.net>
date Wed, 05 Feb 2003 21:03:36 +0000
parents 23a1cea22d13
children
line wrap: on
line source

#!/bin/sh
#
# 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.  It can only install one file at a time, a restriction
# shared with many OS's install programs.


# 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}"

transformbasename=""
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