install.sh revision 218940
154310Smarcel#! /bin/sh
254310Smarcel#
354310Smarcel# Copyright (c) 1999 Marcel Moolenaar
454310Smarcel# All rights reserved.
554310Smarcel#
654310Smarcel# Redistribution and use in source and binary forms, with or without
754310Smarcel# modification, are permitted provided that the following conditions
854310Smarcel# are met:
954310Smarcel# 1. Redistributions of source code must retain the above copyright
1054310Smarcel#    notice, this list of conditions and the following disclaimer 
1154310Smarcel#    in this position and unchanged.
1254310Smarcel# 2. Redistributions in binary form must reproduce the above copyright
1354310Smarcel#    notice, this list of conditions and the following disclaimer in the
1454310Smarcel#    documentation and/or other materials provided with the distribution.
1554310Smarcel# 3. The name of the author may not be used to endorse or promote products
1697748Sschweikh#    derived from this software without specific prior written permission
1754310Smarcel#
1854310Smarcel# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1954310Smarcel# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2054310Smarcel# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2154310Smarcel# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2254310Smarcel# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2354310Smarcel# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2454310Smarcel# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2554310Smarcel# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2654310Smarcel# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2754310Smarcel# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2854310Smarcel#
2954310Smarcel# $FreeBSD: head/tools/install.sh 218940 2011-02-22 08:07:17Z uqs $
3054310Smarcel
3154310Smarcel# parse install's options and ignore them completely.
32218940Suqsdirmode=""
33125514Sruwhile [ $# -gt 0 ]; do
3454310Smarcel    case $1 in
35218940Suqs    -d) dirmode="YES"; shift;;
36218940Suqs    -[bCcMpSsv]) shift;;
37125514Sru    -[Bfgmo]) shift; shift;;
38131737Sru    -[Bfgmo]*) shift;;
3954310Smarcel    *) break;
4054310Smarcel    esac
4154310Smarceldone
4254310Smarcel
43218940Suqsif [ "$#" -eq 0 ]; then
44218940Suqs	echo "$0: no files/dirs specified" >&2
45218940Suqs	exit 1
46218940Suqsfi
47218940Suqs
48218940Suqsif [ -z "$dirmode" ] && [ "$#" -lt 2 ]; then
49218940Suqs	echo "$0: no target specified" >&2
50218940Suqs	exit 1
51218940Suqsfi
52218940Suqs
5354389Smarcel# the remaining arguments are assumed to be files/dirs only.
54218940Suqsif [ -z "$dirmode" ]; then
55218940Suqs	exec install -p "$@"
56218940Suqselse
57218940Suqs	exec install -d "$@"
58218940Suqsfi
59