Fix it so an empty directory given to doins -r does not trigger failure.
authorZac Medico <zmedico@gentoo.org>
Fri, 29 Jan 2010 18:45:59 +0000 (18:45 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 29 Jan 2010 18:45:59 +0000 (18:45 -0000)
(trunk r15172)

svn path=/main/branches/2.1.7/; revision=15238

bin/ebuild-helpers/doins

index cf4644770afa1d2115d15ac211f49da0b47b5e4c..db19750e3fdee44705259d754e5ca78b03c15b23 100755 (executable)
@@ -63,16 +63,12 @@ _doins() {
 }
 
 _xdoins() {
-       local -i success=0 failed=0
+       local -i failed=0
        while read -d $'\0' x ; do
                _doins "$x" "${x%/*}"
-               if [[ $? -eq 0 ]] ; then
-                       ((success|=1))
-               else
-                       ((failed|=1))
-               fi
+               ((failed|=$?))
        done
-       [[ $failed -ne 0 || $success -eq 0 ]] && return 1 || return 0
+       return $failed
 }
 
 success=0
@@ -109,6 +105,9 @@ for x in "$@" ; do
                find "$x_orig" -type d -exec dodir "${INSDESTTREE}/{}" \;
                find "$x_orig" \( -type f -or -type l \) -print0 | _xdoins
                if [[ ${PIPESTATUS[1]} -eq 0 ]] ; then
+                       # NOTE: Even if only an empty directory is installed here, it
+                       # still counts as success, since an empty directory given as
+                       # an argument to doins -r should not trigger failure.
                        ((success|=1))
                else
                        ((failed|=1))