summaryrefslogtreecommitdiffstats
path: root/bin/dosbin
diff options
context:
space:
mode:
Diffstat (limited to 'bin/dosbin')
-rwxr-xr-xbin/dosbin31
1 files changed, 18 insertions, 13 deletions
diff --git a/bin/dosbin b/bin/dosbin
index 17bb8bb36..0e67275f8 100755
--- a/bin/dosbin
+++ b/bin/dosbin
@@ -3,25 +3,30 @@
# Distributed under the terms of the GNU General Public License v2
# $Id: /var/cvsroot/gentoo-src/portage/bin/dosbin,v 1.11 2004/10/04 13:56:50 vapier Exp $
-if [ ${#} -lt 1 ] ; then
- echo "${0}: at least one argument needed"
+if [[ $# -lt 1 ]] ; then
+ echo "$0: at least one argument needed" 1>&2
exit 1
fi
-if [ ! -d "${D}${DESTTREE}/sbin" ] ; then
+
+if [[ ! -d ${D}${DESTTREE}/sbin ]] ; then
install -d "${D}${DESTTREE}/sbin" || exit 2
fi
+case ${CHOST} in
+ *-freebsd*) group=wheel ;;
+ *) group=root ;;
+esac
+
+ret=0
+
for x in "$@" ; do
- if [ -x "${x}" ] ; then
- #if executable, use existing perms
- install -m0755 "${x}" "${D}${DESTTREE}/sbin" || exit 3
+ if [[ -e ${x} ]] ; then
+ install -m0755 -o root -g ${group} "${x}" "${D}${DESTTREE}/sbin"
else
- #otherwise, use reasonable defaults
- echo ">>> dosbin: making ${x} executable..."
- if [ "$USERLAND" == "GNU" ]; then
- install -m0755 -o root -g root "${x}" "${D}${DESTTREE}/sbin" || exit 4
- else
- install -m0755 -o root -g wheel "${x}" "${D}${DESTTREE}/sbin" || exit 4
- fi
+ echo "!!! ${0##*/}: ${x} does not exist" 1>&2
+ false
fi
+ ((ret+=$?))
done
+
+exit ${ret}