[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is it possible to set the permission bits used by the default instal

From: Peter Johansson
Subject: Re: Is it possible to set the permission bits used by the default install target in a
Date: Mon, 18 Mar 2019 19:20:00 +1000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3

On 3/14/2019 3:24 AM, Nick Bowler wrote:
Hello Craig,

On 2019-03-13, Craig Sanders <address@hidden> wrote:
Is it possible to set the permission bits used by the default install
target in a

To help try and illustrate what I mean, I present a code snippet from one
of my files.

Begin code snippet >>>>>>>>>>
gimpdir = ${prefix}

gimp_SCRIPTS = \

.PHONY: install

     mkdir -p ${prefix}
     ${INSTALL} -m 544 ${prefix}
     ${INSTALL} -m 444 ${prefix}

<<<<<<<<<< End code snippet <<<<<<<<<<

My problem with this code snippet is - I don't like the fact that I have
overridden the default install target to get the files installed with the
permission bits set the way I want. Rather, I'd like to have the default
install target do the install work for me, using permission bits that I
would like to specify. Does anybody know if this is possible?
Automake uses INSTALL_SCRIPT to install scripts, which is normally provided
by AC_PROG_INSTALL from Autoconf (and is set to INSTALL).  You can set
this explicitly in to something different (or change the
value in configure).

However, that's probably a pain because you want different permissions
for different files.

One option would be to use both xxx_DATA and xxx_SCRIPTS, which are
installed by INSTALL_DATA and INSTALL_SCRIPT, respectively (this is the
only practical difference between xxx_DATA and xxx_SCRIPTS).  You can
then adjust those variables separately as desired.

Alternately you can use install-local[1] instead, to get more flexibility
but without replacing the standard "install" target.  Try to respect
DESTDIR as well, and prefer $(MKDIR_P) over open-coding mkdir -p.
For example (totally untested):

   544_scripts =
   444_scripts =

   install-local: install-my-scripts
        $(MKDIR_P) "$(DESTDIR)$(gimpdir)"
        $(INSTALL) -m 544 $(544_scripts) "$(DESTDIR)$(gimpdir)"
        $(INSTALL) -m 444 $(444_scripts) "$(DESTDIR)$(gimpdir)"
   .PHONY: install-my-scripts

The manual has the following example of an install hook. I suppose you could use something similar, probably a lot easier as changing the permission bits is easier than creating a link as in the example below

        cd $(DESTDIR)$(bindir) && \
          mv -f prog$(EXEEXT) prog-$(VERSION)$(EXEEXT) && \
          $(LN_S) prog-$(VERSION)$(EXEEXT) prog$(EXEEXT)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]