#!@BASH@
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Id: /var/cvsroot/gentoo-src/portage/bin/doins,v 1.7.2.2 2004/12/17 22:25:13 carpaski Exp $
+# $Id: $
if [ $# -lt 1 ] ; then
- echo "${0}: at least one argument needed"
+ echo "${0##*/}: at least one argument needed" 1>&2
exit 1
fi
-if [ "${1}" == "-r" ] ; then
+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 :("
+[[ -z ${INSDEPTH} ]] && declare -i INSDEPTH=0
+if [[ ${INSDEPTH} -gt 30 ]] ; then
+ echo "${0##*/}: sanity check ... 30 directories is too much :(" 2>&1
exit 1
fi
-if [ "${INSDESTTREE%${ED}*}" == "" ]; then
- echo "-------------------------------------------------------" 1>&2
- echo "You should not use \${ED} with helpers." 1>&2
- echo " --> ${INSDESTTREE}" 1>&2
- echo "-------------------------------------------------------" 1>&2
- #exit 1
+if [[ ${INSDESTTREE#${D}} != "${INSDESTTREE}" ]]; then
+ vecho "-------------------------------------------------------" 1>&2
+ vecho "You should not use \${D} or \${ED} with helpers." 1>&2
+ vecho " --> ${INSDESTTREE}" 1>&2
+ vecho "-------------------------------------------------------" 1>&2
+ exit 1
+fi
+
+if [[ ${INSDESTTREE#${EPREFIX}} != "${INSDESTTREE}" ]]; then
+ vecho "-------------------------------------------------------" 1>&2
+ vecho "You should not use \${EPREFIX} with helpers." 1>&2
+ vecho " --> ${INSDESTTREE}" 1>&2
+ vecho "-------------------------------------------------------" 1>&2
+ exit 1
fi
-[ ! -d "${ED}${INSDESTTREE}" ] && dodir "${INSDESTTREE}"
+[[ ! -d ${ED}${INSDESTTREE} ]] && dodir "${INSDESTTREE}"
for x in "$@" ; do
if [ -L "$x" ] ; then