summaryrefslogtreecommitdiffstats
path: root/bin/dosbin
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-02-04 05:56:09 +0000
committerMike Frysinger <vapier@gentoo.org>2006-02-04 05:56:09 +0000
commit349beefedf261a4e7a98790f4bc0bfde09f5dd1c (patch)
tree711fbe37b430177e61388267984b8b2cc1258839 /bin/dosbin
parentc3b0e4c7e136a88c989efc169a7716c558737fce (diff)
downloadportage-349beefedf261a4e7a98790f4bc0bfde09f5dd1c.tar.gz
portage-349beefedf261a4e7a98790f4bc0bfde09f5dd1c.tar.bz2
portage-349beefedf261a4e7a98790f4bc0bfde09f5dd1c.zip
cleanup code and handle errors better as Simon Stelling says in Bug 121317
svn path=/main/trunk/; revision=2654
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}