% On 2005-02-14 at 10:51:50 -0500, Aaron Walker wrote:
> > 
> > But what do you do if you have executable and non-executable files mixed
> > in the subtree?
> > [ ... ]
>
> Georgi Georgiev wrote:
> 
> AFAIK, there's not a gentoo way to recursively copy files whilst preserving
> permissions when said files are of different permissions.
> [ ... ]

Perhaps a small addition to 'doins' for this case, which could be
made optional by adding a '-p' for "preserve mode" option.  Untested patch
attached which could use some getopt mojo for flexible argument order.

Requires GNU fileutils >= 4.0 according to chmod(1).  Portage internal
variables not entirely clear to me without RTFM.  Portage hackers: please
suggest corrections.

Yours,
-- 
Gontran
--- /usr/lib/portage/bin/doins  2005-02-11 17:14:36.000000000 -0700
+++ doins       2005-02-14 18:46:36.000000000 -0700
@@ -8,12 +8,17 @@
        exit 1
 fi
 
+DOINSRECUR=n
 if [ "${1}" == "-r" ] ; then
        DOINSRECUR=y
        shift
-else
-       DOINSRECUR=n
 fi
+
+PRESERVE_PERMS=n
+if [ "${1}" == "-p" ] ; then
+       PRESERVE_PERMS=y
+       shift
+
 [ -z "${INSDEPTH}" ] && declare -i INSDEPTH=0
 if [ ${INSDEPTH} -gt 30 ] ; then
        echo "${0}: sanity check ... 30 directories is too much :("
@@ -50,4 +55,8 @@
                mysrc="${x}"
        fi
        install ${INSOPTIONS} "${mysrc}" "${D}${INSDESTTREE}"
+
+       if [ "${PRESERVE_PERMS}" == "y" ] ; then
+               chmod --referencefile="${mysrc}" "${D}${INSDESTTREE}/${mysrc}"
+       fi
 done

--
[email protected] mailing list

Reply via email to