From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 11:46:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E8F8106566B; Tue, 10 Mar 2009 11:46:42 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D1318FC29; Tue, 10 Mar 2009 11:46:42 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2ABkgxB061293; Tue, 10 Mar 2009 11:46:42 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2ABkgSq061292; Tue, 10 Mar 2009 11:46:42 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903101146.n2ABkgSq061292@svn.freebsd.org> From: Robert Watson Date: Tue, 10 Mar 2009 11:46:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189618 - head/contrib/top X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Mar 2009 11:46:43 -0000 Author: rwatson Date: Tue Mar 10 11:46:41 2009 New Revision: 189618 URL: http://svn.freebsd.org/changeset/base/189618 Log: Merge r183430 from vendor/top/dist to head/contrib/top, although with record-only mergeinfo because an automated merge is confused by the flattening that took place: Move install to install-sh to prevent name-clashes. MFC after: 3 days Added: head/contrib/top/install-sh (props changed) - copied unchanged from r189617, head/contrib/top/install Deleted: head/contrib/top/install Modified: head/contrib/top/ (props changed) Copied: head/contrib/top/install-sh (from r189617, head/contrib/top/install) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/top/install-sh Tue Mar 10 11:46:41 2009 (r189618, copy of r189617, head/contrib/top/install) @@ -0,0 +1,69 @@ +#!/bin/sh +# +# this shell script is amazingly similar to the old and lamented +# BSD "install" command. It recognized the following options: +# +# -o target file owner +# -m target file mode +# -g target file group owner +# +# +# scan the options +# +while [ $# -gt 0 ]; do + case $1 in + -o) + owner=$2 + shift ; shift + ;; + + -m) + mode=$2 + shift; shift + ;; + + -g) + group=$2 + shift ; shift + ;; + + -*) + echo "install: unknown option $1" + exit + ;; + + *) + break + ;; + esac +done +# +# we need two more: filename and destination +# +if [ $# -ne 2 ]; then + echo "Usage: install [ -o owner ] [ -m mode ] [ -g group ] file destination" + exit +fi +# +# first, copy +# +cp $1 $2 +# +# normalize the name +# +dest=$2 +if [ -d $2 ]; then + dest=$2/`basename $1` +fi +# +# do optional things +# +if [ "$owner" ]; then + chown $owner $dest +fi +if [ "$group" ]; then + chgrp $group $dest +fi +if [ "$mode" ]; then + chmod $mode $dest +fi