Hi Marcel, * Marcel Loose wrote on Wed, Dec 28, 2005 at 03:59:04PM CET: > > I was wondering why install-sh does not support the BSD install -C > option (install file, unless target already exists and is the same as > the new file). I consider this option quite useful, especially since > automake uses install-sh whenever you install header files prefixed > with nobase_ (see my bug report in GNATS database, #475).
There seems to be no attachment with the bug report. In any case though, I guess this will explain why install-sh is used: http://lists.gnu.org/archive/html/automake-patches/2001-10/msg00131.html It may be possible to achieve the same effect without using it; but be warned that install-sh is distributed because on some systems it will be necessary to use it, so it's not portable to expect extra functionality of $INSTALL. > So, I cooked up this patch (see attachment) for install-sh. I have no > idea whether it meets your quality standards, since this is the very > first patch I'm uploading. Please send feedback (positive or > negative), so I can learn. I think the patch idea ok (but I am not to decide), except for a minor nit below; it would probably help the maintainer to base it off the CVS in-source version of install-sh, which is somewhat newer (and then use `$dst' instead of `$dstdir/$dstfile'). | @@ -264,6 +271,12 @@ | trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 | trap '(exit $?); exit' 1 2 13 15 | | + # If -C was supplied, then *only* copy the source file if | + # source and destination are different. | + test -n "$instifmod" \ | + && $doit $cmpprog "$src" "$dstdir/$dstfile" >/dev/null 2>&1 \ I would not dump stdout, only stderr, so that doit=echo remains useful, and then use `cmp -s' as default cmpprog. Just a suggestion though. (Also, the preferred layout style in this file seems to be to put the `&&' at the end of the line and no following `\'.) | + && continue | + | # Copy the file name to the temp name. | $doit $cpprog "$src" "$dsttmp" && Cheers, Ralf