#! /bin/sh1#2# Copyright (c) 1999 Marcel Moolenaar3# All rights reserved.4#5# Redistribution and use in source and binary forms, with or without6# modification, are permitted provided that the following conditions7# are met:8# 1. Redistributions of source code must retain the above copyright9# notice, this list of conditions and the following disclaimer10# in this position and unchanged.11# 2. Redistributions in binary form must reproduce the above copyright12# notice, this list of conditions and the following disclaimer in the13# documentation and/or other materials provided with the distribution.14# 3. The name of the author may not be used to endorse or promote products15# derived from this software without specific prior written permission16#17# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR18# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES19# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.20# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,21# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT22# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,23# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY24# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF26# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.27#2829# parse install's options and ignore them completely.30dirmode=""31linkmode=""32while [ $# -gt 0 ]; do33case $1 in34-d) dirmode="YES"; shift;;35-[bCcpSsUv]) shift;;36-[BDfghMmNoT]) shift; shift;;37-[BDfghMmNoT]*) shift;;38-l)39shift40case $1 in41*[sm]*) linkmode="symbolic";; # XXX: 'm' should prefer hard42*h*) linkmode="hard";;43*) echo "invalid link mode"; exit 1;;44esac45shift46;;47*) break;48esac49done5051if [ "$#" -eq 0 ]; then52echo "$0: no files/dirs specified" >&253exit 154fi5556if [ -z "$dirmode" ] && [ "$#" -lt 2 ]; then57echo "$0: no target specified" >&258exit 159fi6061# the remaining arguments are assumed to be files/dirs only.62if [ -n "${linkmode}" ]; then63if [ "${linkmode}" = "symbolic" ]; then64ln -fsn "$@"65else66ln -f "$@"67fi68elif [ -z "$dirmode" ]; then69exec install -p "$@"70else71exec install -d "$@"72fi737475