* Fix broken return value for doins.
authorZac Medico <zmedico@gentoo.org>
Sun, 30 Mar 2008 19:51:53 +0000 (19:51 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 30 Mar 2008 19:51:53 +0000 (19:51 -0000)
* Make newins cleanup temp files after itself.
(trunk r9634)

svn path=/main/branches/2.1.2/; revision=9635

bin/doins
bin/newins

index 945938c8b73b14835ac5443dcfed570ddd760c2b..57a21c4bb29a91dd3f11773e51f914725fb620b4 100755 (executable)
--- a/bin/doins
+++ b/bin/doins
@@ -28,7 +28,7 @@ fi
 [[ ! -d ${D}${INSDESTTREE} ]] && dodir "${INSDESTTREE}"
 
 _doins() {
-       local mysrc="$1" mydir="$2" cleanup=""
+       local mysrc="$1" mydir="$2" cleanup="" rval
 
        if [ -L "$mysrc" ] ; then
                cp "$mysrc" "${T}"
@@ -37,7 +37,9 @@ _doins() {
        fi
 
        install ${INSOPTIONS} "${mysrc}" "${D}${INSDESTTREE}/${mydir}"
+       rval=$?
        [[ -n ${cleanup} ]] && rm -f "${cleanup}"
+       return $rval
 }
 
 _xdoins() {
@@ -46,6 +48,8 @@ _xdoins() {
        done
 }
 
+success=0
+
 for x in "$@" ; do
        if [ -d "$x" ] ; then
                if [ "${DOINSRECUR}" == "n" ] ; then
@@ -63,7 +67,10 @@ for x in "$@" ; do
                find "${x##*/}" -type d -exec dodir "${INSDESTTREE}/{}" \;
                find "${x##*/}" \( -type f -or -type l \) -print0 | _xdoins
                popd >/dev/null
+               ((++success))
        else
-               _doins "${x}"
+               _doins "${x}" && ((++success))
        fi
 done
+
+[ $success -gt 0 ] && exit 0 || exit 1
index c64e066001ff4978ff891844f881deecb0d2bb89..7735fc33cf7fbc261efcf19d2c584abb78db825f 100755 (executable)
@@ -8,6 +8,9 @@ if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
        exit 1
 fi
 
-rm -rf "${T}/${2}" && \
-cp -f "${1}" "${T}/${2}" && \
-exec doins "${T}/${2}"
+rm -rf "${T}/${2}" || exit $?
+cp -f "${1}" "${T}/${2}" || exit $?
+doins "${T}/${2}"
+ret=$?
+rm -rf "${T}/${2}"
+exit $ret