owner and group

Answered

Comments

1 comment

  • Avatar
    wojciechka

    It is possible to set defaultUnixGroup and defaultUnixOwner this way.

    However, please note that those values are used for unpacking files only when the installer was built on Windows. If the installer is built on Unix machine, the installer gets file owner/group from the filesystem.

    It is a good idea to also check if the environment variable is present - for example the installer may be run by root and actually be run without sudo (such as ssh as root). Also, it can use SUDO_GID environment variable if it is present, as in some cases the group name may not be the user name:

    <actionGroup>
      <ruleList>
        <isTrue>
          <value>${installer_is_root_install}</value>
        </isTrue>
        <compareTextLength>
          <length>0</length>
          <logic>does_not_equal</logic>
          <text>${env(SUDO_USER)}</text>
        </compareTextLength>
      </ruleList>
      <actionList>
        <setInstallerVariable>
          <name>project.defaultUnixGroup</name>
          <value>${env(SUDO_USER)}</value>
        </setInstallerVariable>
        <setInstallerVariable>
          <name>project.defaultUnixGroup</name>
          <value>${env(SUDO_GID)}</value>
          <ruleList>
            <compareTextLength>
              <length>0</length>
              <logic>does_not_equal</logic>
              <text>${env(SUDO_GID)}</text>
            </compareTextLength>
          </ruleList>
        </setInstallerVariable>
        <setInstallerVariable>
          <name>project.defaultUnixOwner</name>
          <value>${env(SUDO_USER)}</value>
        </setInstallerVariable>
      </actionList>
    </actionGroup>
    

Please sign in to leave a comment.