summaryrefslogtreecommitdiffstats
path: root/bin/doins
diff options
context:
space:
mode:
authorJason Stubbs <jstubbs@gentoo.org>2005-08-28 08:37:44 +0000
committerJason Stubbs <jstubbs@gentoo.org>2005-08-28 08:37:44 +0000
commitd9fc4acc572c6647a4f27b838d35d27d805d190e (patch)
tree262a8de35d8c7567312757da5f1f66efdc8cece5 /bin/doins
downloadportage-d9fc4acc572c6647a4f27b838d35d27d805d190e.tar.gz
portage-d9fc4acc572c6647a4f27b838d35d27d805d190e.tar.bz2
portage-d9fc4acc572c6647a4f27b838d35d27d805d190e.zip
Migration (without history) of the current stable line to subversion.
svn path=/main/branches/2.0/; revision=1941
Diffstat (limited to 'bin/doins')
-rwxr-xr-xbin/doins53
1 files changed, 53 insertions, 0 deletions
diff --git a/bin/doins b/bin/doins
new file mode 100755
index 000000000..551905e93
--- /dev/null
+++ b/bin/doins
@@ -0,0 +1,53 @@
+#!/bin/bash
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-src/portage/bin/doins,v 1.7.2.2 2004/12/17 22:25:13 carpaski Exp $
+
+if [ $# -lt 1 ] ; then
+ echo "${0}: at least one argument needed"
+ exit 1
+fi
+
+if [ "${1}" == "-r" ] ; then
+ DOINSRECUR=y
+ shift
+else
+ DOINSRECUR=n
+fi
+[ -z "${INSDEPTH}" ] && declare -i INSDEPTH=0
+if [ ${INSDEPTH} -gt 30 ] ; then
+ echo "${0}: sanity check ... 30 directories is too much :("
+ exit 1
+fi
+
+if [ "${INSDESTTREE%${D}*}" == "" ]; then
+ echo "-------------------------------------------------------" 1>&2
+ echo "You should not use \${D} with helpers." 1>&2
+ echo " --> ${INSDESTTREE}" 1>&2
+ echo "-------------------------------------------------------" 1>&2
+ #exit 1
+fi
+
+[ ! -d "${D}${INSDESTTREE}" ] && dodir "${INSDESTTREE}"
+
+for x in "$@" ; do
+ if [ -L "$x" ] ; then
+ cp "$x" "${T}"
+ mysrc="${T}/$(/usr/bin/basename "${x}")"
+ elif [ -d "$x" ] ; then
+ if [ "${DOINSRECUR}" == "n" ] ; then
+ continue
+ fi
+
+ mydir="${INSDESTTREE}/$(basename "${x}")"
+ find "${x}" -mindepth 1 -maxdepth 1 -exec \
+ env \
+ INSDESTTREE="${mydir}" \
+ INSDEPTH=$((INSDEPTH+1)) \
+ doins -r {} \;
+ continue
+ else
+ mysrc="${x}"
+ fi
+ install ${INSOPTIONS} "${mysrc}" "${D}${INSDESTTREE}"
+done