Re: [dev] Is there a reason to use install(1)?

From: Kris Maglione <maglione.k_AT_gmail.com>
Date: Sat, 29 May 2010 18:15:40 -0400

On Sat, May 29, 2010 at 11:56:26PM +0200, markus schnalke wrote:
>[2010-05-29 23:46] Moritz Wilhelmy <crap_AT_wzff.de>
>> > Very often I see makefile use install(1) when cp, mkdir, chmod, and
>> > Co. would be equally compact.
>>
>> Consider
>>
>> install -D -m755 -u foo -g bar foo.sh $DESTDIR/usr/bin
>>
>> vs.
>>
>> mkdir -p $DESTDIR/usr/bin
>> cp foo.sh $DESTDIR/usr/bin
>> chmod 755 $DESTDIR/usr/bin/foo.sh
>> chown foo:bar $DESTDIR/usr/bin/foo.sh
>>
>> and tell me about "equally compact" again...
>
>I know about such cases, but this is not the common case, at least as
>far as I've seen it.
>
>
>You mean, install is just meant as a wrapper around the standard tools
>to express the actions in a more compact way. (btw: It's a shame that
>install isn't a shell script then.)

But it is the common case. At the very least copying and setting
the permissions is the common case, mkdir is very common, and
the chown comes about often enough. When you have to install a
half dozen different files, it adds up. And it's definitely
nearly universally available (except on Plan 9) despite not
being defined by POSIX, but you're right about the
incompatibilities—though they don't really matter if you don't
try anything fancy.

I personally don't use it, though. I prefer to use make rules,
and when it comes down to it, I'd rather just write my own
utility rather than worry about any of the above.

-- 
Kris Maglione
There are two ways to write error-free programs; only the third works.
	--Alan J. Perlis
Received on Sat May 29 2010 - 22:15:40 UTC

This archive was generated by hypermail 2.2.0 : Sat May 29 2010 - 22:24:01 UTC