Set Installed File Permissions for Linux: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
(point out that the info is obsolete.)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:HowTo]]
'''NOTE: This information is <u>''outdated''</u>''' for newer Qt versions! No direct replacement exists yet; it is possible to assign the .commands property of an install target to override the built-ins.
Here is a guide to set permissions for installed files on linux.
Here is a guide to set permissions for installed files on linux.


In your .pro file, change <span class="caps">QMAKE</span>_INSTALL_FILE and <span class="caps">QMAKE</span>_INSTALL_PROGRAM to the following:
In your .pro file, change QMAKE_INSTALL_FILE and QMAKE_INSTALL_PROGRAM to the following:
 
<code>QMAKE_INSTALL_FILE = install -m <permission octals> -p -o <user> -g <group>
QMAKE_INSTALL_PROGRAM = install -m <permission octals> -p -o <user> -g <group></code>


where:
where:
 
* <permissions octals> is the standard linux permissions octals (ex: 755).
* &lt;permissions octals&gt; is the standard linux permissions octals (ex: 755).
* <owner> is the owner of the file. This parameter can be ommited.
* &lt;owner&gt; is the owner of the file. This parameter can be ommited.
* <group> is the group owner of the file. This parameter can also be ommited.
* &lt;group&gt; is the group owner of the file. This parameter can also be ommited.


Here is an example implementation. In this example, I install my binary in the folder /opt/myApp and give it permissions 6755 with root as the owner and root as the group owner.
Here is an example implementation. In this example, I install my binary in the folder /opt/myApp and give it permissions 6755 with root as the owner and root as the group owner.


Additional “install” parameters can be found here: http://linux.about.com/library/cmd/blcmdl1_install.htm
<code>unix {
 
target.path = /opt/myApp
===Categories:===
INSTALLS += target


* [[:Category:HowTo|HowTo]]
QMAKE_INSTALL_FILE = install -m 6755 -p -o root -g root
QMAKE_INSTALL_PROGRAM = install -m 6755 -p -o root -g root
}</code>

Latest revision as of 10:17, 19 November 2018

NOTE: This information is outdated for newer Qt versions! No direct replacement exists yet; it is possible to assign the .commands property of an install target to override the built-ins.

Here is a guide to set permissions for installed files on linux.

In your .pro file, change QMAKE_INSTALL_FILE and QMAKE_INSTALL_PROGRAM to the following:

QMAKE_INSTALL_FILE = install -m <permission octals> -p -o <user> -g <group>
QMAKE_INSTALL_PROGRAM = install -m <permission octals> -p -o <user> -g <group>

where:

  • <permissions octals> is the standard linux permissions octals (ex: 755).
  • <owner> is the owner of the file. This parameter can be ommited.
  • <group> is the group owner of the file. This parameter can also be ommited.

Here is an example implementation. In this example, I install my binary in the folder /opt/myApp and give it permissions 6755 with root as the owner and root as the group owner.

unix {
 target.path = /opt/myApp
 INSTALLS += target

QMAKE_INSTALL_FILE = install -m 6755 -p -o root -g root
 QMAKE_INSTALL_PROGRAM = install -m 6755 -p -o root -g root
}