How can I find out the name of the user which has launched the installer?



1 comment

  • Avatar

    There is an internal variable automatically set by the installer: ${system_username}. It works in all supported platforms, including Windows.

    However, if you launched the installer using sudo and want to check the logged user, you can use ${env(SUDO_USER)}:

    <!-- SUDO_USER is defined just when using sudo -->
    <setInstallerVariable name="username" value="${env(SUDO_USER)}"/>
    <setInstallerVariable name="username" value="${system_username}">
          <!-- Accessing non-existent environment variables result in an empty string -->
          <compareText text="${username}" logic="equals" value=""/>

    Thanks to Fabrizio Vitale for providing this information.

    Comment actions Permalink

Please sign in to leave a comment.